Permalink
Browse files

Deprecate commands and add unified cli replacements.

This is to bring into line with
http://wiki.openstack.org/UnifiedCLI/Mapping

Here is the mapping, as displayed by 'heat help'
    create              DEPRECATED! Use stack-create instead
    delete              DEPRECATED! Use stack-delete instead
    describe            DEPRECATED! Use stack-show instead
    event               DEPRECATED! Use event-show instead
    event-list          List events for a stack
    event-show          Describe the event
    gettemplate         DEPRECATED! Use template-show instead
    list                DEPRECATED! Use stack-list instead
    resource            DEPRECATED! Use resource-show instead
    resource-list       Show list of resources belonging to a stack
    resource-metadata   List resource metadata
    resource-show       Describe the resource
    stack-create        Create the stack
    stack-delete        Delete the stack
    stack-list          List the user's stacks
    stack-show          Describe the stack
    stack-update        Update the stack
    template-show       Get the template for the specified stack
    template-validate   Validate a template with parameters
    update              DEPRECATED! Use stack-update instead
    validate            DEPRECATED! Use template-validate instead
    help                Display help about this program or one of its
                        subcommands.

Change-Id: I1a296de2b935be6cc28fcc49ef8ee7ae333abf1a
  • Loading branch information...
1 parent 727d07e commit 03f9f84abfa348bed08ee39d4d0ae1bc8ace5355 @steveb steveb committed Dec 3, 2012
Showing with 96 additions and 5 deletions.
  1. +94 −3 heatclient/v1/shell.py
  2. +2 −2 tests/test_shell.py
