summaryrefslogtreecommitdiff
path: root/heatclient/osc
diff options
context:
space:
mode:
authorCrag Wolfe <cwolfe@redhat.com>2017-01-28 00:37:47 -0500
committerCrag Wolfe <cwolfe@redhat.com>2017-01-28 01:04:29 -0500
commitc1e793f3b81403d32d665679001264716aa38505 (patch)
tree8d7c4a99900a356e1797fb28826392175fc1aeb8 /heatclient/osc
parent17dd3068e4d6fc10236290cc082908c439bcfead (diff)
downloadpython-heatclient-c1e793f3b81403d32d665679001264716aa38505.tar.gz
Don't always resolve outputs when showing a stack
* Whenever a stack is created/updated/adopted, a call to show the stack is made. Do not resolve the outputs when showing the stack in this case because: * If we are not waiting (there is no --wait arg) for the stack to complete after a create/update/adopt command and immediately showing the stack, resolving the outputs is just incurring a pointless processing hit on the server (ultimately heat-engine) and delaying a response to the client. * Whether we --wait or or not, we only show "short" stack info which doesn't include outputs anyway. So, let's avoid the processing/time overhead of resolving the outputs. (In theory, with --wait we might want to show "long" output with stack outputs afterwards, but that would be additional functionality that should be handled in a different patch) * Add the --no-resolve-outputs option to "stack show" which already exists in the legacy heat stack-show command. Change-Id: Id0661b11fd3cece0df3981488de6976219556d7e Closes-Bug: #1659896 Closes-Bug: #1659899
Diffstat (limited to 'heatclient/osc')
-rw-r--r--heatclient/osc/v1/stack.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/heatclient/osc/v1/stack.py b/heatclient/osc/v1/stack.py
index cf03cec..f8cf9e3 100644
--- a/heatclient/osc/v1/stack.py
+++ b/heatclient/osc/v1/stack.py
@@ -380,19 +380,28 @@ class ShowStack(command.ShowOne):
metavar='<stack>',
help='Stack to display (name or ID)',
)
+ parser.add_argument(
+ '--no-resolve-outputs', action="store_true",
+ help=_('Do not resolve outputs of the stack.')
+ )
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
heat_client = self.app.client_manager.orchestration
- return _show_stack(heat_client, stack_id=parsed_args.stack,
- format=parsed_args.formatter)
+ return _show_stack(
+ heat_client, stack_id=parsed_args.stack,
+ format=parsed_args.formatter,
+ resolve_outputs=(not parsed_args.no_resolve_outputs))
-def _show_stack(heat_client, stack_id, format='', short=False):
+def _show_stack(heat_client, stack_id, format='', short=False,
+ resolve_outputs=True):
try:
- data = heat_client.stacks.get(stack_id=stack_id)
+ _resolve_outputs = not short and resolve_outputs
+ data = heat_client.stacks.get(stack_id=stack_id,
+ resolve_outputs=_resolve_outputs)
except heat_exc.HTTPNotFound:
raise exc.CommandError('Stack not found: %s' % stack_id)
else:
@@ -408,11 +417,10 @@ def _show_stack(heat_client, stack_id, format='', short=False):
]
if not short:
- columns += [
- 'parameters',
- 'outputs',
- 'links',
- ]
+ columns.append('parameters')
+ if _resolve_outputs:
+ columns.append('outputs')
+ columns.append('links')
exclude_columns = ('template_description',)
for key in data.to_dict():