Make set/unset commands in volume return normally when nothing specified
set/unset commands should ends up normally instead of logging an error when nothing is specified to modify. The main reason is: When nothing is specified, the command sets/unsets nothing, which is a normal behavior, and ends up normally. No API call fails. No error happens. Change-Id: Ib03a512650e5da90aa1ef38019772448383d0d33 Partial-bug: #1588588
This commit is contained in:
parent
55a7ba890d
commit
2672e37ee2
@ -578,9 +578,6 @@ class TestVolumeSet(TestVolume):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.assertEqual("No changes requested\n",
|
||||
self.app.log.messages.get('error'))
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_volume_set_name(self):
|
||||
|
@ -202,8 +202,6 @@ class SetQos(command.Command):
|
||||
if parsed_args.property:
|
||||
volume_client.qos_specs.set_keys(qos_spec.id,
|
||||
parsed_args.property)
|
||||
else:
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
|
||||
|
||||
class ShowQos(command.ShowOne):
|
||||
@ -263,5 +261,3 @@ class UnsetQos(command.Command):
|
||||
if parsed_args.property:
|
||||
volume_client.qos_specs.unset_keys(qos_spec.id,
|
||||
parsed_args.property)
|
||||
else:
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
|
@ -208,10 +208,6 @@ class SetSnapshot(command.Command):
|
||||
if parsed_args.description:
|
||||
kwargs['display_description'] = parsed_args.description
|
||||
|
||||
if not kwargs and not parsed_args.property:
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
return
|
||||
|
||||
snapshot.update(**kwargs)
|
||||
|
||||
|
||||
@ -270,5 +266,3 @@ class UnsetSnapshot(command.Command):
|
||||
snapshot.id,
|
||||
parsed_args.property,
|
||||
)
|
||||
else:
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
|
@ -363,9 +363,6 @@ class SetVolume(command.Command):
|
||||
if kwargs:
|
||||
volume_client.volumes.update(volume.id, **kwargs)
|
||||
|
||||
if not kwargs and not parsed_args.property and not parsed_args.size:
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
|
||||
|
||||
class ShowVolume(command.ShowOne):
|
||||
"""Show volume details"""
|
||||
@ -428,5 +425,3 @@ class UnsetVolume(command.Command):
|
||||
volume.id,
|
||||
parsed_args.property,
|
||||
)
|
||||
else:
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
|
@ -181,5 +181,3 @@ class UnsetVolumeType(command.Command):
|
||||
|
||||
if parsed_args.property:
|
||||
volume_type.unset_keys(parsed_args.property)
|
||||
else:
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
|
@ -202,8 +202,6 @@ class SetQos(command.Command):
|
||||
if parsed_args.property:
|
||||
volume_client.qos_specs.set_keys(qos_spec.id,
|
||||
parsed_args.property)
|
||||
else:
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
|
||||
|
||||
class ShowQos(command.ShowOne):
|
||||
@ -263,5 +261,3 @@ class UnsetQos(command.Command):
|
||||
if parsed_args.property:
|
||||
volume_client.qos_specs.unset_keys(qos_spec.id,
|
||||
parsed_args.property)
|
||||
else:
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
|
@ -205,11 +205,6 @@ class SetSnapshot(command.Command):
|
||||
if parsed_args.description:
|
||||
kwargs['description'] = parsed_args.description
|
||||
|
||||
if (not kwargs and not parsed_args.property and not
|
||||
parsed_args.state):
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
return
|
||||
|
||||
if parsed_args.property:
|
||||
volume_client.volume_snapshots.set_metadata(snapshot.id,
|
||||
parsed_args.property)
|
||||
@ -271,5 +266,3 @@ class UnsetSnapshot(command.Command):
|
||||
snapshot.id,
|
||||
parsed_args.property,
|
||||
)
|
||||
else:
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
|
@ -385,10 +385,6 @@ class SetVolume(command.Command):
|
||||
if kwargs:
|
||||
volume_client.volumes.update(volume.id, **kwargs)
|
||||
|
||||
if (not kwargs and not parsed_args.property
|
||||
and not parsed_args.image_property and not parsed_args.size):
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
|
||||
|
||||
class ShowVolume(command.ShowOne):
|
||||
"""Display volume details"""
|
||||
|
@ -176,13 +176,6 @@ class SetVolumeType(command.Command):
|
||||
volume_type = utils.find_resource(
|
||||
volume_client.volume_types, parsed_args.volume_type)
|
||||
|
||||
if (not parsed_args.name
|
||||
and not parsed_args.description
|
||||
and not parsed_args.property
|
||||
and not parsed_args.project):
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
return
|
||||
|
||||
result = 0
|
||||
kwargs = {}
|
||||
if parsed_args.name:
|
||||
@ -285,11 +278,6 @@ class UnsetVolumeType(command.Command):
|
||||
parsed_args.volume_type,
|
||||
)
|
||||
|
||||
if (not parsed_args.property
|
||||
and not parsed_args.project):
|
||||
self.app.log.error(_("No changes requested\n"))
|
||||
return
|
||||
|
||||
result = 0
|
||||
if parsed_args.property:
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user