View
@@ -56,31 +56,62 @@ def _set_template_fields(hc, args, fields):
@utils.arg('name', metavar='<STACK_NAME>',
help='Name of the stack to create.')
def do_create(hc, args):
+ '''DEPRECATED! Use stack-create instead'''
+ do_stack_create(hc, args)
+
+
+@utils.arg('-f', '--template-file', metavar='<FILE>',
+ help='Path to the template.')
+@utils.arg('-u', '--template-url', metavar='<URL>',
+ help='URL of template.')
+@utils.arg('-o', '--template-object', metavar='<URL>',
+ help='URL to retrieve template object (e.g from swift)')
+@utils.arg('-c', '--create-timeout', metavar='<TIMEOUT>',
+ default=60, type=int,
+ help='Stack creation timeout in minutes. Default: 60')
+@utils.arg('-P', '--parameters', metavar='<KEY1=VALUE1;KEY2=VALUE2...>',
+ help='Parameter values used to create the stack.')
+@utils.arg('name', metavar='<STACK_NAME>',
+ help='Name of the stack to create.')
+def do_stack_create(hc, args):
'''Create the stack'''
fields = {'stack_name': args.name,
'timeoutmins': args.create_timeout,
'parameters': utils.format_parameters(args.parameters)}
_set_template_fields(hc, args, fields)
hc.stacks.create(**fields)
- do_list(hc)
+ do_stack_list(hc)
@utils.arg('id', metavar='<NAME or ID>', help='Name or ID of stack to delete.')
def do_delete(hc, args):
+ '''DEPRECATED! Use stack-delete instead'''
+ do_stack_delete(hc, args)
+
+
+@utils.arg('id', metavar='<NAME or ID>', help='Name or ID of stack to delete.')
+def do_stack_delete(hc, args):
'''Delete the stack'''
fields = {'stack_id': args.id}
try:
hc.stacks.delete(**fields)
except exc.HTTPNotFound:
raise exc.CommandError('Stack not found: %s' % args.id)
else:
- do_list(hc)
+ do_stack_list(hc)
@utils.arg('id', metavar='<NAME or ID>',
help='Name or ID of stack to describe.')
def do_describe(hc, args):
+ '''DEPRECATED! Use stack-show instead'''
+ do_stack_show(hc, args)
+
+
+@utils.arg('id', metavar='<NAME or ID>',
+ help='Name or ID of stack to describe.')
+def do_stack_show(hc, args):
'''Describe the stack'''
fields = {'stack_id': args.id}
try:
@@ -113,6 +144,21 @@ def do_describe(hc, args):
@utils.arg('id', metavar='<NAME or ID>',
help='Name or ID of stack to update.')
def do_update(hc, args):
+ '''DEPRECATED! Use stack-update instead'''
+ do_stack_update(hc, args)
+
+
+@utils.arg('-f', '--template-file', metavar='<FILE>',
+ help='Path to the template.')
+@utils.arg('-u', '--template-url', metavar='<URL>',
+ help='URL of template.')
+@utils.arg('-o', '--template-object', metavar='<URL>',
+ help='URL to retrieve template object (e.g from swift)')
+@utils.arg('-P', '--parameters', metavar='<KEY1=VALUE1;KEY2=VALUE2...>',
+ help='Parameter values used to create the stack.')
+@utils.arg('id', metavar='<NAME or ID>',
+ help='Name or ID of stack to update.')
+def do_stack_update(hc, args):
'''Update the stack'''
fields = {'stack_id': args.id,
'parameters': utils.format_parameters(args.parameters)}
@@ -123,6 +169,11 @@ def do_update(hc, args):
def do_list(hc, args={}):
+ '''DEPRECATED! Use stack-list instead'''
+ do_stack_list(hc, args)
+
+
+def do_stack_list(hc, args={}):
'''List the user's stacks'''
kwargs = {}
stacks = hc.stacks.list(**kwargs)
@@ -134,7 +185,14 @@ def do_list(hc, args={}):
@utils.arg('id', metavar='<NAME or ID>',
help='Name or ID of stack to get the template for.')
def do_gettemplate(hc, args):
- '''Get the template'''
+ '''DEPRECATED! Use template-show instead'''
+ do_template_show(hc, args)
+
+
+@utils.arg('id', metavar='<NAME or ID>',
+ help='Name or ID of stack to get the template for.')
+def do_template_show(hc, args):
+ '''Get the template for the specified stack'''
fields = {'stack_id': args.id}
try:
template = hc.stacks.template(**fields)
@@ -153,6 +211,19 @@ def do_gettemplate(hc, args):
@utils.arg('-P', '--parameters', metavar='<KEY1=VALUE1;KEY2=VALUE2...>',
help='Parameter values to validate.')
def do_validate(hc, args):
+ '''DEPRECATED! Use template-validate instead'''
+ do_template_validate(hc, args)
+
+
+@utils.arg('-u', '--template-url', metavar='<URL>',
+ help='URL of template.')
+@utils.arg('-f', '--template-file', metavar='<FILE>',
+ help='Path to the template.')
+@utils.arg('-o', '--template-object', metavar='<URL>',
+ help='URL to retrieve template object (e.g from swift)')
+@utils.arg('-P', '--parameters', metavar='<KEY1=VALUE1;KEY2=VALUE2...>',
+ help='Parameter values to validate.')
+def do_template_validate(hc, args):
'''Validate a template with parameters'''
fields = {'parameters': utils.format_parameters(args.parameters)}
_set_template_fields(hc, args, fields)
@@ -183,6 +254,15 @@ def do_resource_list(hc, args):
@utils.arg('resource', metavar='<RESOURCE>',
help='Name of the resource to show the details for.')
def do_resource(hc, args):
+ '''DEPRECATED! Use resource-show instead'''
+ do_resource_show(hc, args)
+
+
+@utils.arg('id', metavar='<NAME or ID>',
+ help='Name or ID of stack to show the resource for.')
+@utils.arg('resource', metavar='<RESOURCE>',
+ help='Name of the resource to show the details for.')
+def do_resource_show(hc, args):
'''Describe the resource'''
fields = {'stack_id': args.id,
'resource_name': args.resource}
@@ -245,6 +325,17 @@ def do_event_list(hc, args):
@utils.arg('event', metavar='<EVENT>',
help='ID of event to display details for')
def do_event(hc, args):
+ '''DEPRECATED! Use event-show instead'''
+ do_event_show(hc, args)
+
+
+@utils.arg('id', metavar='<NAME or ID>',
+ help='Name or ID of stack to show the events for.')
+@utils.arg('resource', metavar='<RESOURCE>',
+ help='Name of the resource the event belongs to.')
+@utils.arg('event', metavar='<EVENT>',
+ help='ID of event to display details for')
+def do_event_show(hc, args):
'''Describe the event'''
fields = {'stack_id': args.id,
'resource_name': args.resource,
View
@@ -195,11 +195,11 @@ def test_help(self):
def test_help_on_subcommand(self):
required = [
- '^usage: heat list',
+ '^usage: heat stack-list',
"(?m)^List the user's stacks",
]
argstrings = [
- 'help list',
+ 'help stack-list',
]
for argstr in argstrings:
help_text = self.shell(argstr)

0 comments on commit 03f9f84

Please sign in to comment.