rename --kwargs to --attributes
As discussed at api review, attributes is preferred to kwargs Change-Id: I8d3c6ed8f25ddea44d86f4b40c7172d8fa9be103
This commit is contained in:
parent
2ec8130365
commit
2bbef9ca44
@ -53,10 +53,10 @@ class CreateDevice(tackerV10.CreateCommand):
|
|||||||
required=True,
|
required=True,
|
||||||
help='device template id to create device based on')
|
help='device template id to create device based on')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--kwargs',
|
'--attributes',
|
||||||
metavar='<key>=<value>',
|
metavar='<key>=<value>',
|
||||||
action='append',
|
action='append',
|
||||||
dest='kwargs',
|
dest='attributes',
|
||||||
default=[],
|
default=[],
|
||||||
help='instance specific argument')
|
help='instance specific argument')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -75,16 +75,16 @@ class CreateDevice(tackerV10.CreateCommand):
|
|||||||
'template_id': parsed_args.device_template_id,
|
'template_id': parsed_args.device_template_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if parsed_args.kwargs:
|
if parsed_args.attributes:
|
||||||
try:
|
try:
|
||||||
kwargs = dict(key_value.split('=', 1)
|
attributes = dict(key_value.split('=', 1)
|
||||||
for key_value in parsed_args.kwargs)
|
for key_value in parsed_args.attributes)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
msg = (_('invalid argument for --kwargs %s') %
|
msg = (_('invalid argument for --attributes %s') %
|
||||||
parsed_args.kwargs)
|
parsed_args.attributes)
|
||||||
raise exceptions.TackerCLIError(msg)
|
raise exceptions.TackerCLIError(msg)
|
||||||
if kwargs:
|
if attributes:
|
||||||
body[self.resource]['kwargs'] = kwargs
|
body[self.resource]['attributes'] = attributes
|
||||||
if parsed_args.service_context:
|
if parsed_args.service_context:
|
||||||
try:
|
try:
|
||||||
service_context = [dict(
|
service_context = [dict(
|
||||||
@ -111,25 +111,25 @@ class UpdateDevice(tackerV10.UpdateCommand):
|
|||||||
|
|
||||||
def add_known_arguments(self, parser):
|
def add_known_arguments(self, parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--kwargs',
|
'--attributes',
|
||||||
metavar='<key>=<value>',
|
metavar='<key>=<value>',
|
||||||
action='append',
|
action='append',
|
||||||
dest='kwargs',
|
dest='attributes',
|
||||||
default=[],
|
default=[],
|
||||||
help='instance specific argument')
|
help='instance specific argument')
|
||||||
|
|
||||||
def args2body(self, parsed_args):
|
def args2body(self, parsed_args):
|
||||||
body = {self.resource: {}}
|
body = {self.resource: {}}
|
||||||
if parsed_args.kwargs:
|
if parsed_args.attributes:
|
||||||
try:
|
try:
|
||||||
kwargs = dict(key_value.split('=', 1)
|
attributes = dict(key_value.split('=', 1)
|
||||||
for key_value in parsed_args.kwargs)
|
for key_value in parsed_args.attributes)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
msg = (_('invalid argument for --kwargs %s') %
|
msg = (_('invalid argument for --attributes %s') %
|
||||||
parsed_args.kwargs)
|
parsed_args.attributes)
|
||||||
raise exceptions.TackerCLIError(msg)
|
raise exceptions.TackerCLIError(msg)
|
||||||
if kwargs:
|
if attributes:
|
||||||
body[self.resource]['kwargs'] = kwargs
|
body[self.resource]['attributes'] = attributes
|
||||||
tackerV10.update_dict(parsed_args, body[self.resource], ['tenant_id'])
|
tackerV10.update_dict(parsed_args, body[self.resource], ['tenant_id'])
|
||||||
return body
|
return body
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user