Prepare for ruff bump

Change-Id: Ia9c402edebc8537d5019d18920b6679b05ea4378
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2025-02-19 20:15:43 +00:00
parent 702a37c7ca
commit 290bc580e6
120 changed files with 333 additions and 490 deletions

View File

@ -114,7 +114,7 @@ class DeleteAgent(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.id) total = len(parsed_args.id)
msg = _("%(result)s of %(total)s agents failed " "to delete.") % { msg = _("%(result)s of %(total)s agents failed to delete.") % {
'result': result, 'result': result,
'total': total, 'total': total,
} }

View File

@ -168,9 +168,10 @@ class DeleteAggregate(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.aggregate) total = len(parsed_args.aggregate)
msg = _( msg = _("%(result)s of %(total)s aggregates failed to delete.") % {
"%(result)s of %(total)s aggregates failed " "to delete." 'result': result,
) % {'result': result, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -190,8 +190,7 @@ class CreateFlavor(command.ShowOne):
compute_client.flavor_add_tenant_access(flavor.id, project_id) compute_client.flavor_add_tenant_access(flavor.id, project_id)
except Exception as e: except Exception as e:
msg = _( msg = _(
"Failed to add project %(project)s access to " "Failed to add project %(project)s access to flavor: %(e)s"
"flavor: %(e)s"
) )
LOG.error(msg, {'project': parsed_args.project, 'e': e}) LOG.error(msg, {'project': parsed_args.project, 'e': e})
if parsed_args.properties: if parsed_args.properties:
@ -242,7 +241,7 @@ class DeleteFlavor(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.flavor) total = len(parsed_args.flavor)
msg = _("%(result)s of %(total)s flavors failed " "to delete.") % { msg = _("%(result)s of %(total)s flavors failed to delete.") % {
'result': result, 'result': result,
'total': total, 'total': total,
} }
@ -404,9 +403,7 @@ class SetFlavor(command.Command):
parser.add_argument( parser.add_argument(
'--project', '--project',
metavar='<project>', metavar='<project>',
help=_( help=_('Set flavor access to project (name or ID) (admin only)'),
'Set flavor access to project (name or ID) ' '(admin only)'
),
) )
identity_common.add_project_domain_option_to_parser(parser) identity_common.add_project_domain_option_to_parser(parser)
parser.add_argument( parser.add_argument(
@ -483,7 +480,7 @@ class SetFlavor(command.Command):
if result > 0: if result > 0:
raise exceptions.CommandError( raise exceptions.CommandError(
_("Command Failed: One or more of" " the operations failed") _("Command Failed: One or more of the operations failed")
) )
@ -560,8 +557,7 @@ class UnsetFlavor(command.Command):
'--project', '--project',
metavar='<project>', metavar='<project>',
help=_( help=_(
'Remove flavor access from project (name or ID) ' 'Remove flavor access from project (name or ID) (admin only)'
'(admin only)'
), ),
) )
identity_common.add_project_domain_option_to_parser(parser) identity_common.add_project_domain_option_to_parser(parser)
@ -612,5 +608,5 @@ class UnsetFlavor(command.Command):
if result > 0: if result > 0:
raise exceptions.CommandError( raise exceptions.CommandError(
_("Command Failed: One or more of" " the operations failed") _("Command Failed: One or more of the operations failed")
) )

View File

@ -258,13 +258,13 @@ class DeleteKeypair(command.Command):
except Exception as e: except Exception as e:
result += 1 result += 1
LOG.error( LOG.error(
_("Failed to delete key with name " "'%(name)s': %(e)s"), _("Failed to delete key with name '%(name)s': %(e)s"),
{'name': n, 'e': e}, {'name': n, 'e': e},
) )
if result > 0: if result > 0:
total = len(parsed_args.name) total = len(parsed_args.name)
msg = _("%(result)s of %(total)s keys failed " "to delete.") % { msg = _("%(result)s of %(total)s keys failed to delete.") % {
'result': result, 'result': result,
'total': total, 'total': total,
} }

View File

@ -1617,8 +1617,7 @@ class CreateServer(command.ShowOne):
image = images[0] image = images[0]
else: else:
msg = _( msg = _(
'No images match the property expected by ' 'No images match the property expected by --image-property'
'--image-property'
) )
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
@ -1902,7 +1901,7 @@ class CreateServer(command.ShowOne):
# Default to empty list if nothing was specified and let nova # Default to empty list if nothing was specified and let nova
# decide the default behavior. # decide the default behavior.
networks: ty.Union[str, ty.List[ty.Dict[str, str]], None] = [] networks: ty.Union[str, list[dict[str, str]], None] = []
if 'auto' in parsed_args.nics or 'none' in parsed_args.nics: if 'auto' in parsed_args.nics or 'none' in parsed_args.nics:
if len(parsed_args.nics) > 1: if len(parsed_args.nics) > 1:
@ -2424,8 +2423,7 @@ class ListServer(command.Lister):
parser.add_argument( parser.add_argument(
'--key-name', '--key-name',
help=_( help=_(
'Search by keypair name ' 'Search by keypair name (admin only before microversion 2.83)'
'(admin only before microversion 2.83)'
), ),
) )
config_drive_group = parser.add_mutually_exclusive_group() config_drive_group = parser.add_mutually_exclusive_group()
@ -4475,8 +4473,7 @@ class SetServer(command.Command):
password_group.add_argument( password_group.add_argument(
'--password', '--password',
help=_( help=_(
'Set the server password. ' 'Set the server password. This option requires cloud support.'
'This option requires cloud support.'
), ),
) )
password_group.add_argument( password_group.add_argument(

View File

@ -70,7 +70,7 @@ class DeleteService(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.service) total = len(parsed_args.service)
msg = _( msg = _(
"%(result)s of %(total)s compute services failed " "to delete." "%(result)s of %(total)s compute services failed to delete."
) % {'result': result, 'total': total} ) % {'result': result, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
@ -153,8 +153,7 @@ class SetService(command.Command):
"service", "service",
metavar="<service>", metavar="<service>",
help=_( help=_(
"Name of service (Binary name), for example " "Name of service (Binary name), for example ``nova-compute``"
"``nova-compute``"
), ),
) )
enabled_group = parser.add_mutually_exclusive_group() enabled_group = parser.add_mutually_exclusive_group()
@ -281,9 +280,7 @@ class SetService(command.Command):
force_down = False force_down = False
if force_down is not None: if force_down is not None:
if not sdk_utils.supports_microversion(compute_client, '2.11'): if not sdk_utils.supports_microversion(compute_client, '2.11'):
msg = _( msg = _('--os-compute-api-version 2.11 or later is required')
'--os-compute-api-version 2.11 or later is ' 'required'
)
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
try: try:
compute_client.update_service_forced_down( compute_client.update_service_forced_down(
@ -299,7 +296,6 @@ class SetService(command.Command):
if result > 0: if result > 0:
msg = _( msg = _(
"Compute service %(service)s of host %(host)s failed to " "Compute service %(service)s of host %(host)s failed to set."
"set."
) % {"service": parsed_args.service, "host": parsed_args.host} ) % {"service": parsed_args.service, "host": parsed_args.host}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -115,8 +115,7 @@ class ListUsage(command.Lister):
metavar="<start>", metavar="<start>",
default=None, default=None,
help=_( help=_(
"Usage range start date, ex 2012-01-20" "Usage range start date, ex 2012-01-20 (default: 4 weeks ago)"
" (default: 4 weeks ago)"
), ),
) )
parser.add_argument( parser.add_argument(
@ -222,8 +221,7 @@ class ShowUsage(command.ShowOne):
metavar="<start>", metavar="<start>",
default=None, default=None,
help=_( help=_(
"Usage range start date, ex 2012-01-20" "Usage range start date, ex 2012-01-20 (default: 4 weeks ago)"
" (default: 4 weeks ago)"
), ),
) )
parser.add_argument( parser.add_argument(

View File

@ -64,8 +64,7 @@ def build_option_parser(parser):
metavar='<identity-api-version>', metavar='<identity-api-version>',
default=utils.env('OS_IDENTITY_API_VERSION'), default=utils.env('OS_IDENTITY_API_VERSION'),
help=_( help=_(
'Identity API version, default=%s ' 'Identity API version, default=%s (Env: OS_IDENTITY_API_VERSION)'
'(Env: OS_IDENTITY_API_VERSION)'
) )
% DEFAULT_API_VERSION, % DEFAULT_API_VERSION,
) )

View File

@ -335,7 +335,7 @@ def add_inherited_option_to_parser(parser):
action='store_true', action='store_true',
default=False, default=False,
help=_( help=_(
'Specifies if the role grant is inheritable to the sub ' 'projects' 'Specifies if the role grant is inheritable to the sub projects'
), ),
) )

View File

@ -128,9 +128,10 @@ class DeleteEC2Creds(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.access_keys) total = len(parsed_args.access_keys)
msg = _( msg = _("%(result)s of %(total)s EC2 keys failed to delete.") % {
"%(result)s of %(total)s EC2 keys failed " "to delete." 'result': result,
) % {'result': result, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -111,9 +111,10 @@ class DeleteEndpoint(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.endpoints) total = len(parsed_args.endpoints)
msg = _( msg = _("%(result)s of %(total)s endpoints failed to delete.") % {
"%(result)s of %(total)s endpoints failed " "to delete." 'result': result,
) % {'result': result, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -140,9 +140,10 @@ class DeleteProject(command.Command):
if errors > 0: if errors > 0:
total = len(parsed_args.projects) total = len(parsed_args.projects)
msg = _( msg = _("%(errors)s of %(total)s projects failed to delete.") % {
"%(errors)s of %(total)s projects failed " "to delete." 'errors': errors,
) % {'errors': errors, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -143,7 +143,7 @@ class DeleteRole(command.Command):
if errors > 0: if errors > 0:
total = len(parsed_args.roles) total = len(parsed_args.roles)
msg = _("%(errors)s of %(total)s roles failed " "to delete.") % { msg = _("%(errors)s of %(total)s roles failed to delete.") % {
'errors': errors, 'errors': errors,
'total': total, 'total': total,
} }

View File

@ -100,9 +100,10 @@ class DeleteService(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.services) total = len(parsed_args.services)
msg = _( msg = _("%(result)s of %(total)s services failed to delete.") % {
"%(result)s of %(total)s services failed " "to delete." 'result': result,
) % {'result': result, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
@ -164,7 +165,7 @@ class ShowService(command.ShowOne):
return zip(*sorted(info.items())) return zip(*sorted(info.items()))
msg = _( msg = _(
"No service catalog with a type, name or ID of '%s' " "exists." "No service catalog with a type, name or ID of '%s' exists."
) % (parsed_args.service) ) % (parsed_args.service)
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
else: else:

View File

@ -194,7 +194,7 @@ class DeleteUser(command.Command):
if errors > 0: if errors > 0:
total = len(parsed_args.users) total = len(parsed_args.users)
msg = _("%(errors)s of %(total)s users failed " "to delete.") % { msg = _("%(errors)s of %(total)s users failed to delete.") % {
'errors': errors, 'errors': errors,
'total': total, 'total': total,
} }

View File

@ -54,17 +54,14 @@ class DeleteAccessRule(command.Command):
except Exception as e: except Exception as e:
errors += 1 errors += 1
LOG.error( LOG.error(
_( _("Failed to delete access rule with ID '%(ac)s': %(e)s"),
"Failed to delete access rule with "
"ID '%(ac)s': %(e)s"
),
{'ac': ac, 'e': e}, {'ac': ac, 'e': e},
) )
if errors > 0: if errors > 0:
total = len(parsed_args.access_rule) total = len(parsed_args.access_rule)
msg = _( msg = _(
"%(errors)s of %(total)s access rules failed " "to delete." "%(errors)s of %(total)s access rules failed to delete."
) % {'errors': errors, 'total': total} ) % {'errors': errors, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -82,9 +82,10 @@ class DeleteConsumer(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.consumer) total = len(parsed_args.consumer)
msg = _( msg = _("%(result)s of %(total)s consumers failed to delete.") % {
"%(result)s of %(total)s consumers failed " "to delete." 'result': result,
) % {'result': result, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -70,8 +70,7 @@ class CreateCredential(command.ShowOne):
'--project', '--project',
metavar='<project>', metavar='<project>',
help=_( help=_(
'Project which limits the scope of ' 'Project which limits the scope of the credential (name or ID)'
'the credential (name or ID)'
), ),
) )
return parser return parser
@ -128,9 +127,10 @@ class DeleteCredential(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.credential) total = len(parsed_args.credential)
msg = _( msg = _("%(result)s of %(total)s credential failed to delete.") % {
"%(result)s of %(total)s credential failed " "to delete." 'result': result,
) % {'result': result, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
@ -219,8 +219,7 @@ class SetCredential(command.Command):
'--project', '--project',
metavar='<project>', metavar='<project>',
help=_( help=_(
'Project which limits the scope of ' 'Project which limits the scope of the credential (name or ID)'
'the credential (name or ID)'
), ),
) )
return parser return parser

View File

@ -124,7 +124,7 @@ class DeleteDomain(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.domain) total = len(parsed_args.domain)
msg = _("%(result)s of %(total)s domains failed " "to delete.") % { msg = _("%(result)s of %(total)s domains failed to delete.") % {
'result': result, 'result': result,
'total': total, 'total': total,
} }

View File

@ -156,9 +156,10 @@ class DeleteEC2Creds(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.access_key) total = len(parsed_args.access_key)
msg = _( msg = _("%(result)s of %(total)s EC2 keys failed to delete.") % {
"%(result)s of %(total)s EC2 keys failed " "to delete." 'result': result,
) % {'result': result, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -44,15 +44,13 @@ class AddProjectToEndpoint(command.Command):
'endpoint', 'endpoint',
metavar='<endpoint>', metavar='<endpoint>',
help=_( help=_(
'Endpoint to associate with ' 'specified project (name or ID)' 'Endpoint to associate with specified project (name or ID)'
), ),
) )
parser.add_argument( parser.add_argument(
'project', 'project',
metavar='<project>', metavar='<project>',
help=_( help=_('Project to associate with specified endpoint name or ID)'),
'Project to associate with ' 'specified endpoint name or ID)'
),
) )
common.add_project_domain_option_to_parser(parser) common.add_project_domain_option_to_parser(parser)
return parser return parser
@ -167,9 +165,10 @@ class DeleteEndpoint(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.endpoint) total = len(parsed_args.endpoint)
msg = _( msg = _("%(result)s of %(total)s endpoints failed to delete.") % {
"%(result)s of %(total)s endpoints failed " "to delete." 'result': result,
) % {'result': result, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
@ -290,14 +289,14 @@ class RemoveProjectFromEndpoint(command.Command):
'endpoint', 'endpoint',
metavar='<endpoint>', metavar='<endpoint>',
help=_( help=_(
'Endpoint to dissociate from ' 'specified project (name or ID)' 'Endpoint to dissociate from specified project (name or ID)'
), ),
) )
parser.add_argument( parser.add_argument(
'project', 'project',
metavar='<project>', metavar='<project>',
help=_( help=_(
'Project to dissociate from ' 'specified endpoint name or ID)' 'Project to dissociate from specified endpoint name or ID)'
), ),
) )
common.add_project_domain_option_to_parser(parser) common.add_project_domain_option_to_parser(parser)

View File

@ -168,7 +168,7 @@ class DeleteEndpointGroup(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.endpointgroup) total = len(parsed_args.endpointgroup)
msg = _( msg = _(
"%(result)s of %(total)s endpointgroups failed " "to delete." "%(result)s of %(total)s endpointgroups failed to delete."
) % {'result': result, 'total': total} ) % {'result': result, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -230,7 +230,7 @@ class DeleteGroup(command.Command):
if errors > 0: if errors > 0:
total = len(parsed_args.groups) total = len(parsed_args.groups)
msg = _("%(errors)s of %(total)s groups failed " "to delete.") % { msg = _("%(errors)s of %(total)s groups failed to delete.") % {
'errors': errors, 'errors': errors,
'total': total, 'total': total,
} }

View File

@ -174,8 +174,7 @@ class DeleteIdentityProvider(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.identity_provider) total = len(parsed_args.identity_provider)
msg = _( msg = _(
"%(result)s of %(total)s identity providers failed" "%(result)s of %(total)s identity providers failed to delete."
" to delete."
) % {'result': result, 'total': total} ) % {'result': result, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -281,13 +281,13 @@ class DeleteLimit(command.Command):
except Exception as e: except Exception as e:
errors += 1 errors += 1
LOG.error( LOG.error(
_("Failed to delete limit with ID " "'%(id)s': %(e)s"), _("Failed to delete limit with ID '%(id)s': %(e)s"),
{'id': limit_id, 'e': e}, {'id': limit_id, 'e': e},
) )
if errors > 0: if errors > 0:
total = len(parsed_args.limit_id) total = len(parsed_args.limit_id)
msg = _("%(errors)s of %(total)s limits failed to " "delete.") % { msg = _("%(errors)s of %(total)s limits failed to delete.") % {
'errors': errors, 'errors': errors,
'total': total, 'total': total,
} }

View File

@ -161,9 +161,10 @@ class DeleteMapping(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.mapping) total = len(parsed_args.mapping)
msg = _( msg = _("%(result)s of %(total)s mappings failed to delete.") % {
"%(result)s of %(total)s mappings failed " "to delete." 'result': result,
) % {'result': result, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -92,9 +92,7 @@ class DeletePolicy(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.policy) total = len(parsed_args.policy)
msg = _( msg = _("%(result)s of %(total)s policies failed to delete.") % {
"%(result)s of %(total)s policies failed " "to delete."
) % {
'result': result, 'result': result,
'total': total, 'total': total,
} }

View File

@ -190,9 +190,10 @@ class DeleteProject(command.Command):
if errors > 0: if errors > 0:
total = len(parsed_args.projects) total = len(parsed_args.projects)
msg = _( msg = _("%(errors)s of %(total)s projects failed to delete.") % {
"%(errors)s of %(total)s projects failed " "to delete." 'errors': errors,
) % {'errors': errors, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -92,16 +92,13 @@ class DeleteRegion(command.Command):
except Exception as e: except Exception as e:
result += 1 result += 1
LOG.error( LOG.error(
_( _("Failed to delete region with ID '%(region)s': %(e)s"),
"Failed to delete region with "
"ID '%(region)s': %(e)s"
),
{'region': i, 'e': e}, {'region': i, 'e': e},
) )
if result > 0: if result > 0:
total = len(parsed_args.region) total = len(parsed_args.region)
msg = _("%(result)s of %(total)s regions failed " "to delete.") % { msg = _("%(result)s of %(total)s regions failed to delete.") % {
'result': result, 'result': result,
'total': total, 'total': total,
} }

View File

@ -137,8 +137,7 @@ class DeleteRegisteredLimit(command.Command):
if errors > 0: if errors > 0:
total = len(parsed_args.registered_limit_id) total = len(parsed_args.registered_limit_id)
msg = _( msg = _(
"%(errors)s of %(total)s registered limits failed to " "%(errors)s of %(total)s registered limits failed to delete."
"delete."
) % {'errors': errors, 'total': total} ) % {'errors': errors, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -402,7 +402,7 @@ class DeleteRole(command.Command):
if errors > 0: if errors > 0:
total = len(parsed_args.roles) total = len(parsed_args.roles)
msg = _("%(errors)s of %(total)s roles failed " "to delete.") % { msg = _("%(errors)s of %(total)s roles failed to delete.") % {
'errors': errors, 'errors': errors,
'total': total, 'total': total,
} }
@ -449,7 +449,7 @@ class ListRole(command.Lister):
class RemoveRole(command.Command): class RemoveRole(command.Command):
_description = _( _description = _(
"Removes a role assignment from system/domain/project : " "user/group" "Removes a role assignment from system/domain/project : user/group"
) )
def get_parser(self, prog_name): def get_parser(self, prog_name):

View File

@ -135,9 +135,10 @@ class DeleteService(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.service) total = len(parsed_args.service)
msg = _( msg = _("%(result)s of %(total)s services failed to delete.") % {
"%(result)s of %(total)s services failed " "to delete." 'result': result,
) % {'result': result, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -77,8 +77,7 @@ class CreateServiceProvider(command.ShowOne):
metavar='<sp-url>', metavar='<sp-url>',
required=True, required=True,
help=_( help=_(
'A service URL where SAML assertions are being sent ' 'A service URL where SAML assertions are being sent (required)'
'(required)'
), ),
) )
@ -155,8 +154,7 @@ class DeleteServiceProvider(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.service_provider) total = len(parsed_args.service_provider)
msg = _( msg = _(
"%(result)s of %(total)s service providers failed" "%(result)s of %(total)s service providers failed to delete."
" to delete."
) % {'result': result, 'total': total} ) % {'result': result, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
@ -204,8 +202,7 @@ class SetServiceProvider(command.ShowOne):
'--auth-url', '--auth-url',
metavar='<auth-url>', metavar='<auth-url>',
help=_( help=_(
'New Authentication URL of remote ' 'New Authentication URL of remote federated service provider'
'federated service provider'
), ),
) )

View File

@ -83,7 +83,7 @@ def add_tag_option_to_parser_for_create(parser, resource_name):
metavar='<tag>', metavar='<tag>',
default=[], default=[],
help=_( help=_(
'Tag to be added to the %s ' '(repeat option to set multiple tags)' 'Tag to be added to the %s (repeat option to set multiple tags)'
) )
% resource_name, % resource_name,
) )
@ -97,7 +97,7 @@ def add_tag_option_to_parser_for_set(parser, resource_name):
metavar='<tag>', metavar='<tag>',
default=[], default=[],
help=_( help=_(
'Tag to be added to the %s ' '(repeat option to set multiple tags)' 'Tag to be added to the %s (repeat option to set multiple tags)'
) )
% resource_name, % resource_name,
) )

View File

@ -136,8 +136,7 @@ class CreateRequestToken(command.ShowOne):
'--project', '--project',
metavar='<project>', metavar='<project>',
help=_( help=_(
'Project that consumer wants to access (name or ID)' 'Project that consumer wants to access (name or ID) (required)'
' (required)'
), ),
required=True, required=True,
) )

View File

@ -233,7 +233,7 @@ class DeleteTrust(command.Command):
if errors > 0: if errors > 0:
total = len(parsed_args.trust) total = len(parsed_args.trust)
msg = _("%(errors)s of %(total)s trusts failed " "to delete.") % { msg = _("%(errors)s of %(total)s trusts failed to delete.") % {
'errors': errors, 'errors': errors,
'total': total, 'total': total,
} }

View File

@ -377,7 +377,7 @@ class DeleteUser(command.Command):
if errors > 0: if errors > 0:
total = len(parsed_args.users) total = len(parsed_args.users)
msg = _("%(errors)s of %(total)s users failed " "to delete.") % { msg = _("%(errors)s of %(total)s users failed to delete.") % {
'errors': errors, 'errors': errors,
'total': total, 'total': total,
} }

View File

@ -384,8 +384,7 @@ class DeleteImage(command.Command):
except Exception as e: except Exception as e:
result += 1 result += 1
msg = _( msg = _(
"Failed to delete image with name or " "Failed to delete image with name or ID '%(image)s': %(e)s"
"ID '%(image)s': %(e)s"
) )
LOG.error(msg, {'image': image, 'e': e}) LOG.error(msg, {'image': image, 'e': e})

View File

@ -131,8 +131,7 @@ class QueueCachedImage(command.Command):
except Exception as e: except Exception as e:
failures += 1 failures += 1
msg = _( msg = _(
"Failed to queue image with name or " "Failed to queue image with name or ID '%(image)s': %(e)s"
"ID '%(image)s': %(e)s"
) )
LOG.error(msg, {'image': image, 'e': e}) LOG.error(msg, {'image': image, 'e': e})
@ -171,8 +170,7 @@ class DeleteCachedImage(command.Command):
except Exception as e: except Exception as e:
failures += 1 failures += 1
msg = _( msg = _(
"Failed to delete image with name or " "Failed to delete image with name or ID '%(image)s': %(e)s"
"ID '%(image)s': %(e)s"
) )
LOG.error(msg, {'image': image, 'e': e}) LOG.error(msg, {'image': image, 'e': e})

View File

@ -359,8 +359,7 @@ class CreateImage(command.ShowOne):
action="store_true", action="store_true",
default=False, default=False,
help=_( help=_(
"Show upload progress bar " "Show upload progress bar (ignored if passing data via stdin)"
"(ignored if passing data via stdin)"
), ),
) )
parser.add_argument( parser.add_argument(
@ -401,8 +400,7 @@ class CreateImage(command.ShowOne):
metavar="<tag>", metavar="<tag>",
action='append', action='append',
help=_( help=_(
"Set a tag on this image " "Set a tag on this image (repeat option to set multiple tags)"
"(repeat option to set multiple tags)"
), ),
) )
parser.add_argument( parser.add_argument(
@ -705,8 +703,7 @@ class DeleteImage(command.Command):
except Exception as e: except Exception as e:
result += 1 result += 1
msg = _( msg = _(
"Failed to delete image with name or " "Failed to delete image with name or ID '%(image)s': %(e)s"
"ID '%(image)s': %(e)s"
) )
LOG.error(msg, {'image': image, 'e': e}) LOG.error(msg, {'image': image, 'e': e})
@ -1153,8 +1150,7 @@ class SetImage(command.Command):
default=None, default=None,
action='append', action='append',
help=_( help=_(
"Set a tag on this image " "Set a tag on this image (repeat option to set multiple tags)"
"(repeat option to set multiple tags)"
), ),
) )
parser.add_argument( parser.add_argument(
@ -1466,7 +1462,7 @@ class UnsetImage(command.Command):
image_client.remove_tag(image.id, k) image_client.remove_tag(image.id, k)
except Exception: except Exception:
LOG.error( LOG.error(
_("tag unset failed, '%s' is a " "nonexistent tag "), k _("tag unset failed, '%s' is a nonexistent tag "), k
) )
tagret += 1 tagret += 1
@ -1519,7 +1515,7 @@ class UnsetImage(command.Command):
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
elif propret > 0: elif propret > 0:
msg = _( msg = _(
"Failed to unset %(propret)s of %(proptotal)s" " properties." "Failed to unset %(propret)s of %(proptotal)s properties."
) % {'propret': propret, 'proptotal': proptotal} ) % {'propret': propret, 'proptotal': proptotal}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
@ -1551,8 +1547,7 @@ class StageImage(command.Command):
action='store_true', action='store_true',
default=False, default=False,
help=_( help=_(
'Show upload progress bar ' 'Show upload progress bar (ignored if passing data via stdin)'
'(ignored if passing data via stdin)'
), ),
) )
parser.add_argument( parser.add_argument(

View File

@ -169,9 +169,10 @@ class DeleteMetadefNamespace(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.namespace) total = len(parsed_args.namespace)
msg = _( msg = _("%(result)s of %(total)s namespace failed to delete.") % {
"%(result)s of %(total)s namespace failed " "to delete." 'result': result,
) % {'result': result, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -50,9 +50,7 @@ def build_option_parser(parser):
'--os-network-api-version', '--os-network-api-version',
metavar='<network-api-version>', metavar='<network-api-version>',
default=utils.env('OS_NETWORK_API_VERSION'), default=utils.env('OS_NETWORK_API_VERSION'),
help=_( help=_("Network API version, default=%s (Env: OS_NETWORK_API_VERSION)")
"Network API version, default=%s " "(Env: OS_NETWORK_API_VERSION)"
)
% DEFAULT_API_VERSION, % DEFAULT_API_VERSION,
) )
return parser return parser

View File

@ -303,8 +303,7 @@ class NeutronCommandWithExtraArgs(command.Command):
if not converter: if not converter:
raise exceptions.CommandError( raise exceptions.CommandError(
_( _(
"Type {property_type} of property {name} " "Type {property_type} of property {name} is not supported"
"is not supported"
).format( ).format(
property_type=_property['type'], name=_property['name'] property_type=_property['type'], name=_property['name']
) )

View File

@ -76,8 +76,7 @@ class CreateAddressGroup(command.ShowOne, common.NeutronCommandWithExtraArgs):
action='append', action='append',
default=[], default=[],
help=_( help=_(
"IP address or CIDR " "IP address or CIDR (repeat option to set multiple addresses)"
"(repeat option to set multiple addresses)"
), ),
) )
parser.add_argument( parser.add_argument(
@ -139,7 +138,7 @@ class DeleteAddressGroup(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.address_group) total = len(parsed_args.address_group)
msg = _( msg = _(
"%(result)s of %(total)s address groups failed " "to delete." "%(result)s of %(total)s address groups failed to delete."
) % {'result': result, 'total': total} ) % {'result': result, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
@ -159,8 +158,7 @@ class ListAddressGroup(command.Lister):
'--project', '--project',
metavar="<project>", metavar="<project>",
help=_( help=_(
"List address groups according to their project " "List address groups according to their project (name or ID)"
"(name or ID)"
), ),
) )
identity_common.add_project_domain_option_to_parser(parser) identity_common.add_project_domain_option_to_parser(parser)
@ -233,8 +231,7 @@ class SetAddressGroup(common.NeutronCommandWithExtraArgs):
action='append', action='append',
default=[], default=[],
help=_( help=_(
"IP address or CIDR " "IP address or CIDR (repeat option to set multiple addresses)"
"(repeat option to set multiple addresses)"
), ),
) )
return parser return parser

View File

@ -144,7 +144,7 @@ class DeleteAddressScope(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.address_scope) total = len(parsed_args.address_scope)
msg = _( msg = _(
"%(result)s of %(total)s address scopes failed " "to delete." "%(result)s of %(total)s address scopes failed to delete."
) % {'result': result, 'total': total} ) % {'result': result, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
@ -176,8 +176,7 @@ class ListAddressScope(command.Lister):
'--project', '--project',
metavar="<project>", metavar="<project>",
help=_( help=_(
"List address scopes according to their project " "List address scopes according to their project (name or ID)"
"(name or ID)"
), ),
) )
identity_common.add_project_domain_option_to_parser(parser) identity_common.add_project_domain_option_to_parser(parser)

View File

@ -123,7 +123,7 @@ class CreateFloatingIP(
'--port', '--port',
metavar='<port>', metavar='<port>',
help=self.enhance_help_neutron( help=self.enhance_help_neutron(
_("Port to be associated with the floating IP " "(name or ID)") _("Port to be associated with the floating IP (name or ID)")
), ),
) )
parser.add_argument( parser.add_argument(
@ -268,10 +268,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
'--floating-ip-address', '--floating-ip-address',
metavar='<ip-address>', metavar='<ip-address>',
help=self.enhance_help_neutron( help=self.enhance_help_neutron(
_( _("List floating IP(s) according to given floating IP address")
"List floating IP(s) according to given floating IP "
"address"
)
), ),
) )
parser.add_argument( parser.add_argument(
@ -308,10 +305,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
'--router', '--router',
metavar='<router>', metavar='<router>',
help=self.enhance_help_neutron( help=self.enhance_help_neutron(
_( _("List floating IP(s) according to given router (name or ID)")
"List floating IP(s) according to given router (name or "
"ID)"
)
), ),
) )
_tag.add_tag_filtering_option_to_parser( _tag.add_tag_filtering_option_to_parser(
@ -458,8 +452,7 @@ class SetFloatingIP(common.NeutronCommandWithExtraArgs):
metavar='<ip-address>', metavar='<ip-address>',
dest='fixed_ip_address', dest='fixed_ip_address',
help=_( help=_(
"Fixed IP of the port " "Fixed IP of the port (required only if port has multiple IPs)"
"(required only if port has multiple IPs)"
), ),
) )
parser.add_argument( parser.add_argument(

View File

@ -243,7 +243,7 @@ class DeleteFloatingIPPortForwarding(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.port_forwarding_id) total = len(parsed_args.port_forwarding_id)
msg = _( msg = _(
"%(result)s of %(total)s Port forwarding failed " "to delete." "%(result)s of %(total)s Port forwarding failed to delete."
) % {'result': result, 'total': total} ) % {'result': result, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -66,8 +66,7 @@ class CreateConntrackHelper(command.ShowOne):
required=True, required=True,
metavar='<protocol>', metavar='<protocol>',
help=_( help=_(
'The network protocol for the netfilter conntrack target ' 'The network protocol for the netfilter conntrack target rule'
'rule'
), ),
) )
parser.add_argument( parser.add_argument(
@ -158,8 +157,7 @@ class ListConntrackHelper(command.Lister):
'--protocol', '--protocol',
metavar='<protocol>', metavar='<protocol>',
help=_( help=_(
'The network protocol for the netfilter conntrack target ' 'The network protocol for the netfilter conntrack target rule'
'rule'
), ),
) )
parser.add_argument( parser.add_argument(
@ -226,8 +224,7 @@ class SetConntrackHelper(command.Command):
'--protocol', '--protocol',
metavar='<protocol>', metavar='<protocol>',
help=_( help=_(
'The network protocol for the netfilter conntrack target ' 'The network protocol for the netfilter conntrack target rule'
'rule'
), ),
) )
parser.add_argument( parser.add_argument(

View File

@ -149,9 +149,10 @@ class DeleteLocalIP(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.local_ip) total = len(parsed_args.local_ip)
msg = _( msg = _("%(result)s of %(total)s local IPs failed to delete.") % {
"%(result)s of %(total)s local IPs failed " "to delete." 'result': result,
) % {'result': result, 'total': total} 'total': total,
}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
@ -201,31 +202,27 @@ class ListLocalIP(command.Lister):
parser.add_argument( parser.add_argument(
'--project', '--project',
metavar="<project>", metavar="<project>",
help=_( help=_("List Local IPs according to their project (name or ID)"),
"List Local IPs according to their project " "(name or ID)"
),
) )
parser.add_argument( parser.add_argument(
'--network', '--network',
metavar='<network>', metavar='<network>',
help=_( help=_("List Local IP(s) according to given network (name or ID)"),
"List Local IP(s) according to " "given network (name or ID)"
),
) )
parser.add_argument( parser.add_argument(
'--local-port', '--local-port',
metavar='<local-port>', metavar='<local-port>',
help=_("List Local IP(s) according to " "given port (name or ID)"), help=_("List Local IP(s) according to given port (name or ID)"),
) )
parser.add_argument( parser.add_argument(
'--local-ip-address', '--local-ip-address',
metavar='<local-ip-address>', metavar='<local-ip-address>',
help=_("List Local IP(s) according to " "given Local IP Address"), help=_("List Local IP(s) according to given Local IP Address"),
) )
parser.add_argument( parser.add_argument(
'--ip-mode', '--ip-mode',
metavar='<ip_mode>', metavar='<ip_mode>',
help=_("List Local IP(s) according to " "given IP mode"), help=_("List Local IP(s) according to given IP mode"),
) )
identity_common.add_project_domain_option_to_parser(parser) identity_common.add_project_domain_option_to_parser(parser)

View File

@ -44,7 +44,7 @@ class CreateLocalIPAssociation(command.ShowOne):
'local_ip', 'local_ip',
metavar='<local-ip>', metavar='<local-ip>',
help=_( help=_(
"Local IP that the port association belongs to " "(Name or ID)" "Local IP that the port association belongs to (Name or ID)"
), ),
) )
parser.add_argument( parser.add_argument(
@ -90,7 +90,7 @@ class DeleteLocalIPAssociation(command.Command):
'local_ip', 'local_ip',
metavar="<local-ip>", metavar="<local-ip>",
help=_( help=_(
"Local IP that the port association belongs to " "(Name or ID)" "Local IP that the port association belongs to (Name or ID)"
), ),
) )
parser.add_argument( parser.add_argument(
@ -151,7 +151,7 @@ class ListLocalIPAssociation(command.Lister):
'--fixed-port', '--fixed-port',
metavar='<fixed-port>', metavar='<fixed-port>',
help=_( help=_(
"Filter the list result by the ID or name of " "the fixed port" "Filter the list result by the ID or name of the fixed port"
), ),
) )
parser.add_argument( parser.add_argument(

View File

@ -124,13 +124,13 @@ class DeleteNDPProxy(command.Command):
except Exception as e: except Exception as e:
result += 1 result += 1
LOG.error( LOG.error(
_("Failed to delete NDP proxy " "'%(ndp_proxy)s': %(e)s"), _("Failed to delete NDP proxy '%(ndp_proxy)s': %(e)s"),
{'ndp_proxy': ndp_proxy, 'e': e}, {'ndp_proxy': ndp_proxy, 'e': e},
) )
if result > 0: if result > 0:
total = len(parsed_args.ndp_proxy) total = len(parsed_args.ndp_proxy)
msg = _( msg = _(
"%(result)s of %(total)s NDP proxies failed " "to delete." "%(result)s of %(total)s NDP proxies failed to delete."
) % {'result': result, 'total': total} ) % {'result': result, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -355,17 +355,14 @@ class CreateNetwork(
'--qinq-vlan', '--qinq-vlan',
action='store_true', action='store_true',
help=self.enhance_help_neutron( help=self.enhance_help_neutron(
_("Enable VLAN QinQ (S-Tag ethtype 0x8a88) " "for the network") _("Enable VLAN QinQ (S-Tag ethtype 0x8a88) for the network")
), ),
) )
vlan_qinq_grp.add_argument( vlan_qinq_grp.add_argument(
'--no-qinq-vlan', '--no-qinq-vlan',
action='store_true', action='store_true',
help=self.enhance_help_neutron( help=self.enhance_help_neutron(
_( _("Disable VLAN QinQ (S-Tag ethtype 0x8a88) for the network")
"Disable VLAN QinQ (S-Tag ethtype 0x8a88) "
"for the network"
)
), ),
) )

View File

@ -155,7 +155,7 @@ class DeleteNetworkAgent(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.network_agent) total = len(parsed_args.network_agent)
msg = _( msg = _(
"%(result)s of %(total)s network agents failed " "to delete." "%(result)s of %(total)s network agents failed to delete."
) % {'result': result, 'total': total} ) % {'result': result, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -146,7 +146,7 @@ class DeleteNetworkFlavorProfile(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.flavor_profile) total = len(parsed_args.flavor_profile)
msg = _( msg = _(
"%(result)s of %(total)s flavor_profiles failed " "to delete." "%(result)s of %(total)s flavor_profiles failed to delete."
) % {"result": result, "total": total} ) % {"result": result, "total": total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -139,12 +139,12 @@ class DeleteMeter(command.Command):
except Exception as e: except Exception as e:
result += 1 result += 1
LOG.error( LOG.error(
_("Failed to delete meter with " "ID '%(meter)s': %(e)s"), _("Failed to delete meter with ID '%(meter)s': %(e)s"),
{"meter": meter, "e": e}, {"meter": meter, "e": e},
) )
if result > 0: if result > 0:
total = len(parsed_args.meter) total = len(parsed_args.meter)
msg = _("%(result)s of %(total)s meters failed " "to delete.") % { msg = _("%(result)s of %(total)s meters failed to delete.") % {
"result": result, "result": result,
"total": total, "total": total,
} }

View File

@ -168,17 +168,14 @@ class DeleteMeterRule(command.Command):
except Exception as e: except Exception as e:
result += 1 result += 1
LOG.error( LOG.error(
_( _("Failed to delete meter rule with ID '%(id)s': %(e)s"),
"Failed to delete meter rule with "
"ID '%(id)s': %(e)s"
),
{"id": id, "e": e}, {"id": id, "e": e},
) )
if result > 0: if result > 0:
total = len(parsed_args.meter_rule_id) total = len(parsed_args.meter_rule_id)
msg = _( msg = _(
"%(result)s of %(total)s meter rules failed " "to delete." "%(result)s of %(total)s meter rules failed to delete."
) % {"result": result, "total": total} ) % {"result": result, "total": total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -174,7 +174,7 @@ class DeleteNetworkQosPolicy(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.policy) total = len(parsed_args.policy)
msg = _( msg = _(
"%(result)s of %(total)s QoS policies failed " "to delete." "%(result)s of %(total)s QoS policies failed to delete."
) % {'result': result, 'total': total} ) % {'result': result, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -212,7 +212,7 @@ class DeleteNetworkRBAC(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.rbac_policy) total = len(parsed_args.rbac_policy)
msg = _( msg = _(
"%(result)s of %(total)s RBAC policies failed " "to delete." "%(result)s of %(total)s RBAC policies failed to delete."
) % {'result': result, 'total': total} ) % {'result': result, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -141,7 +141,7 @@ class DeleteNetworkSegment(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.network_segment) total = len(parsed_args.network_segment)
msg = _( msg = _(
"%(result)s of %(total)s network segments failed " "to delete." "%(result)s of %(total)s network segments failed to delete."
) % {'result': result, 'total': total} ) % {'result': result, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -105,8 +105,7 @@ class CreateNetworkSegmentRange(
dest="private", dest="private",
action="store_true", action="store_true",
help=_( help=_(
'Network segment range is assigned specifically to the ' 'Network segment range is assigned specifically to the project'
'project'
), ),
) )
shared_group.add_argument( shared_group.add_argument(
@ -196,8 +195,7 @@ class CreateNetworkSegmentRange(
and parsed_args.physical_network and parsed_args.physical_network
): ):
msg = _( msg = _(
"--physical-network is only allowed with --network-type " "--physical-network is only allowed with --network-type vlan"
"vlan"
) )
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
@ -323,7 +321,7 @@ class ListNetworkSegmentRange(command.Lister):
'--unused', '--unused',
action='store_true', action='store_true',
help=_( help=_(
'List network segment ranges that have segments ' 'not in use' 'List network segment ranges that have segments not in use'
), ),
) )
available_group = parser.add_mutually_exclusive_group() available_group = parser.add_mutually_exclusive_group()
@ -457,8 +455,7 @@ class SetNetworkSegmentRange(common.NeutronCommandWithExtraArgs):
) )
except Exception as e: except Exception as e:
msg = _( msg = _(
'Network segment range set not supported by ' 'Network segment range set not supported by Network API: %(e)s'
'Network API: %(e)s'
) % {'e': e} ) % {'e': e}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -128,7 +128,7 @@ class DeleteNetworkTrunk(command.Command):
) )
if result > 0: if result > 0:
total = len(parsed_args.trunk) total = len(parsed_args.trunk)
msg = _("%(result)s of %(total)s trunks failed " "to delete.") % { msg = _("%(result)s of %(total)s trunks failed to delete.") % {
'result': result, 'result': result,
'total': total, 'total': total,
} }

View File

@ -368,8 +368,7 @@ def _add_updatable_args(parser, create=False):
'--dns-name', '--dns-name',
metavar='<dns-name>', metavar='<dns-name>',
help=_( help=_(
"Set DNS name for this port " "Set DNS name for this port (requires DNS integration extension)"
"(requires DNS integration extension)"
), ),
) )
numa_affinity_policy_group = parser.add_mutually_exclusive_group() numa_affinity_policy_group = parser.add_mutually_exclusive_group()
@ -753,7 +752,7 @@ class DeletePort(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.port) total = len(parsed_args.port)
msg = _("%(result)s of %(total)s ports failed " "to delete.") % { msg = _("%(result)s of %(total)s ports failed to delete.") % {
'result': result, 'result': result,
'total': total, 'total': total,
} }

View File

@ -671,7 +671,7 @@ class DeleteRouter(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.router) total = len(parsed_args.router)
msg = _("%(result)s of %(total)s routers failed " "to delete.") % { msg = _("%(result)s of %(total)s routers failed to delete.") % {
'result': result, 'result': result,
'total': total, 'total': total,
} }
@ -951,7 +951,7 @@ class SetRouter(common.NeutronCommandWithExtraArgs):
'--ha', '--ha',
action='store_true', action='store_true',
help=_( help=_(
"Set the router as highly available " "(disabled router only)" "Set the router as highly available (disabled router only)"
), ),
) )
routes_ha.add_argument( routes_ha.add_argument(

View File

@ -239,10 +239,7 @@ class ListSecurityGroup(common.NetworkAndComputeLister):
'--project', '--project',
metavar='<project>', metavar='<project>',
help=self.enhance_help_neutron( help=self.enhance_help_neutron(
_( _("List security groups according to the project (name or ID)")
"List security groups according to the project (name or "
"ID)"
)
), ),
) )
identity_common.add_project_domain_option_to_parser( identity_common.add_project_domain_option_to_parser(

View File

@ -608,7 +608,7 @@ class ShowSecurityGroupRule(common.NetworkAndComputeShowOne):
if obj is None: if obj is None:
msg = ( msg = (
_("Could not find security group rule " "with ID '%s'") _("Could not find security group rule with ID '%s'")
% parsed_args.rule % parsed_args.rule
) )
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)

View File

@ -400,7 +400,7 @@ class CreateSubnet(command.ShowOne, common.NeutronCommandWithExtraArgs):
'--network-segment', '--network-segment',
metavar='<network-segment>', metavar='<network-segment>',
help=_( help=_(
"Network segment to associate with this subnet " "(name or ID)" "Network segment to associate with this subnet (name or ID)"
), ),
) )
parser.add_argument( parser.add_argument(
@ -465,7 +465,7 @@ class DeleteSubnet(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.subnet) total = len(parsed_args.subnet)
msg = _("%(result)s of %(total)s subnets failed " "to delete.") % { msg = _("%(result)s of %(total)s subnets failed to delete.") % {
'result': result, 'result': result,
'total': total, 'total': total,
} }

View File

@ -256,7 +256,7 @@ class DeleteSubnetPool(command.Command):
if result > 0: if result > 0:
total = len(parsed_args.subnet_pool) total = len(parsed_args.subnet_pool)
msg = _( msg = _(
"%(result)s of %(total)s subnet pools failed " "to delete." "%(result)s of %(total)s subnet pools failed to delete."
) % {'result': result, 'total': total} ) % {'result': result, 'total': total}
raise exceptions.CommandError(msg) raise exceptions.CommandError(msg)
@ -290,7 +290,7 @@ class ListSubnetPool(command.Lister):
'--default', '--default',
action='store_true', action='store_true',
help=_( help=_(
"List subnet pools used as the default external " "subnet pool" "List subnet pools used as the default external subnet pool"
), ),
) )
default_group.add_argument( default_group.add_argument(

View File

@ -156,7 +156,7 @@ class ServerTests(common.ComputeTestCase):
server_name3 = cmd_output['name'] server_name3 = cmd_output['name']
cmd_output = self.openstack( cmd_output = self.openstack(
'server list ' '--changes-since ' + updated_at2, 'server list --changes-since ' + updated_at2,
parse_output=True, parse_output=True,
) )
@ -852,8 +852,7 @@ class ServerTests(common.ComputeTestCase):
# it to the server at /dev/vdb and delete the volume when the # it to the server at /dev/vdb and delete the volume when the
# server is deleted. # server is deleted.
bdm_arg = ( bdm_arg = (
f'--block-device-mapping ' f'--block-device-mapping vdb={self.image_name}:image:1:true '
f'vdb={self.image_name}:image:1:true '
) )
else: else:
# get image ID # get image ID

View File

@ -93,7 +93,7 @@ class ServerEventTests(common.ComputeTestCase):
# And verify we can get the event list after it's deleted # And verify we can get the event list after it's deleted
# Test 'server event list' for deleting # Test 'server event list' for deleting
cmd_output = self.openstack( cmd_output = self.openstack(
'--os-compute-api-version 2.21 ' 'server event list ' + server_id, '--os-compute-api-version 2.21 server event list ' + server_id,
parse_output=True, parse_output=True,
) )
request_id = None request_id = None

View File

@ -37,7 +37,7 @@ class UserTests(common.IdentityTests):
new_username = data_utils.rand_name('NewTestUser') new_username = data_utils.rand_name('NewTestUser')
new_email = data_utils.rand_name() + '@example.com' new_email = data_utils.rand_name() + '@example.com'
raw_output = self.openstack( raw_output = self.openstack(
'user set ' '--email {email} ' '--name {new_name} ' '{id}'.format( 'user set --email {email} --name {new_name} {id}'.format(
email=new_email, new_name=new_username, id=user['id'] email=new_email, new_name=new_username, id=user['id']
) )
) )

View File

@ -187,8 +187,7 @@ class IdentityTests(base.TestCase):
f'domain set --disable {cls.domain_name}' f'domain set --disable {cls.domain_name}'
) )
cls.openstack( cls.openstack(
'--os-identity-api-version 3 ' f'--os-identity-api-version 3 domain delete {cls.domain_name}'
f'domain delete {cls.domain_name}'
) )
finally: finally:
super().tearDownClass() super().tearDownClass()
@ -270,9 +269,7 @@ class IdentityTests(base.TestCase):
if add_clean_up: if add_clean_up:
self.addCleanup( self.addCleanup(
self.openstack, self.openstack,
'group delete ' f'group delete --domain {self.domain_name} {group_name}',
f'--domain {self.domain_name} '
f'{group_name}',
) )
items = self.parse_show(raw_output) items = self.parse_show(raw_output)
self.assert_show_fields(items, self.GROUP_FIELDS) self.assert_show_fields(items, self.GROUP_FIELDS)
@ -305,9 +302,7 @@ class IdentityTests(base.TestCase):
if add_clean_up: if add_clean_up:
self.addCleanup( self.addCleanup(
self.openstack, self.openstack,
'project delete ' f'project delete --domain {self.domain_name} {project_name}',
f'--domain {self.domain_name} '
f'{project_name}',
) )
return project_name return project_name

View File

@ -50,35 +50,35 @@ class ApplicationCredentialTests(common.IdentityTests):
def _create_role_assignments(self): def _create_role_assignments(self):
try: try:
user = self.openstack( user = self.openstack(
'configuration show -f value' ' -c auth.username' 'configuration show -f value -c auth.username'
) )
except Exception: except Exception:
user = self.openstack( user = self.openstack(
'configuration show -f value' ' -c auth.user_id' 'configuration show -f value -c auth.user_id'
) )
try: try:
user_domain = self.openstack( user_domain = self.openstack(
'configuration show -f value' ' -c auth.user_domain_name' 'configuration show -f value -c auth.user_domain_name'
) )
except Exception: except Exception:
user_domain = self.openstack( user_domain = self.openstack(
'configuration show -f value' ' -c auth.user_domain_id' 'configuration show -f value -c auth.user_domain_id'
) )
try: try:
project = self.openstack( project = self.openstack(
'configuration show -f value' ' -c auth.project_name' 'configuration show -f value -c auth.project_name'
) )
except Exception: except Exception:
project = self.openstack( project = self.openstack(
'configuration show -f value' ' -c auth.project_id' 'configuration show -f value -c auth.project_id'
) )
try: try:
project_domain = self.openstack( project_domain = self.openstack(
'configuration show -f value' ' -c auth.project_domain_name' 'configuration show -f value -c auth.project_domain_name'
) )
except Exception: except Exception:
project_domain = self.openstack( project_domain = self.openstack(
'configuration show -f value' ' -c auth.project_domain_id' 'configuration show -f value -c auth.project_domain_id'
) )
role1 = self._create_dummy_role() role1 = self._create_dummy_role()
role2 = self._create_dummy_role() role2 = self._create_dummy_role()
@ -130,7 +130,7 @@ class ApplicationCredentialTests(common.IdentityTests):
def test_application_credential_delete(self): def test_application_credential_delete(self):
name = data_utils.rand_name('name') name = data_utils.rand_name('name')
self.openstack(f'application credential create {name}') self.openstack(f'application credential create {name}')
raw_output = self.openstack('application credential delete ' f'{name}') raw_output = self.openstack(f'application credential delete {name}')
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
def test_application_credential_list(self): def test_application_credential_list(self):
@ -147,6 +147,6 @@ class ApplicationCredentialTests(common.IdentityTests):
self.openstack, self.openstack,
f'application credential delete {name}', f'application credential delete {name}',
) )
raw_output = self.openstack('application credential show ' f'{name}') raw_output = self.openstack(f'application credential show {name}')
items = self.parse_show(raw_output) items = self.parse_show(raw_output)
self.assert_show_fields(items, self.APPLICATION_CREDENTIAL_FIELDS) self.assert_show_fields(items, self.APPLICATION_CREDENTIAL_FIELDS)

View File

@ -45,7 +45,7 @@ class EndpointTests(common.IdentityTests):
endpoint_id = self._create_dummy_endpoint(add_clean_up=False) endpoint_id = self._create_dummy_endpoint(add_clean_up=False)
project_id = self._create_dummy_project(add_clean_up=False) project_id = self._create_dummy_project(add_clean_up=False)
raw_output = self.openstack( raw_output = self.openstack(
'endpoint add project ' f'{endpoint_id} ' f'{project_id}' f'endpoint add project {endpoint_id} {project_id}'
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
raw_output = self.openstack(f'endpoint list --endpoint {endpoint_id}') raw_output = self.openstack(f'endpoint list --endpoint {endpoint_id}')
@ -89,11 +89,11 @@ class EndpointTests(common.IdentityTests):
endpoint_id = self._create_dummy_endpoint(add_clean_up=False) endpoint_id = self._create_dummy_endpoint(add_clean_up=False)
project_id = self._create_dummy_project(add_clean_up=False) project_id = self._create_dummy_project(add_clean_up=False)
raw_output = self.openstack( raw_output = self.openstack(
'endpoint add project ' f'{endpoint_id} ' f'{project_id}' f'endpoint add project {endpoint_id} {project_id}'
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
raw_output = self.openstack( raw_output = self.openstack(
'endpoint remove project ' f'{endpoint_id} ' f'{project_id}' f'endpoint remove project {endpoint_id} {project_id}'
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))

View File

@ -36,14 +36,14 @@ class GroupTests(common.IdentityTests):
def test_group_delete(self): def test_group_delete(self):
group_name = self._create_dummy_group(add_clean_up=False) group_name = self._create_dummy_group(add_clean_up=False)
raw_output = self.openstack( raw_output = self.openstack(
'group delete ' f'--domain {self.domain_name} ' f'{group_name}' f'group delete --domain {self.domain_name} {group_name}'
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
def test_group_show(self): def test_group_show(self):
group_name = self._create_dummy_group() group_name = self._create_dummy_group()
raw_output = self.openstack( raw_output = self.openstack(
'group show ' f'--domain {self.domain_name} ' f'{group_name}' f'group show --domain {self.domain_name} {group_name}'
) )
items = self.parse_show(raw_output) items = self.parse_show(raw_output)
self.assert_show_fields(items, self.GROUP_FIELDS) self.assert_show_fields(items, self.GROUP_FIELDS)
@ -59,7 +59,7 @@ class GroupTests(common.IdentityTests):
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
raw_output = self.openstack( raw_output = self.openstack(
'group show ' f'--domain {self.domain_name} ' f'{new_group_name}' f'group show --domain {self.domain_name} {new_group_name}'
) )
group = self.parse_show_as_object(raw_output) group = self.parse_show_as_object(raw_output)
self.assertEqual(new_group_name, group['name']) self.assertEqual(new_group_name, group['name'])

View File

@ -174,7 +174,7 @@ class LimitTestCase(common.IdentityTests):
} }
raw_output = self.openstack( raw_output = self.openstack(
'limit set' ' --description {description}' ' {limit_id}'.format( 'limit set --description {description} {limit_id}'.format(
**params **params
), ),
cloud=SYSTEM_CLOUD, cloud=SYSTEM_CLOUD,
@ -188,9 +188,9 @@ class LimitTestCase(common.IdentityTests):
params = {'resource_limit': 5, 'limit_id': limit_id} params = {'resource_limit': 5, 'limit_id': limit_id}
raw_output = self.openstack( raw_output = self.openstack(
'limit set' 'limit set --resource-limit {resource_limit} {limit_id}'.format(
' --resource-limit {resource_limit}' **params
' {limit_id}'.format(**params), ),
cloud=SYSTEM_CLOUD, cloud=SYSTEM_CLOUD,
) )
items = self.parse_show(raw_output) items = self.parse_show(raw_output)

View File

@ -30,9 +30,7 @@ class ProjectTests(common.IdentityTests):
) )
self.addCleanup( self.addCleanup(
self.openstack, self.openstack,
'project delete ' f'project delete --domain {self.domain_name} {project_name}',
f'--domain {self.domain_name} '
f'{project_name}',
) )
items = self.parse_show(raw_output) items = self.parse_show(raw_output)
show_fields = list(self.PROJECT_FIELDS) show_fields = list(self.PROJECT_FIELDS)
@ -45,7 +43,7 @@ class ProjectTests(common.IdentityTests):
def test_project_delete(self): def test_project_delete(self):
project_name = self._create_dummy_project(add_clean_up=False) project_name = self._create_dummy_project(add_clean_up=False)
raw_output = self.openstack( raw_output = self.openstack(
'project delete ' f'--domain {self.domain_name} ' f'{project_name}' f'project delete --domain {self.domain_name} {project_name}'
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
@ -77,9 +75,7 @@ class ProjectTests(common.IdentityTests):
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
# check project details # check project details
raw_output = self.openstack( raw_output = self.openstack(
'project show ' f'project show --domain {self.domain_name} {new_project_name}'
f'--domain {self.domain_name} '
f'{new_project_name}'
) )
items = self.parse_show(raw_output) items = self.parse_show(raw_output)
fields = list(self.PROJECT_FIELDS) fields = list(self.PROJECT_FIELDS)
@ -91,17 +87,12 @@ class ProjectTests(common.IdentityTests):
self.assertEqual('v0', project['k0']) self.assertEqual('v0', project['k0'])
# reset project to make sure it will be cleaned up # reset project to make sure it will be cleaned up
self.openstack( self.openstack(
'project set ' f'project set --name {project_name} --enable {new_project_name}'
f'--name {project_name} '
'--enable '
f'{new_project_name}'
) )
def test_project_show(self): def test_project_show(self):
raw_output = self.openstack( raw_output = self.openstack(
'project show ' f'project show --domain {self.domain_name} {self.project_name}'
f'--domain {self.domain_name} '
f'{self.project_name}'
) )
items = self.parse_show(raw_output) items = self.parse_show(raw_output)
self.assert_show_fields(items, self.PROJECT_FIELDS) self.assert_show_fields(items, self.PROJECT_FIELDS)

View File

@ -49,9 +49,7 @@ class RegionTests(common.IdentityTests):
self.assertEqual(region_id, region['region']) self.assertEqual(region_id, region['region'])
# update parent-region # update parent-region
raw_output = self.openstack( raw_output = self.openstack(
'region set ' f'region set --parent-region {new_parent_region_id} {region_id}'
f'--parent-region {new_parent_region_id} '
f'{region_id}'
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
# check updated region details # check updated region details

View File

@ -25,7 +25,7 @@ class RegisteredLimitTestCase(common.IdentityTests):
def test_registered_limit_create_with_service_id(self): def test_registered_limit_create_with_service_id(self):
service_name = self._create_dummy_service() service_name = self._create_dummy_service()
raw_output = self.openstack('service show' f' {service_name}') raw_output = self.openstack(f'service show {service_name}')
service_items = self.parse_show(raw_output) service_items = self.parse_show(raw_output)
service_id = self._extract_value_from_items('id', service_items) service_id = self._extract_value_from_items('id', service_items)
@ -44,7 +44,7 @@ class RegisteredLimitTestCase(common.IdentityTests):
registered_limit_id = self._extract_value_from_items('id', items) registered_limit_id = self._extract_value_from_items('id', items)
self.addCleanup( self.addCleanup(
self.openstack, self.openstack,
'registered limit delete' f' {registered_limit_id}', f'registered limit delete {registered_limit_id}',
cloud=SYSTEM_CLOUD, cloud=SYSTEM_CLOUD,
) )
@ -178,7 +178,7 @@ class RegisteredLimitTestCase(common.IdentityTests):
add_clean_up=False add_clean_up=False
) )
raw_output = self.openstack( raw_output = self.openstack(
'registered limit delete' f' {registered_limit_id}', f'registered limit delete {registered_limit_id}',
cloud=SYSTEM_CLOUD, cloud=SYSTEM_CLOUD,
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))

View File

@ -23,7 +23,7 @@ class RoleTests(common.IdentityTests):
role_name = data_utils.rand_name('TestRole') role_name = data_utils.rand_name('TestRole')
description = data_utils.rand_name('description') description = data_utils.rand_name('description')
raw_output = self.openstack( raw_output = self.openstack(
'role create ' f'--description {description} ' f'{role_name}' f'role create --description {description} {role_name}'
) )
role = self.parse_show_as_object(raw_output) role = self.parse_show_as_object(raw_output)
self.addCleanup(self.openstack, 'role delete {}'.format(role['id'])) self.addCleanup(self.openstack, 'role delete {}'.format(role['id']))

View File

@ -24,35 +24,25 @@ class RoleAssignmentTests(common.IdentityTests):
username = self._create_dummy_user() username = self._create_dummy_user()
system = 'all' system = 'all'
raw_output = self.openstack( raw_output = self.openstack(
'role add ' f'role add --user {username} --system {system} {role_name}'
f'--user {username} '
f'--system {system} '
f'{role_name}'
) )
self.addCleanup( self.addCleanup(
self.openstack, self.openstack,
'role remove ' f'role remove --user {username} --system {system} {role_name}',
f'--user {username} '
f'--system {system} '
f'{role_name}',
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
raw_output = self.openstack( raw_output = self.openstack(f'role assignment list --user {username} ')
'role assignment list ' f'--user {username} '
)
items = self.parse_listing(raw_output) items = self.parse_listing(raw_output)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS) self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
raw_output = self.openstack( raw_output = self.openstack(
'role assignment list ' f'--role {role_name} ' f'role assignment list --role {role_name} '
) )
items = self.parse_listing(raw_output) items = self.parse_listing(raw_output)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS) self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
raw_output = self.openstack( raw_output = self.openstack(f'role assignment list --system {system} ')
'role assignment list ' f'--system {system} '
)
items = self.parse_listing(raw_output) items = self.parse_listing(raw_output)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS) self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
@ -61,22 +51,14 @@ class RoleAssignmentTests(common.IdentityTests):
group = self._create_dummy_group() group = self._create_dummy_group()
system = 'all' system = 'all'
raw_output = self.openstack( raw_output = self.openstack(
'role add ' f'role add --group {group} --system {system} {role_name}'
f'--group {group} '
f'--system {system} '
f'{role_name}'
) )
self.addCleanup( self.addCleanup(
self.openstack, self.openstack,
'role remove ' f'role remove --group {group} --system {system} {role_name}',
f'--group {group} '
f'--system {system} '
f'{role_name}',
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
raw_output = self.openstack( raw_output = self.openstack(f'role assignment list --group {group} ')
'role assignment list ' f'--group {group} '
)
items = self.parse_listing(raw_output) items = self.parse_listing(raw_output)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS) self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
@ -98,7 +80,7 @@ class RoleAssignmentTests(common.IdentityTests):
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
raw_output = self.openstack( raw_output = self.openstack(
'role assignment list ' f'--domain {self.domain_name} ' f'role assignment list --domain {self.domain_name} '
) )
items = self.parse_listing(raw_output) items = self.parse_listing(raw_output)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS) self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
@ -121,23 +103,23 @@ class RoleAssignmentTests(common.IdentityTests):
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
raw_output = self.openstack( raw_output = self.openstack(
'role assignment list ' f'--project {self.project_name} ' f'role assignment list --project {self.project_name} '
) )
items = self.parse_listing(raw_output) items = self.parse_listing(raw_output)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS) self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
def test_role_assignment_list_effective(self): def test_role_assignment_list_effective(self):
raw_output = self.openstack('role assignment list ' '--effective') raw_output = self.openstack('role assignment list --effective')
items = self.parse_listing(raw_output) items = self.parse_listing(raw_output)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS) self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
def test_role_assignment_list_auth_user(self): def test_role_assignment_list_auth_user(self):
raw_output = self.openstack('role assignment list ' '--auth-user') raw_output = self.openstack('role assignment list --auth-user')
items = self.parse_listing(raw_output) items = self.parse_listing(raw_output)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS) self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
def test_role_assignment_list_auth_project(self): def test_role_assignment_list_auth_project(self):
raw_output = self.openstack('role assignment list ' '--auth-project') raw_output = self.openstack('role assignment list --auth-project')
items = self.parse_listing(raw_output) items = self.parse_listing(raw_output)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS) self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)

View File

@ -22,7 +22,7 @@ class UserTests(common.IdentityTests):
def test_user_delete(self): def test_user_delete(self):
username = self._create_dummy_user(add_clean_up=False) username = self._create_dummy_user(add_clean_up=False)
raw_output = self.openstack( raw_output = self.openstack(
'user delete ' f'--domain {self.domain_name} ' f'{username}' f'user delete --domain {self.domain_name} {username}'
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
@ -34,19 +34,19 @@ class UserTests(common.IdentityTests):
def test_user_set(self): def test_user_set(self):
username = self._create_dummy_user() username = self._create_dummy_user()
raw_output = self.openstack( raw_output = self.openstack(
'user show ' f'--domain {self.domain_name} ' f'{username}' f'user show --domain {self.domain_name} {username}'
) )
user = self.parse_show_as_object(raw_output) user = self.parse_show_as_object(raw_output)
new_username = data_utils.rand_name('NewTestUser') new_username = data_utils.rand_name('NewTestUser')
new_email = data_utils.rand_name() + '@example.com' new_email = data_utils.rand_name() + '@example.com'
raw_output = self.openstack( raw_output = self.openstack(
'user set ' '--email {email} ' '--name {new_name} ' '{id}'.format( 'user set --email {email} --name {new_name} {id}'.format(
email=new_email, new_name=new_username, id=user['id'] email=new_email, new_name=new_username, id=user['id']
) )
) )
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
raw_output = self.openstack( raw_output = self.openstack(
'user show ' f'--domain {self.domain_name} ' f'{new_username}' f'user show --domain {self.domain_name} {new_username}'
) )
updated_user = self.parse_show_as_object(raw_output) updated_user = self.parse_show_as_object(raw_output)
self.assertEqual(user['id'], updated_user['id']) self.assertEqual(user['id'], updated_user['id'])
@ -57,7 +57,7 @@ class UserTests(common.IdentityTests):
project_name = self._create_dummy_project() project_name = self._create_dummy_project()
# get original user details # get original user details
raw_output = self.openstack( raw_output = self.openstack(
'user show ' f'--domain {self.domain_name} ' f'{username}' f'user show --domain {self.domain_name} {username}'
) )
user = self.parse_show_as_object(raw_output) user = self.parse_show_as_object(raw_output)
# update user # update user
@ -74,12 +74,12 @@ class UserTests(common.IdentityTests):
self.assertEqual(0, len(raw_output)) self.assertEqual(0, len(raw_output))
# get updated user details # get updated user details
raw_output = self.openstack( raw_output = self.openstack(
'user show ' f'--domain {self.domain_name} ' f'{username}' f'user show --domain {self.domain_name} {username}'
) )
updated_user = self.parse_show_as_object(raw_output) updated_user = self.parse_show_as_object(raw_output)
# get project details # get project details
raw_output = self.openstack( raw_output = self.openstack(
'project show ' f'--domain {self.domain_name} ' f'{project_name}' f'project show --domain {self.domain_name} {project_name}'
) )
project = self.parse_show_as_object(raw_output) project = self.parse_show_as_object(raw_output)
# check updated user details # check updated user details
@ -89,7 +89,7 @@ class UserTests(common.IdentityTests):
def test_user_show(self): def test_user_show(self):
username = self._create_dummy_user() username = self._create_dummy_user()
raw_output = self.openstack( raw_output = self.openstack(
'user show ' f'--domain {self.domain_name} ' f'{username}' f'user show --domain {self.domain_name} {username}'
) )
items = self.parse_show(raw_output) items = self.parse_show(raw_output)
self.assert_show_fields(items, self.USER_FIELDS) self.assert_show_fields(items, self.USER_FIELDS)

View File

@ -69,8 +69,7 @@ class L3ConntrackHelperTests(common.NetworkTests):
ct_ids = " ".join([ct['id'] for ct in created_helpers]) ct_ids = " ".join([ct['id'] for ct in created_helpers])
raw_output = self.openstack( raw_output = self.openstack(
f'--debug network l3 conntrack helper delete {router_id} ' f'--debug network l3 conntrack helper delete {router_id} {ct_ids}'
f'{ct_ids}'
) )
self.assertOutput('', raw_output) self.assertOutput('', raw_output)

View File

@ -31,7 +31,7 @@ class L3NDPProxyTests(common.NetworkTests):
self.created_ndp_proxies = [] self.created_ndp_proxies = []
json_output = self.openstack( json_output = self.openstack(
'address scope create --ip-version 6 ' f'{self.ADDR_SCOPE_NAME}', f'address scope create --ip-version 6 {self.ADDR_SCOPE_NAME}',
parse_output=True, parse_output=True,
) )
self.assertIsNotNone(json_output['id']) self.assertIsNotNone(json_output['id'])
@ -88,8 +88,7 @@ class L3NDPProxyTests(common.NetworkTests):
self.assertIsNotNone(json_output['id']) self.assertIsNotNone(json_output['id'])
self.INT_SUB_ID = json_output['id'] self.INT_SUB_ID = json_output['id']
json_output = self.openstack( json_output = self.openstack(
f'port create --network {self.INT_NET_ID} ' f'port create --network {self.INT_NET_ID} {self.INT_PORT_NAME}',
f'{self.INT_PORT_NAME}',
parse_output=True, parse_output=True,
) )
self.assertIsNotNone(json_output['id']) self.assertIsNotNone(json_output['id'])

View File

@ -80,7 +80,7 @@ class NetworkTrunkTests(common.NetworkTests):
self.addCleanup(self.openstack, 'network trunk delete ' + trunk_name) self.addCleanup(self.openstack, 'network trunk delete ' + trunk_name)
self.assertEqual(trunk_name, json_output['name']) self.assertEqual(trunk_name, json_output['name'])
self.openstack('network trunk set ' '--enable ' + trunk_name) self.openstack('network trunk set --enable ' + trunk_name)
json_output = json.loads( json_output = json.loads(
self.openstack('network trunk show -f json ' + trunk_name) self.openstack('network trunk show -f json ' + trunk_name)

View File

@ -209,7 +209,7 @@ class PortTests(common.NetworkTagTests):
def test_port_admin_set(self): def test_port_admin_set(self):
"""Test create, set (as admin), show, delete""" """Test create, set (as admin), show, delete"""
json_output = self.openstack( json_output = self.openstack(
'port create ' f'--network {self.NETWORK_NAME} {self.NAME}', f'port create --network {self.NETWORK_NAME} {self.NAME}',
parse_output=True, parse_output=True,
) )
id_ = json_output.get('id') id_ = json_output.get('id')
@ -257,7 +257,7 @@ class PortTests(common.NetworkTagTests):
self.assertEqual([sg_id1], json_output.get('security_group_ids')) self.assertEqual([sg_id1], json_output.get('security_group_ids'))
raw_output = self.openstack( raw_output = self.openstack(
'port set ' f'--security-group {sg_name2} {name}' f'port set --security-group {sg_name2} {name}'
) )
self.assertOutput('', raw_output) self.assertOutput('', raw_output)
@ -296,17 +296,17 @@ class PortTests(common.NetworkTagTests):
sport2 = uuid.uuid4().hex sport2 = uuid.uuid4().hex
trunk = uuid.uuid4().hex trunk = uuid.uuid4().hex
json_output = self.openstack( json_output = self.openstack(
'port create ' f'--network {self.NETWORK_NAME} {pport}', f'port create --network {self.NETWORK_NAME} {pport}',
parse_output=True, parse_output=True,
) )
pport_id = json_output.get('id') pport_id = json_output.get('id')
json_output = self.openstack( json_output = self.openstack(
'port create ' f'--network {self.NETWORK_NAME} {sport1}', f'port create --network {self.NETWORK_NAME} {sport1}',
parse_output=True, parse_output=True,
) )
sport1_id = json_output.get('id') sport1_id = json_output.get('id')
json_output = self.openstack( json_output = self.openstack(
'port create ' f'--network {self.NETWORK_NAME} {sport2}', f'port create --network {self.NETWORK_NAME} {sport2}',
parse_output=True, parse_output=True,
) )
sport2_id = json_output.get('id') sport2_id = json_output.get('id')

View File

@ -31,7 +31,7 @@ class TestCommand(test_utils.TestCase):
cmd = FakeCommand(mock.Mock(), mock.Mock()) cmd = FakeCommand(mock.Mock(), mock.Mock())
self.assertTrue(hasattr(cmd, 'log')) self.assertTrue(hasattr(cmd, 'log'))
self.assertEqual( self.assertEqual(
'openstackclient.tests.unit.common.test_command.' 'FakeCommand', 'openstackclient.tests.unit.common.test_command.FakeCommand',
cmd.log.name, cmd.log.name,
) )

View File

@ -4967,7 +4967,7 @@ class TestServerList(_TestServerList):
self.fail('CommandError should be raised.') self.fail('CommandError should be raised.')
except exceptions.CommandError as e: except exceptions.CommandError as e:
self.assertEqual( self.assertEqual(
'Invalid changes-since value: Invalid time ' 'value', str(e) 'Invalid changes-since value: Invalid time value', str(e)
) )
mock_parse_isotime.assert_called_once_with('Invalid time value') mock_parse_isotime.assert_called_once_with('Invalid time value')
@ -5454,7 +5454,7 @@ class TestServerListV273(_TestServerList):
self.fail('CommandError should be raised.') self.fail('CommandError should be raised.')
except exceptions.CommandError as e: except exceptions.CommandError as e:
self.assertEqual( self.assertEqual(
'Invalid changes-before value: Invalid time ' 'value', str(e) 'Invalid changes-before value: Invalid time value', str(e)
) )
mock_parse_isotime.assert_called_once_with('Invalid time value') mock_parse_isotime.assert_called_once_with('Invalid time value')

View File

@ -228,7 +228,7 @@ class FakeExtension:
extension_info = { extension_info = {
'name': 'name-' + uuid.uuid4().hex, 'name': 'name-' + uuid.uuid4().hex,
'namespace': ( 'namespace': (
'http://docs.openstack.org/identity/' 'api/ext/OS-KSCRUD/v1.0' 'http://docs.openstack.org/identity/api/ext/OS-KSCRUD/v1.0'
), ),
'description': 'description-' + uuid.uuid4().hex, 'description': 'description-' + uuid.uuid4().hex,
'updated': '2013-07-07T12:00:0-00:00', 'updated': '2013-07-07T12:00:0-00:00',

View File

@ -77,9 +77,7 @@ class TestAccessRuleDelete(identity_fakes.TestIdentityv3):
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)
self.fail('CommandError should be raised.') self.fail('CommandError should be raised.')
except exceptions.CommandError as e: except exceptions.CommandError as e:
self.assertEqual( self.assertEqual('1 of 2 access rules failed to delete.', str(e))
'1 of 2 access rules failed to' ' delete.', str(e)
)
calls = [] calls = []
for a in arglist: for a in arglist:

View File

@ -295,7 +295,7 @@ class TestApplicationCredentialDelete(identity_fakes.TestIdentityv3):
self.fail('CommandError should be raised.') self.fail('CommandError should be raised.')
except exceptions.CommandError as e: except exceptions.CommandError as e:
self.assertEqual( self.assertEqual(
'1 of 2 application credentials failed to' ' delete.', str(e) '1 of 2 application credentials failed to delete.', str(e)
) )
calls = [] calls = []

View File

@ -55,7 +55,7 @@ class TestMappingCreate(TestMapping):
mocker = mock.Mock() mocker = mock.Mock()
mocker.return_value = identity_fakes.MAPPING_RULES mocker.return_value = identity_fakes.MAPPING_RULES
with mock.patch( with mock.patch(
"openstackclient.identity.v3.mapping." "CreateMapping._read_rules", "openstackclient.identity.v3.mapping.CreateMapping._read_rules",
mocker, mocker,
): ):
columns, data = self.cmd.take_action(parsed_args) columns, data = self.cmd.take_action(parsed_args)
@ -170,7 +170,7 @@ class TestMappingSet(TestMapping):
mocker = mock.Mock() mocker = mock.Mock()
mocker.return_value = identity_fakes.MAPPING_RULES_2 mocker.return_value = identity_fakes.MAPPING_RULES_2
with mock.patch( with mock.patch(
"openstackclient.identity.v3.mapping." "SetMapping._read_rules", "openstackclient.identity.v3.mapping.SetMapping._read_rules",
mocker, mocker,
): ):
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)

View File

@ -361,8 +361,7 @@ class TestIntegShellCliPrecedence(test_base.TestInteg):
_shell = shell.OpenStackShell() _shell = shell.OpenStackShell()
_shell.run( _shell.run(
"--os-username zarquon --os-password qaz " "--os-username zarquon --os-password qaz extension list".split(),
"extension list".split(),
) )
# Check general calls # Check general calls

View File

@ -263,7 +263,7 @@ class TestCreateNetworkTrunk(TestNetworkTrunk):
'--parent-port', '--parent-port',
self.new_trunk.port_id, self.new_trunk.port_id,
'--subport', '--subport',
'segmentation-type={seg_type},' 'segmentation-id={seg_id}'.format( 'segmentation-type={seg_type},segmentation-id={seg_id}'.format(
seg_id=subport['segmentation_id'], seg_id=subport['segmentation_id'],
seg_type=subport['segmentation_type'], seg_type=subport['segmentation_type'],
), ),
@ -727,7 +727,7 @@ class TestSetNetworkTrunk(TestNetworkTrunk):
subport = self._trunk['sub_ports'][0] subport = self._trunk['sub_ports'][0]
arglist = [ arglist = [
'--subport', '--subport',
'segmentation-type={seg_type},' 'segmentation-id={seg_id}'.format( 'segmentation-type={seg_type},segmentation-id={seg_id}'.format(
seg_id=subport['segmentation_id'], seg_id=subport['segmentation_id'],
seg_type=subport['segmentation_type'], seg_type=subport['segmentation_type'],
), ),

View File

@ -807,8 +807,7 @@ class TestCreatePort(TestPort):
extra_dhcp_options = [ extra_dhcp_options = [
{ {
'opt_name': 'classless-static-route', 'opt_name': 'classless-static-route',
'opt_value': '169.254.169.254/32,22.2.0.2,' 'opt_value': '169.254.169.254/32,22.2.0.2,0.0.0.0/0,22.2.0.1',
'0.0.0.0/0,22.2.0.1',
'ip_version': '4', 'ip_version': '4',
}, },
{ {
@ -826,7 +825,7 @@ class TestCreatePort(TestPort):
'0.0.0.0/0,22.2.0.1,' '0.0.0.0/0,22.2.0.1,'
'ip-version=4', 'ip-version=4',
'--extra-dhcp-option', '--extra-dhcp-option',
'name=dns-server,value=240C::6666,' 'ip-version=6', 'name=dns-server,value=240C::6666,ip-version=6',
'test-port', 'test-port',
] ]

View File

@ -252,9 +252,10 @@ class TestObjectSave(TestObjectAll):
def __exit__(self, *a): def __exit__(self, *a):
self.context_manager_calls.append('__exit__') self.context_manager_calls.append('__exit__')
with mock.patch('sys.stdout') as fake_stdout, mock.patch( with (
'os.fdopen', return_value=FakeStdout() mock.patch('sys.stdout') as fake_stdout,
) as fake_fdopen: mock.patch('os.fdopen', return_value=FakeStdout()) as fake_fdopen,
):
fake_stdout.fileno.return_value = 123 fake_stdout.fileno.return_value = 123
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)

View File

@ -239,7 +239,7 @@ class TestTransferDelete(TestTransfer):
self.fail('CommandError should be raised.') self.fail('CommandError should be raised.')
except exceptions.CommandError as e: except exceptions.CommandError as e:
self.assertEqual( self.assertEqual(
'1 of 2 volume transfer requests failed ' 'to delete', '1 of 2 volume transfer requests failed to delete',
str(e), str(e),
) )

View File

@ -431,7 +431,7 @@ class TestTypeSet(TestType):
self.fail('CommandError should be raised.') self.fail('CommandError should be raised.')
except exceptions.CommandError as e: except exceptions.CommandError as e:
self.assertEqual( self.assertEqual(
"Command Failed: One or more of" " the operations failed", "Command Failed: One or more of the operations failed",
str(e), str(e),
) )
self.encryption_types_mock.create.assert_not_called() self.encryption_types_mock.create.assert_not_called()

View File

@ -1619,7 +1619,7 @@ class TestVolumeSet(TestVolume):
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.volumes_mock.retype.assert_not_called() self.volumes_mock.retype.assert_not_called()
mock_warning.assert_called_with( mock_warning.assert_called_with(
"'--retype-policy' option will " "not work without '--type' option" "'--retype-policy' option will not work without '--type' option"
) )
self.assertIsNone(result) self.assertIsNone(result)

View File

@ -241,7 +241,7 @@ class TestTransferDelete(TestTransfer):
self.fail('CommandError should be raised.') self.fail('CommandError should be raised.')
except exceptions.CommandError as e: except exceptions.CommandError as e:
self.assertEqual( self.assertEqual(
'1 of 2 volume transfer requests failed ' 'to delete', '1 of 2 volume transfer requests failed to delete',
str(e), str(e),
) )

View File

@ -2027,7 +2027,7 @@ class TestVolumeSet(volume_fakes.TestVolume):
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
self.volumes_mock.retype.assert_not_called() self.volumes_mock.retype.assert_not_called()
mock_warning.assert_called_with( mock_warning.assert_called_with(
"'--retype-policy' option will " "not work without '--type' option" "'--retype-policy' option will not work without '--type' option"
) )
self.assertIsNone(result) self.assertIsNone(result)

Some files were not shown because too many files have changed in this diff Show More