'update-vim' to update params without config file.

Change-Id: Icb869f26a212776c453313642faefb31eb921ccf
Closes-Bug: #1674906
This commit is contained in:
Trinath Somanchi 2017-03-27 13:16:39 +05:30 committed by gong yong sheng
parent 03be84f491
commit 10b06eb2ff

View File

@ -92,7 +92,7 @@ class UpdateVIM(tackerV10.UpdateCommand):
def add_known_arguments(self, parser):
parser.add_argument(
'--config-file',
required=True,
required=False,
help=_('YAML file with VIM configuration parameters'))
parser.add_argument(
'--name',
@ -108,16 +108,14 @@ class UpdateVIM(tackerV10.UpdateCommand):
def args2body(self, parsed_args):
body = {self.resource: {}}
config_param = None
# config arg passed as data overrides config yaml when both args passed
if parsed_args.config_file:
with open(parsed_args.config_file) as f:
config_yaml = f.read()
config_param = yaml.load(config_yaml)
if 'auth_url' in config_param:
raise exceptions.TackerClientException(message='Auth URL cannot '
'be updated',
status_code=404)
vim_obj = body[self.resource]
if config_param is not None:
vim_utils.args2body_vim(config_param, vim_obj)
tackerV10.update_dict(parsed_args, body[self.resource],
['tenant_id', 'name', 'description',