Comment 2 for bug 1432533

Revision history for this message
Steve Baker (steve-stevebaker) wrote :

To be clear, I am *not* suggesting any change to the stack-list display format.

Also, these commands can't just switch to the stack-show display format because it is possible that some scripts are parsing the output.

The solution I am suggesting is for these commands to follow up by doing a stacks.get(stack_id) and then formatting that as if it was a stack-list with a single entry, so something like the following pseudo-code

    body = hc.stacks.create(**fields)
    self._display_single_list_stack(body['stack']['id'])

def _display_single_list_stack(self, stack_id)
    stack = hc.stacks.get(stack_id)
    stacks = [{'id': stack.id ...}]
    fields = ['id', 'stack_name', 'stack_status', 'creation_time']
    utils.print_list(stacks, fields, sortby_index=3)

Then all actions attached to this bug can just use _display_single_list_stack

I marked the other bugs as duplicates since the fixes for them will be basically identical to this one, even if they are submitted as separate changes.