From f73c2a4177377b710a02577feea38560b00a24bf Mon Sep 17 00:00:00 2001 From: PriyaDuggirala Date: Thu, 26 Oct 2017 19:54:07 +0530 Subject: [PATCH] Modify error message encountered during stack update Parameters of an existing stack can be updated with openstack stack update --existing --parameter = 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 --- heatclient/common/template_utils.py | 6 ++++-- heatclient/tests/unit/test_template_utils.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/heatclient/common/template_utils.py b/heatclient/common/template_utils.py index b38710be..cdb330a1 100644 --- a/heatclient/common/template_utils.py +++ b/heatclient/common/template_utils.py @@ -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') diff --git a/heatclient/tests/unit/test_template_utils.py b/heatclient/tests/unit/test_template_utils.py index 01cfa13a..e4303c64 100644 --- a/heatclient/tests/unit/test_template_utils.py +++ b/heatclient/tests/unit/test_template_utils.py @@ -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):