"heat stack-create" command returns list of all the stacks

Bug #1432533 reported by rajiv
42
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-heatclient
In Progress
Medium
rajiv

Bug Description

when a stack is created then it returns list of all the stacks, For example

# heat stack-create -f /home/centos/simpleHeatTemplate.template test

+--------------------------------------+-------------+--------------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+-------------+--------------------+----------------------+
| 631ba443-eb88-4c56-852d-17e664e21212 | thenakliman | CREATE_COMPLETE | 2015-03-12T11:36:11Z |
| e6abc6b5-27a1-4136-a03e-dd4b5ca2af4e | test | CREATE_IN_PROGRESS | 2015-03-13T03:23:54Z |
+--------------------------------------+-------------+--------------------+----------------------+

I think, output from this command must be the stack created.

This bug can also be used to make the same change to the following commands
- action-suspend
- action-resume
- stack-adopt
- stack-update
- stack-delete

rajiv (rajiv-kumar)
Changed in python-heatclient:
assignee: nobody → rajiv (rajiv-kumar)
Revision history for this message
Steve Baker (steve-stevebaker) wrote :

I would like the above output format to remain the same (the stack-list format) but it should only display the details of the stack which was operated on.

This bug can be used to track doing this change to all stack operation commands which return a stack-list response.

Changed in python-heatclient:
status: New → Triaged
importance: Undecided → Medium
description: updated
description: updated
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.

Revision history for this message
Pavlo Shchelokovskyy (pshchelo) wrote :

Why not use filtering capabilities of stack-list? just pass the returned stack_id as a id filer to do_stack_list in every command affected

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

yes, that would be nice and simple. Should probably still implement it in a _display_single_list_stack method so we don't have to create a fake args object for do_stack_list

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-heatclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/166693

Changed in python-heatclient:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-heatclient (master)

Change abandoned by rajiv (<email address hidden>) on branch: master
Review: https://review.openstack.org/166693

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.