diff options
author | dixiaoli <dixiaobj@cn.ibm.com> | 2016-02-29 14:46:15 +0800 |
---|---|---|
committer | dixiaoli <dixiaobj@cn.ibm.com> | 2016-03-01 10:31:31 +0800 |
commit | d058207867c5deca673864c0dfb4e18d3029e927 (patch) | |
tree | 9de38640c2136b2e8c7567450f4dc41f7a640707 /heatclient/osc | |
parent | 4f4575565cf0f93781f4fb273ad65342536c33c2 (diff) | |
download | python-heatclient-d058207867c5deca673864c0dfb4e18d3029e927.tar.gz |
Add OSC plugin for openstack orchestation build info
This change implements the "openstack orchestration build info" command
Based on the existing heat command: heat build-info
Change-Id: I8801d56fbe8119c47f708e620f35215c8664cda7
Blueprint: heat-support-python-openstackclient
Diffstat (limited to 'heatclient/osc')
-rw-r--r-- | heatclient/osc/v1/build_info.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/heatclient/osc/v1/build_info.py b/heatclient/osc/v1/build_info.py new file mode 100644 index 0000000..11dead5 --- /dev/null +++ b/heatclient/osc/v1/build_info.py @@ -0,0 +1,46 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# + +"""Orchestration v1 build info action implementations""" + +import logging +import six + +from cliff import show +from openstackclient.common import utils + +from heatclient.common import utils as heat_utils + + +class BuildInfo(show.ShowOne): + """Retrieve build information.""" + + log = logging.getLogger(__name__ + ".BuildInfo") + + def get_parser(self, prog_name): + parser = super(BuildInfo, self).get_parser(prog_name) + return parser + + def take_action(self, parsed_args): + self.log.debug("take_action(%s)", parsed_args) + + heat_client = self.app.client_manager.orchestration + result = heat_client.build_info.build_info() + + formatters = { + 'api': heat_utils.json_formatter, + 'engine': heat_utils.json_formatter, + } + columns = sorted(list(six.iterkeys(result))) + return columns, utils.get_dict_properties(result, columns, + formatters=formatters) |