diff options
| author | Stephen Finucane <sfinucan@redhat.com> | 2023-05-08 10:54:22 +0100 |
|---|---|---|
| committer | Stephen Finucane <sfinucan@redhat.com> | 2023-05-10 10:51:30 +0100 |
| commit | 35ba1d8f1304d3255b96b704d524666ec5b6fea2 (patch) | |
| tree | 6d4ab560d4086e8b1a1f935b8531d7e85550cc36 /openstackclient/volume/v3 | |
| parent | 28ffa2bf9f017212da5eb84b0cf74df62e2f5eb9 (diff) | |
| download | python-openstackclient-35ba1d8f1304d3255b96b704d524666ec5b6fea2.tar.gz | |
Blacken openstackclient.volume
Black used with the '-l 79 -S' flags.
A future change will ignore this commit in git-blame history by adding a
'git-blame-ignore-revs' file.
Change-Id: Ic318617c67ab7ce6527f9016b759a1d4b0b80802
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'openstackclient/volume/v3')
| -rw-r--r-- | openstackclient/volume/v3/block_storage_cleanup.py | 35 | ||||
| -rw-r--r-- | openstackclient/volume/v3/block_storage_cluster.py | 16 | ||||
| -rw-r--r-- | openstackclient/volume/v3/block_storage_log_level.py | 56 | ||||
| -rw-r--r-- | openstackclient/volume/v3/block_storage_manage.py | 132 | ||||
| -rw-r--r-- | openstackclient/volume/v3/block_storage_resource_filter.py | 4 | ||||
| -rw-r--r-- | openstackclient/volume/v3/volume.py | 17 | ||||
| -rw-r--r-- | openstackclient/volume/v3/volume_attachment.py | 34 | ||||
| -rw-r--r-- | openstackclient/volume/v3/volume_group.py | 52 | ||||
| -rw-r--r-- | openstackclient/volume/v3/volume_group_snapshot.py | 15 | ||||
| -rw-r--r-- | openstackclient/volume/v3/volume_group_type.py | 23 | ||||
| -rw-r--r-- | openstackclient/volume/v3/volume_message.py | 15 |
11 files changed, 233 insertions, 166 deletions
diff --git a/openstackclient/volume/v3/block_storage_cleanup.py b/openstackclient/volume/v3/block_storage_cleanup.py index f99b8217..361440c9 100644 --- a/openstackclient/volume/v3/block_storage_cleanup.py +++ b/openstackclient/volume/v3/block_storage_cleanup.py @@ -31,8 +31,13 @@ def _format_cleanup_response(cleaning, unavailable): combined_data.append(details) for obj in unavailable: - details = (obj.id, obj.cluster_name, obj.host, obj.binary, - 'Unavailable') + details = ( + obj.id, + obj.cluster_name, + obj.host, + obj.binary, + 'Unavailable', + ) combined_data.append(details) return (column_headers, combined_data) @@ -49,20 +54,22 @@ class BlockStorageCleanup(command.Lister): parser.add_argument( '--cluster', metavar='<cluster>', - help=_('Name of block storage cluster in which cleanup needs ' - 'to be performed (name only)') + help=_( + 'Name of block storage cluster in which cleanup needs ' + 'to be performed (name only)' + ), ) parser.add_argument( "--host", metavar="<host>", default=None, - help=_("Host where the service resides. (name only)") + help=_("Host where the service resides. (name only)"), ) parser.add_argument( '--binary', metavar='<binary>', default=None, - help=_("Name of the service binary.") + help=_("Name of the service binary."), ) service_up_parser = parser.add_mutually_exclusive_group() service_up_parser.add_argument( @@ -72,7 +79,7 @@ class BlockStorageCleanup(command.Lister): default=None, help=_( 'Filter by up status. If this is set, services need to be up.' - ) + ), ) service_up_parser.add_argument( '--down', @@ -81,7 +88,7 @@ class BlockStorageCleanup(command.Lister): help=_( 'Filter by down status. If this is set, services need to be ' 'down.' - ) + ), ) service_disabled_parser = parser.add_mutually_exclusive_group() service_disabled_parser.add_argument( @@ -89,25 +96,25 @@ class BlockStorageCleanup(command.Lister): dest='disabled', action='store_true', default=None, - help=_('Filter by disabled status.') + help=_('Filter by disabled status.'), ) service_disabled_parser.add_argument( '--enabled', dest='disabled', action='store_false', - help=_('Filter by enabled status.') + help=_('Filter by enabled status.'), ) parser.add_argument( '--resource-id', metavar='<resource-id>', default=None, - help=_('UUID of a resource to cleanup.') + help=_('UUID of a resource to cleanup.'), ) parser.add_argument( '--resource-type', metavar='<Volume|Snapshot>', choices=('Volume', 'Snapshot'), - help=_('Type of resource to cleanup.') + help=_('Type of resource to cleanup.'), ) parser.add_argument( '--service-id', @@ -116,7 +123,7 @@ class BlockStorageCleanup(command.Lister): help=_( 'The service ID field from the DB, not the UUID of the ' 'service.' - ) + ), ) return parser @@ -138,7 +145,7 @@ class BlockStorageCleanup(command.Lister): 'disabled': parsed_args.disabled, 'resource_id': parsed_args.resource_id, 'resource_type': parsed_args.resource_type, - 'service_id': parsed_args.service_id + 'service_id': parsed_args.service_id, } filters = {k: v for k, v in filters.items() if v is not None} diff --git a/openstackclient/volume/v3/block_storage_cluster.py b/openstackclient/volume/v3/block_storage_cluster.py index 34b25efc..58bcae67 100644 --- a/openstackclient/volume/v3/block_storage_cluster.py +++ b/openstackclient/volume/v3/block_storage_cluster.py @@ -76,7 +76,9 @@ class ListBlockStorageCluster(command.Lister): def get_parser(self, prog_name): parser = super().get_parser(prog_name) parser.add_argument( - '--cluster', metavar='<name>', default=None, + '--cluster', + metavar='<name>', + default=None, help=_( 'Filter by cluster name, without backend will list ' 'all clustered services from the same cluster.' @@ -131,7 +133,7 @@ class ListBlockStorageCluster(command.Lister): '--long', action='store_true', default=False, - help=_("List additional fields in output") + help=_("List additional fields in output"), ) return parser @@ -183,7 +185,7 @@ class SetBlockStorageCluster(command.Command): parser.add_argument( 'cluster', metavar='<cluster>', - help=_('Name of block storage cluster to update (name only)') + help=_('Name of block storage cluster to update (name only)'), ) parser.add_argument( '--binary', @@ -192,7 +194,7 @@ class SetBlockStorageCluster(command.Command): help=_( "Name of binary to filter by; defaults to 'cinder-volume' " "(optional)" - ) + ), ) enabled_group = parser.add_mutually_exclusive_group() enabled_group.add_argument( @@ -200,13 +202,13 @@ class SetBlockStorageCluster(command.Command): action='store_false', dest='disabled', default=None, - help=_('Enable cluster') + help=_('Enable cluster'), ) enabled_group.add_argument( '--disable', action='store_true', dest='disabled', - help=_('Disable cluster') + help=_('Disable cluster'), ) parser.add_argument( '--disable-reason', @@ -215,7 +217,7 @@ class SetBlockStorageCluster(command.Command): help=_( 'Reason for disabling the cluster ' '(should be used with --disable option)' - ) + ), ) return parser diff --git a/openstackclient/volume/v3/block_storage_log_level.py b/openstackclient/volume/v3/block_storage_log_level.py index d5286cdd..878cf408 100644 --- a/openstackclient/volume/v3/block_storage_log_level.py +++ b/openstackclient/volume/v3/block_storage_log_level.py @@ -34,8 +34,10 @@ class BlockStorageLogLevelList(command.Lister): "--host", metavar="<host>", default="", - help=_("List block storage service log level of specified host " - "(name only)") + help=_( + "List block storage service log level of specified host " + "(name only)" + ), ) parser.add_argument( "--service", @@ -47,15 +49,18 @@ class BlockStorageLogLevelList(command.Lister): 'cinder-api', 'cinder-volume', 'cinder-scheduler', - 'cinder-backup'), - help=_("List block storage service log level of the specified " - "service (name only)") + 'cinder-backup', + ), + help=_( + "List block storage service log level of the specified " + "service (name only)" + ), ) parser.add_argument( "--log-prefix", metavar="<log-prefix>", default="", - help="Prefix for the log, e.g. 'sqlalchemy'" + help="Prefix for the log, e.g. 'sqlalchemy'", ) return parser @@ -78,12 +83,19 @@ class BlockStorageLogLevelList(command.Lister): data = service_client.services.get_log_levels( binary=parsed_args.service, server=parsed_args.host, - prefix=parsed_args.log_prefix) + prefix=parsed_args.log_prefix, + ) - return (columns, - (utils.get_item_properties( - s, columns, - ) for s in data)) + return ( + columns, + ( + utils.get_item_properties( + s, + columns, + ) + for s in data + ), + ) class BlockStorageLogLevelSet(command.Command): @@ -99,14 +111,16 @@ class BlockStorageLogLevelSet(command.Command): metavar="<log-level>", choices=('INFO', 'WARNING', 'ERROR', 'DEBUG'), type=str.upper, - help=_("Desired log level.") + help=_("Desired log level."), ) parser.add_argument( "--host", metavar="<host>", default="", - help=_("Set block storage service log level of specified host " - "(name only)") + help=_( + "Set block storage service log level of specified host " + "(name only)" + ), ) parser.add_argument( "--service", @@ -118,15 +132,18 @@ class BlockStorageLogLevelSet(command.Command): 'cinder-api', 'cinder-volume', 'cinder-scheduler', - 'cinder-backup'), - help=_("Set block storage service log level of specified service " - "(name only)") + 'cinder-backup', + ), + help=_( + "Set block storage service log level of specified service " + "(name only)" + ), ) parser.add_argument( "--log-prefix", metavar="<log-prefix>", default="", - help="Prefix for the log, e.g. 'sqlalchemy'" + help="Prefix for the log, e.g. 'sqlalchemy'", ) return parser @@ -144,4 +161,5 @@ class BlockStorageLogLevelSet(command.Command): level=parsed_args.level, binary=parsed_args.service, server=parsed_args.host, - prefix=parsed_args.log_prefix) + prefix=parsed_args.log_prefix, + ) diff --git a/openstackclient/volume/v3/block_storage_manage.py b/openstackclient/volume/v3/block_storage_manage.py index 9015f44d..6810e5c8 100644 --- a/openstackclient/volume/v3/block_storage_manage.py +++ b/openstackclient/volume/v3/block_storage_manage.py @@ -38,50 +38,61 @@ class BlockStorageManageVolumes(command.Lister): "host", metavar="<host>", nargs='?', - help=_('Cinder host on which to list manageable volumes. ' - 'Takes the form: host@backend-name#pool') + help=_( + 'Cinder host on which to list manageable volumes. ' + 'Takes the form: host@backend-name#pool' + ), ) host_group.add_argument( "--cluster", metavar="<cluster>", - help=_('Cinder cluster on which to list manageable volumes. ' - 'Takes the form: cluster@backend-name#pool. ' - '(supported by --os-volume-api-version 3.17 or later)') + help=_( + 'Cinder cluster on which to list manageable volumes. ' + 'Takes the form: cluster@backend-name#pool. ' + '(supported by --os-volume-api-version 3.17 or later)' + ), ) parser.add_argument( '--detailed', metavar='<detailed>', default=True, - help=_('Returns detailed information (Default=True).') + help=_('Returns detailed information (Default=True).'), ) parser.add_argument( '--marker', metavar='<marker>', default=None, - help=_('Begin returning volumes that appear later in the volume ' - 'list than that represented by this reference. This ' - 'reference should be json like. Default=None.') + help=_( + 'Begin returning volumes that appear later in the volume ' + 'list than that represented by this reference. This ' + 'reference should be json like. Default=None.' + ), ) parser.add_argument( '--limit', metavar='<limit>', default=None, - help=_('Maximum number of volumes to return. Default=None.') + help=_('Maximum number of volumes to return. Default=None.'), ) parser.add_argument( '--offset', metavar='<offset>', default=None, - help=_('Number of volumes to skip after marker. Default=None.') + help=_('Number of volumes to skip after marker. Default=None.'), ) parser.add_argument( '--sort', metavar='<key>[:<direction>]', default=None, - help=(_('Comma-separated list of sort keys and directions in the ' + help=( + _( + 'Comma-separated list of sort keys and directions in the ' 'form of <key>[:<asc|desc>]. ' 'Valid keys: %s. ' - 'Default=None.') % ', '.join(SORT_MANAGEABLE_KEY_VALUES)) + 'Default=None.' + ) + % ', '.join(SORT_MANAGEABLE_KEY_VALUES) + ), ) return parser @@ -119,11 +130,13 @@ class BlockStorageManageVolumes(command.Lister): 'safe_to_manage', ] if detailed: - columns.extend([ - 'reason_not_safe', - 'cinder_id', - 'extra_info', - ]) + columns.extend( + [ + 'reason_not_safe', + 'cinder_id', + 'extra_info', + ] + ) data = volume_client.volumes.list_manageable( host=parsed_args.host, @@ -132,12 +145,19 @@ class BlockStorageManageVolumes(command.Lister): limit=parsed_args.limit, offset=parsed_args.offset, sort=parsed_args.sort, - cluster=cluster) + cluster=cluster, + ) - return (columns, - (utils.get_item_properties( - s, columns, - ) for s in data)) + return ( + columns, + ( + utils.get_item_properties( + s, + columns, + ) + for s in data + ), + ) class BlockStorageManageSnapshots(command.Lister): @@ -153,50 +173,61 @@ class BlockStorageManageSnapshots(command.Lister): "host", metavar="<host>", nargs='?', - help=_('Cinder host on which to list manageable snapshots. ' - 'Takes the form: host@backend-name#pool') + help=_( + 'Cinder host on which to list manageable snapshots. ' + 'Takes the form: host@backend-name#pool' + ), ) host_group.add_argument( "--cluster", metavar="<cluster>", - help=_('Cinder cluster on which to list manageable snapshots. ' - 'Takes the form: cluster@backend-name#pool. ' - '(supported by --os-volume-api-version 3.17 or later)') + help=_( + 'Cinder cluster on which to list manageable snapshots. ' + 'Takes the form: cluster@backend-name#pool. ' + '(supported by --os-volume-api-version 3.17 or later)' + ), ) parser.add_argument( '--detailed', metavar='<detailed>', default=True, - help=_('Returns detailed information (Default=True).') + help=_('Returns detailed information (Default=True).'), ) parser.add_argument( '--marker', metavar='<marker>', default=None, - help=_('Begin returning snapshots that appear later in the ' - 'snapshot list than that represented by this reference. ' - 'This reference should be json like. Default=None.') + help=_( + 'Begin returning snapshots that appear later in the ' + 'snapshot list than that represented by this reference. ' + 'This reference should be json like. Default=None.' + ), ) parser.add_argument( '--limit', metavar='<limit>', default=None, - help=_('Maximum number of snapshots to return. Default=None.') + help=_('Maximum number of snapshots to return. Default=None.'), ) parser.add_argument( '--offset', metavar='<offset>', default=None, - help=_('Number of snapshots to skip after marker. Default=None.') + help=_('Number of snapshots to skip after marker. Default=None.'), ) parser.add_argument( '--sort', metavar='<key>[:<direction>]', default=None, - help=(_('Comma-separated list of sort keys and directions in the ' + help=( + _( + 'Comma-separated list of sort keys and directions in the ' 'form of <key>[:<asc|desc>]. ' 'Valid keys: %s. ' - 'Default=None.') % ', '.join(SORT_MANAGEABLE_KEY_VALUES)) + 'Default=None.' + ) + % ', '.join(SORT_MANAGEABLE_KEY_VALUES) + ), ) return parser @@ -237,11 +268,13 @@ class BlockStorageManageSnapshots(command.Lister): 'source_reference', ] if detailed: - columns.extend([ - 'reason_not_safe', - 'cinder_id', - 'extra_info', - ]) + columns.extend( + [ + 'reason_not_safe', + 'cinder_id', + 'extra_info', + ] + ) data = volume_client.volume_snapshots.list_manageable( host=parsed_args.host, @@ -250,9 +283,16 @@ class BlockStorageManageSnapshots(command.Lister): limit=parsed_args.limit, offset=parsed_args.offset, sort=parsed_args.sort, - cluster=cluster) + cluster=cluster, + ) - return (columns, - (utils.get_item_properties( - s, columns, - ) for s in data)) + return ( + columns, + ( + utils.get_item_properties( + s, + columns, + ) + for s in data + ), + ) diff --git a/openstackclient/volume/v3/block_storage_resource_filter.py b/openstackclient/volume/v3/block_storage_resource_filter.py index 4bcacf90..4963fd4c 100644 --- a/openstackclient/volume/v3/block_storage_resource_filter.py +++ b/openstackclient/volume/v3/block_storage_resource_filter.py @@ -42,7 +42,7 @@ class ListBlockStorageResourceFilter(command.Lister): return ( column_headers, - (utils.get_item_properties(s, column_headers) for s in data) + (utils.get_item_properties(s, column_headers) for s in data), ) @@ -54,7 +54,7 @@ class ShowBlockStorageResourceFilter(command.ShowOne): parser.add_argument( 'resource', metavar='<resource>', - help=_('Resource to show filters for (name).') + help=_('Resource to show filters for (name).'), ) return parser diff --git a/openstackclient/volume/v3/volume.py b/openstackclient/volume/v3/volume.py index 4b159688..f02053f0 100644 --- a/openstackclient/volume/v3/volume.py +++ b/openstackclient/volume/v3/volume.py @@ -42,7 +42,6 @@ class VolumeSummary(command.ShowOne): return parser def take_action(self, parsed_args): - volume_client = self.app.client_manager.volume if volume_client.api_version < api_versions.APIVersion('3.12'): @@ -89,13 +88,14 @@ class VolumeRevertToSnapshot(command.Command): parser.add_argument( 'snapshot', metavar="<snapshot>", - help=_('Name or ID of the snapshot to restore. The snapshot must ' - 'be the most recent one known to cinder.'), + help=_( + 'Name or ID of the snapshot to restore. The snapshot must ' + 'be the most recent one known to cinder.' + ), ) return parser def take_action(self, parsed_args): - volume_client = self.app.client_manager.volume if volume_client.api_version < api_versions.APIVersion('3.40'): @@ -106,9 +106,10 @@ class VolumeRevertToSnapshot(command.Command): raise exceptions.CommandError(msg) snapshot = utils.find_resource( - volume_client.volume_snapshots, parsed_args.snapshot) - volume = utils.find_resource( - volume_client.volumes, snapshot.volume_id) + volume_client.volume_snapshots, parsed_args.snapshot + ) + volume = utils.find_resource(volume_client.volumes, snapshot.volume_id) volume_client.volumes.revert_to_snapshot( - volume=volume, snapshot=snapshot) + volume=volume, snapshot=snapshot + ) diff --git a/openstackclient/volume/v3/volume_attachment.py b/openstackclient/volume/v3/volume_attachment.py index 57a6da73..652fdf63 100644 --- a/openstackclient/volume/v3/volume_attachment.py +++ b/openstackclient/volume/v3/volume_attachment.py @@ -199,15 +199,17 @@ class CreateVolumeAttachment(command.ShowOne): 'mountpoint': parsed_args.mountpoint, } else: - if any({ - parsed_args.initiator, - parsed_args.ip, - parsed_args.platform, - parsed_args.host, - parsed_args.host, - parsed_args.multipath, - parsed_args.mountpoint, - }): + if any( + { + parsed_args.initiator, + parsed_args.ip, + parsed_args.platform, + parsed_args.host, + parsed_args.host, + parsed_args.multipath, + parsed_args.mountpoint, + } + ): msg = _( 'You must specify the --connect option for any of the ' 'connection-specific options such as --initiator to be ' @@ -225,7 +227,8 @@ class CreateVolumeAttachment(command.ShowOne): ) attachment = volume_client.attachments.create( - volume.id, connector, server.id, parsed_args.mode) + volume.id, connector, server.id, parsed_args.mode + ) return _format_attachment(attachment) @@ -346,7 +349,8 @@ class SetVolumeAttachment(command.ShowOne): } attachment = volume_client.attachments.update( - parsed_args.attachment, connector) + parsed_args.attachment, connector + ) return _format_attachment(attachment) @@ -469,7 +473,8 @@ class ListVolumeAttachment(command.Lister): attachments = volume_client.attachments.list( search_opts=search_opts, marker=parsed_args.marker, - limit=parsed_args.limit) + limit=parsed_args.limit, + ) column_headers = ( 'ID', @@ -486,10 +491,7 @@ class ListVolumeAttachment(command.Lister): return ( column_headers, - ( - utils.get_item_properties(a, columns) - for a in attachments - ), + (utils.get_item_properties(a, columns) for a in attachments), ) diff --git a/openstackclient/volume/v3/volume_group.py b/openstackclient/volume/v3/volume_group.py index 242ffcd4..ba9368e0 100644 --- a/openstackclient/volume/v3/volume_group.py +++ b/openstackclient/volume/v3/volume_group.py @@ -155,7 +155,7 @@ class CreateVolumeGroup(command.ShowOne): parser.add_argument( '--description', metavar='<description>', - help=_('Description of a volume group.') + help=_('Description of a volume group.'), ) parser.add_argument( '--availability-zone', @@ -178,8 +178,10 @@ class CreateVolumeGroup(command.ShowOne): ) self.log.warning(msg) - volume_group_type = parsed_args.volume_group_type or \ - parsed_args.volume_group_type_legacy + volume_group_type = ( + parsed_args.volume_group_type + or parsed_args.volume_group_type_legacy + ) volume_types = parsed_args.volume_types[:] volume_types.extend(parsed_args.volume_types_legacy) @@ -229,8 +231,10 @@ class CreateVolumeGroup(command.ShowOne): "[--source-group|--group-snapshot]' command" ) raise exceptions.CommandError(msg) - if (parsed_args.source_group is None and - parsed_args.group_snapshot is None): + if ( + parsed_args.source_group is None + and parsed_args.group_snapshot is None + ): msg = _( "Either --source-group <source_group> or " "'--group-snapshot <group_snapshot>' needs to be " @@ -239,24 +243,28 @@ class CreateVolumeGroup(command.ShowOne): ) raise exceptions.CommandError(msg) if parsed_args.availability_zone: - msg = _("'--availability-zone' option will not work " - "if creating group from source.") + msg = _( + "'--availability-zone' option will not work " + "if creating group from source." + ) self.log.warning(msg) source_group = None if parsed_args.source_group: - source_group = utils.find_resource(volume_client.groups, - parsed_args.source_group) + source_group = utils.find_resource( + volume_client.groups, parsed_args.source_group + ) group_snapshot = None if parsed_args.group_snapshot: group_snapshot = utils.find_resource( - volume_client.group_snapshots, - parsed_args.group_snapshot) + volume_client.group_snapshots, parsed_args.group_snapshot + ) group = volume_client.groups.create_from_src( group_snapshot.id if group_snapshot else None, source_group.id if source_group else None, parsed_args.name, - parsed_args.description) + parsed_args.description, + ) group = volume_client.groups.get(group.id) return _format_group(group) @@ -281,7 +289,7 @@ class DeleteVolumeGroup(command.Command): help=_( 'Delete the volume group even if it contains volumes. ' 'This will delete any remaining volumes in the group.', - ) + ), ) return parser @@ -300,8 +308,7 @@ class DeleteVolumeGroup(command.Command): parsed_args.group, ) - volume_client.groups.delete( - group.id, delete_volumes=parsed_args.force) + volume_client.groups.delete(group.id, delete_volumes=parsed_args.force) class SetVolumeGroup(command.ShowOne): @@ -436,8 +443,7 @@ class ListVolumeGroup(command.Lister): 'all_tenants': parsed_args.all_projects, } - groups = volume_client.groups.list( - search_opts=search_opts) + groups = volume_client.groups.list(search_opts=search_opts) column_headers = ( 'ID', @@ -452,10 +458,7 @@ class ListVolumeGroup(command.Lister): return ( column_headers, - ( - utils.get_item_properties(a, columns) - for a in groups - ), + (utils.get_item_properties(a, columns) for a in groups), ) @@ -551,8 +554,9 @@ class ShowVolumeGroup(command.ShowOne): group = volume_client.groups.show(group.id, **kwargs) if parsed_args.show_replication_targets: - replication_targets = \ + replication_targets = ( volume_client.groups.list_replication_targets(group.id) + ) group.replication_targets = replication_targets @@ -580,7 +584,7 @@ class FailoverVolumeGroup(command.Command): default=False, help=_( 'Allow group with attached volumes to be failed over.', - ) + ), ) parser.add_argument( '--disallow-attached-volume', @@ -589,7 +593,7 @@ class FailoverVolumeGroup(command.Command): default=False, help=_( 'Disallow group with attached volumes to be failed over.', - ) + ), ) parser.add_argument( '--secondary-backend-id', diff --git a/openstackclient/volume/v3/volume_group_snapshot.py b/openstackclient/volume/v3/volume_group_snapshot.py index 229cbd71..bb7d46f5 100644 --- a/openstackclient/volume/v3/volume_group_snapshot.py +++ b/openstackclient/volume/v3/volume_group_snapshot.py @@ -70,7 +70,7 @@ class CreateVolumeGroupSnapshot(command.ShowOne): parser.add_argument( '--description', metavar='<description>', - help=_('Description of a volume group snapshot.') + help=_('Description of a volume group snapshot.'), ) return parser @@ -90,9 +90,8 @@ class CreateVolumeGroupSnapshot(command.ShowOne): ) snapshot = volume_client.group_snapshots.create( - volume_group.id, - parsed_args.name, - parsed_args.description) + volume_group.id, parsed_args.name, parsed_args.description + ) return _format_group_snapshot(snapshot) @@ -175,8 +174,7 @@ class ListVolumeGroupSnapshot(command.Lister): 'all_tenants': parsed_args.all_projects, } - groups = volume_client.group_snapshots.list( - search_opts=search_opts) + groups = volume_client.group_snapshots.list(search_opts=search_opts) column_headers = ( 'ID', @@ -191,10 +189,7 @@ class ListVolumeGroupSnapshot(command.Lister): return ( column_headers, - ( - utils.get_item_properties(a, columns) - for a in groups - ), + (utils.get_item_properties(a, columns) for a in groups), ) diff --git a/openstackclient/volume/v3/volume_group_type.py b/openstackclient/volume/v3/volume_group_type.py index 860fa544..f1ef6174 100644 --- a/openstackclient/volume/v3/volume_group_type.py +++ b/openstackclient/volume/v3/volume_group_type.py @@ -70,7 +70,7 @@ class CreateVolumeGroupType(command.ShowOne): parser.add_argument( '--description', metavar='<description>', - help=_('Description of the volume group type.') + help=_('Description of the volume group type.'), ) type_group = parser.add_mutually_exclusive_group() type_group.add_argument( @@ -86,7 +86,7 @@ class CreateVolumeGroupType(command.ShowOne): '--private', dest='is_public', action='store_false', - help=_('Volume group type is not available to other projects') + help=_('Volume group type is not available to other projects'), ) return parser @@ -101,9 +101,8 @@ class CreateVolumeGroupType(command.ShowOne): raise exceptions.CommandError(msg) group_type = volume_client.group_types.create( - parsed_args.name, - parsed_args.description, - parsed_args.is_public) + parsed_args.name, parsed_args.description, parsed_args.is_public + ) return _format_group_type(group_type) @@ -176,7 +175,7 @@ class SetVolumeGroupType(command.ShowOne): '--private', dest='is_public', action='store_false', - help=_('Make volume group type unavailable to other projects.') + help=_('Make volume group type unavailable to other projects.'), ) parser.add_argument( '--no-property', @@ -230,7 +229,8 @@ class SetVolumeGroupType(command.ShowOne): if kwargs: try: group_type = volume_client.group_types.update( - group_type.id, **kwargs) + group_type.id, **kwargs + ) except Exception as e: LOG.error(_("Failed to update group type: %s"), e) errors += 1 @@ -251,9 +251,7 @@ class SetVolumeGroupType(command.ShowOne): errors += 1 if errors > 0: - msg = _( - "Command Failed: One or more of the operations failed" - ) + msg = _("Command Failed: One or more of the operations failed") raise exceptions.CommandError() return _format_group_type(group_type) @@ -370,10 +368,7 @@ class ListVolumeGroupType(command.Lister): return ( column_headers, - ( - utils.get_item_properties(a, columns) - for a in group_types - ), + (utils.get_item_properties(a, columns) for a in group_types), ) diff --git a/openstackclient/volume/v3/volume_message.py b/openstackclient/volume/v3/volume_message.py index 4fe5ae92..b76ebe32 100644 --- a/openstackclient/volume/v3/volume_message.py +++ b/openstackclient/volume/v3/volume_message.py @@ -34,7 +34,7 @@ class DeleteMessage(command.Command): 'message_ids', metavar='<message-id>', nargs='+', - help=_('Message(s) to delete (ID)') + help=_('Message(s) to delete (ID)'), ) return parser @@ -60,7 +60,8 @@ class DeleteMessage(command.Command): if errors > 0: total = len(parsed_args.message_ids) msg = _('Failed to delete %(errors)s of %(total)s messages.') % { - 'errors': errors, 'total': total, + 'errors': errors, + 'total': total, } raise exceptions.CommandError(msg) @@ -121,7 +122,8 @@ class ListMessages(command.Lister): project_id = identity_common.find_project( identity_client, parsed_args.project, - parsed_args.project_domain).id + parsed_args.project_domain, + ).id search_opts = { 'project_id': project_id, @@ -129,11 +131,12 @@ class ListMessages(command.Lister): data = volume_client.messages.list( search_opts=search_opts, marker=parsed_args.marker, - limit=parsed_args.limit) + limit=parsed_args.limit, + ) return ( column_headers, - (utils.get_item_properties(s, column_headers) for s in data) + (utils.get_item_properties(s, column_headers) for s in data), ) @@ -145,7 +148,7 @@ class ShowMessage(command.ShowOne): parser.add_argument( 'message_id', metavar='<message-id>', - help=_('Message to show (ID).') + help=_('Message to show (ID).'), ) return parser |
