Modify error message encountered during stack update

Parameters of an existing stack can be updated with
openstack stack update <stack> --existing --parameter <parameter>=<newvalue>
Example : openstack stack update stack1 --parameter p1=v1
If the --existing option is skipped, it leads to the below error
Need to specify exactly one of --template-file, --template-url or --template-object
This error is misleading as the user might think that stack update
cannot be performed without specifying a new template.

Modify the error message with --existing option.

Change-Id: Idce88bde848378e00b1c873245600ba205939668
Closes-Bug: #1723864
This commit is contained in:
PriyaDuggirala 2017-10-26 19:54:07 +05:30
parent 868f3b80b7
commit f73c2a4177
2 changed files with 6 additions and 4 deletions

View File

@ -74,11 +74,13 @@ def get_template_contents(template_file=None, template_url=None,
return {}, None
else:
raise exc.CommandError(_('Need to specify exactly one of '
'%(arg1)s, %(arg2)s or %(arg3)s') %
'[%(arg1)s, %(arg2)s or %(arg3)s]'
' or %(arg4)s') %
{
'arg1': '--template-file',
'arg2': '--template-url',
'arg3': '--template-object'})
'arg3': '--template-object',
'arg4': '--existing'})
if not tpl:
raise exc.CommandError(_('Could not fetch template from %s')

View File

@ -616,8 +616,8 @@ class TestGetTemplateContents(testtools.TestCase):
exc.CommandError,
template_utils.get_template_contents)
self.assertEqual(
('Need to specify exactly one of --template-file, '
'--template-url or --template-object'),
('Need to specify exactly one of [--template-file, '
'--template-url or --template-object] or --existing'),
str(ex))
def test_get_template_contents_file_none_existing(self):