Merge "Change --remove-property format"

This commit is contained in:
Jenkins 2016-09-28 20:48:48 +00:00 committed by Gerrit Code Review
commit 793fb641b7
2 changed files with 8 additions and 13 deletions

View File

@ -179,7 +179,7 @@ class UpdateArtifact(command.ShowOne):
),
parser.add_argument(
'--remove-property',
metavar='<key=value>',
metavar='<key>',
action='append',
default=[],
help='Property that will be removed.'
@ -196,21 +196,16 @@ class UpdateArtifact(command.ShowOne):
def take_action(self, parsed_args):
LOG.debug('take_action({0})'.format(parsed_args))
remove_props = {}
for datum in parsed_args.remove_property:
key, value = datum.split('=', 1)
remove_props[key] = value
prop = {}
for datum in parsed_args.property:
key, value = datum.split('=', 1)
prop[key] = value
client = self.app.client_manager.artifact
data = client.artifacts.update(parsed_args.id,
type_name=parsed_args.type_name,
remove_props=remove_props,
**prop)
data = client.artifacts.update(
parsed_args.id, type_name=parsed_args.type_name,
remove_props=parsed_args.remove_property, **prop)
return self.dict2columns(data)

View File

@ -220,10 +220,10 @@ class TestUpdateArtifacts(TestArtifacts):
def test_artifact_update_multiremove_prop(self):
arglist = ['sample_artifact',
'fc15c365-d4f9-4b8b-a090-d9e230f1f6ba',
'--remove-property', 'prop1=1',
'--remove-property', 'prop2=2']
'--remove-property', 'prop1',
'--remove-property', 'prop2']
verify = [('type_name', 'sample_artifact'),
('remove_property', ['prop1=1', 'prop2=2'])]
('remove_property', ['prop1', 'prop2'])]
parsed_args = self.check_parser(self.cmd, arglist, verify)
columns, data = self.cmd.take_action(parsed_args)
# Check that columns are correct