diff options
| author | Jenkins <jenkins@review.openstack.org> | 2017-01-26 06:38:31 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2017-01-26 06:38:31 +0000 |
| commit | da2a820d2f4e5589671f494edcd8e8b3e69b7cb0 (patch) | |
| tree | 741b3f26bfc312ddcc546da63a306984ad6462d2 /openstackclient/volume/v2 | |
| parent | d189e807fdfc7222b18844a56db2e43412f49abb (diff) | |
| parent | 26d50be79a401322f4e74b94c066257ddf0f287c (diff) | |
| download | python-openstackclient-da2a820d2f4e5589671f494edcd8e8b3e69b7cb0.tar.gz | |
Merge "Support "--no-property" option in volume snapshot set"
Diffstat (limited to 'openstackclient/volume/v2')
| -rw-r--r-- | openstackclient/volume/v2/volume_snapshot.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/openstackclient/volume/v2/volume_snapshot.py b/openstackclient/volume/v2/volume_snapshot.py index 3283bb53..f12cfed9 100644 --- a/openstackclient/volume/v2/volume_snapshot.py +++ b/openstackclient/volume/v2/volume_snapshot.py @@ -306,6 +306,15 @@ class SetVolumeSnapshot(command.Command): help=_('New snapshot description') ) parser.add_argument( + "--no-property", + dest="no_property", + action="store_true", + help=_("Remove all properties from <snapshot> " + "(specify both --no-property and --property to " + "remove the current properties before setting " + "new properties.)"), + ) + parser.add_argument( '--property', metavar='<key=value>', action=parseractions.KeyValueAction, @@ -331,6 +340,17 @@ class SetVolumeSnapshot(command.Command): parsed_args.snapshot) result = 0 + if parsed_args.no_property: + try: + key_list = snapshot.metadata.keys() + volume_client.volume_snapshots.delete_metadata( + snapshot.id, + list(key_list), + ) + except Exception as e: + LOG.error(_("Failed to clean snapshot properties: %s"), e) + result += 1 + if parsed_args.property: try: volume_client.volume_snapshots.set_metadata( |
