summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--heatclient/osc/v1/software_deployment.py23
-rw-r--r--heatclient/tests/unit/osc/v1/test_software_deployment.py15
-rw-r--r--setup.cfg1
3 files changed, 39 insertions, 0 deletions
diff --git a/heatclient/osc/v1/software_deployment.py b/heatclient/osc/v1/software_deployment.py
index 4451f83..545449b 100644
--- a/heatclient/osc/v1/software_deployment.py
+++ b/heatclient/osc/v1/software_deployment.py
@@ -14,6 +14,7 @@
"""Orchestration v1 Software Deployment action implementations"""
import logging
+from oslo_serialization import jsonutils
from cliff import command
from cliff import lister
@@ -263,3 +264,25 @@ class ShowDeployment(show.ShowOne):
if parsed_args.long:
columns.append('output_values')
return columns, utils.get_item_properties(data, columns)
+
+
+class ShowMetadataDeployment(command.Command):
+ """Get deployment configuration metadata for the specified server."""
+
+ log = logging.getLogger(__name__ + '.ShowMetadataDeployment')
+
+ def get_parser(self, prog_name):
+ parser = super(ShowMetadataDeployment, self).get_parser(prog_name)
+ parser.add_argument(
+ 'server',
+ metavar='<server>',
+ help=_('ID of the server to fetch deployments for')
+ )
+ return parser
+
+ def take_action(self, parsed_args):
+ self.log.debug("take_action(%s)", parsed_args)
+ heat_client = self.app.client_manager.orchestration
+ md = heat_client.software_deployments.metadata(
+ server_id=parsed_args.server)
+ print(jsonutils.dumps(md, indent=2))
diff --git a/heatclient/tests/unit/osc/v1/test_software_deployment.py b/heatclient/tests/unit/osc/v1/test_software_deployment.py
index 6427360..3799c2b 100644
--- a/heatclient/tests/unit/osc/v1/test_software_deployment.py
+++ b/heatclient/tests/unit/osc/v1/test_software_deployment.py
@@ -383,3 +383,18 @@ class TestDeploymentShow(TestDeployment):
exc.CommandError,
self.cmd.take_action,
parsed_args)
+
+
+class TestDeploymentMetadataShow(TestDeployment):
+
+ def setUp(self):
+ super(TestDeploymentMetadataShow, self).setUp()
+ self.cmd = software_deployment.ShowMetadataDeployment(self.app, None)
+ self.sd_client.metadata = mock.Mock(return_value={})
+
+ def test_deployment_show_metadata(self):
+ arglist = ['ec14c864-096e-4e27-bb8a-2c2b4dc6f3f5']
+ parsed_args = self.check_parser(self.cmd, arglist, [])
+ self.cmd.take_action(parsed_args)
+ self.sd_client.metadata.assert_called_with(
+ server_id='ec14c864-096e-4e27-bb8a-2c2b4dc6f3f5')
diff --git a/setup.cfg b/setup.cfg
index c0024c2..8453c8f 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -41,6 +41,7 @@ openstack.orchestration.v1 =
software_deployment_create = heatclient.osc.v1.software_deployment:CreateDeployment
software_deployment_delete = heatclient.osc.v1.software_deployment:DeleteDeployment
software_deployment_list = heatclient.osc.v1.software_deployment:ListDeployment
+ software_deployment_metadata_show = heatclient.osc.v1.software_deployment:ShowMetadataDeployment
software_deployment_show = heatclient.osc.v1.software_deployment:ShowDeployment
stack_abandon = heatclient.osc.v1.stack:AbandonStack
stack_adopt = heatclient.osc.v1.stack:AdoptStack