Merge "Prepare for ruff bump"

This commit is contained in:
Zuul 2025-03-31 10:37:30 +00:00 committed by Gerrit Code Review
commit ab2e68f407
120 changed files with 333 additions and 490 deletions

View File

@ -114,7 +114,7 @@ class DeleteAgent(command.Command):
if result > 0:
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,
'total': total,
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -335,7 +335,7 @@ def add_inherited_option_to_parser(parser):
action='store_true',
default=False,
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:
total = len(parsed_args.access_keys)
msg = _(
"%(result)s of %(total)s EC2 keys failed " "to delete."
) % {'result': result, 'total': total}
msg = _("%(result)s of %(total)s EC2 keys failed to delete.") % {
'result': result,
'total': total,
}
raise exceptions.CommandError(msg)

View File

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

View File

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

View File

@ -143,7 +143,7 @@ class DeleteRole(command.Command):
if errors > 0:
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,
'total': total,
}

View File

@ -100,9 +100,10 @@ class DeleteService(command.Command):
if result > 0:
total = len(parsed_args.services)
msg = _(
"%(result)s of %(total)s services failed " "to delete."
) % {'result': result, 'total': total}
msg = _("%(result)s of %(total)s services failed to delete.") % {
'result': result,
'total': total,
}
raise exceptions.CommandError(msg)
@ -164,7 +165,7 @@ class ShowService(command.ShowOne):
return zip(*sorted(info.items()))
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)
raise exceptions.CommandError(msg)
else:

View File

@ -194,7 +194,7 @@ class DeleteUser(command.Command):
if errors > 0:
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,
'total': total,
}

View File

@ -54,17 +54,14 @@ class DeleteAccessRule(command.Command):
except Exception as e:
errors += 1
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},
)
if errors > 0:
total = len(parsed_args.access_rule)
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}
raise exceptions.CommandError(msg)

View File

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

View File

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

View File

@ -124,7 +124,7 @@ class DeleteDomain(command.Command):
if result > 0:
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,
'total': total,
}

View File

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

View File

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

View File

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

View File

@ -230,7 +230,7 @@ class DeleteGroup(command.Command):
if errors > 0:
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,
'total': total,
}

View File

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

View File

@ -281,13 +281,13 @@ class DeleteLimit(command.Command):
except Exception as e:
errors += 1
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},
)
if errors > 0:
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,
'total': total,
}

View File

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

View File

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

View File

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

View File

@ -92,16 +92,13 @@ class DeleteRegion(command.Command):
except Exception as e:
result += 1
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},
)
if result > 0:
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,
'total': total,
}

View File

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

View File

@ -402,7 +402,7 @@ class DeleteRole(command.Command):
if errors > 0:
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,
'total': total,
}
@ -449,7 +449,7 @@ class ListRole(command.Lister):
class RemoveRole(command.Command):
_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):

View File

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

View File

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

View File

@ -83,7 +83,7 @@ def add_tag_option_to_parser_for_create(parser, resource_name):
metavar='<tag>',
default=[],
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,
)
@ -97,7 +97,7 @@ def add_tag_option_to_parser_for_set(parser, resource_name):
metavar='<tag>',
default=[],
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,
)

View File

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

View File

@ -233,7 +233,7 @@ class DeleteTrust(command.Command):
if errors > 0:
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,
'total': total,
}

View File

@ -377,7 +377,7 @@ class DeleteUser(command.Command):
if errors > 0:
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,
'total': total,
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -123,7 +123,7 @@ class CreateFloatingIP(
'--port',
metavar='<port>',
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(
@ -268,10 +268,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
'--floating-ip-address',
metavar='<ip-address>',
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(
@ -308,10 +305,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
'--router',
metavar='<router>',
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(
@ -458,8 +452,7 @@ class SetFloatingIP(common.NeutronCommandWithExtraArgs):
metavar='<ip-address>',
dest='fixed_ip_address',
help=_(
"Fixed IP of the port "
"(required only if port has multiple IPs)"
"Fixed IP of the port (required only if port has multiple IPs)"
),
)
parser.add_argument(

View File

@ -243,7 +243,7 @@ class DeleteFloatingIPPortForwarding(command.Command):
if result > 0:
total = len(parsed_args.port_forwarding_id)
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}
raise exceptions.CommandError(msg)

View File

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

View File

@ -151,9 +151,10 @@ class DeleteLocalIP(command.Command):
if result > 0:
total = len(parsed_args.local_ip)
msg = _(
"%(result)s of %(total)s local IPs failed " "to delete."
) % {'result': result, 'total': total}
msg = _("%(result)s of %(total)s local IPs failed to delete.") % {
'result': result,
'total': total,
}
raise exceptions.CommandError(msg)
@ -203,31 +204,27 @@ class ListLocalIP(command.Lister):
parser.add_argument(
'--project',
metavar="<project>",
help=_(
"List Local IPs according to their project " "(name or ID)"
),
help=_("List Local IPs according to their project (name or ID)"),
)
parser.add_argument(
'--network',
metavar='<network>',
help=_(
"List Local IP(s) according to " "given network (name or ID)"
),
help=_("List Local IP(s) according to given network (name or ID)"),
)
parser.add_argument(
'--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(
'--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(
'--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)

View File

@ -44,7 +44,7 @@ class CreateLocalIPAssociation(command.ShowOne):
'local_ip',
metavar='<local-ip>',
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(
@ -90,7 +90,7 @@ class DeleteLocalIPAssociation(command.Command):
'local_ip',
metavar="<local-ip>",
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(
@ -151,7 +151,7 @@ class ListLocalIPAssociation(command.Lister):
'--fixed-port',
metavar='<fixed-port>',
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(

View File

@ -124,13 +124,13 @@ class DeleteNDPProxy(command.Command):
except Exception as e:
result += 1
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},
)
if result > 0:
total = len(parsed_args.ndp_proxy)
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}
raise exceptions.CommandError(msg)

View File

@ -355,17 +355,14 @@ class CreateNetwork(
'--qinq-vlan',
action='store_true',
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(
'--no-qinq-vlan',
action='store_true',
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:
total = len(parsed_args.network_agent)
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}
raise exceptions.CommandError(msg)

View File

@ -146,7 +146,7 @@ class DeleteNetworkFlavorProfile(command.Command):
if result > 0:
total = len(parsed_args.flavor_profile)
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}
raise exceptions.CommandError(msg)

View File

@ -139,12 +139,12 @@ class DeleteMeter(command.Command):
except Exception as e:
result += 1
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},
)
if result > 0:
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,
"total": total,
}

View File

@ -168,17 +168,14 @@ class DeleteMeterRule(command.Command):
except Exception as e:
result += 1
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},
)
if result > 0:
total = len(parsed_args.meter_rule_id)
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}
raise exceptions.CommandError(msg)

View File

@ -174,7 +174,7 @@ class DeleteNetworkQosPolicy(command.Command):
if result > 0:
total = len(parsed_args.policy)
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}
raise exceptions.CommandError(msg)

View File

@ -212,7 +212,7 @@ class DeleteNetworkRBAC(command.Command):
if result > 0:
total = len(parsed_args.rbac_policy)
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}
raise exceptions.CommandError(msg)

View File

@ -141,7 +141,7 @@ class DeleteNetworkSegment(command.Command):
if result > 0:
total = len(parsed_args.network_segment)
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}
raise exceptions.CommandError(msg)

View File

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

View File

@ -128,7 +128,7 @@ class DeleteNetworkTrunk(command.Command):
)
if result > 0:
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,
'total': total,
}

View File

@ -368,8 +368,7 @@ def _add_updatable_args(parser, create=False):
'--dns-name',
metavar='<dns-name>',
help=_(
"Set DNS name for this port "
"(requires DNS integration extension)"
"Set DNS name for this port (requires DNS integration extension)"
),
)
numa_affinity_policy_group = parser.add_mutually_exclusive_group()
@ -753,7 +752,7 @@ class DeletePort(command.Command):
if result > 0:
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,
'total': total,
}

View File

@ -683,7 +683,7 @@ class DeleteRouter(command.Command):
if result > 0:
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,
'total': total,
}
@ -963,7 +963,7 @@ class SetRouter(common.NeutronCommandWithExtraArgs):
'--ha',
action='store_true',
help=_(
"Set the router as highly available " "(disabled router only)"
"Set the router as highly available (disabled router only)"
),
)
routes_ha.add_argument(

View File

@ -239,10 +239,7 @@ class ListSecurityGroup(common.NetworkAndComputeLister):
'--project',
metavar='<project>',
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(

View File

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

View File

@ -400,7 +400,7 @@ class CreateSubnet(command.ShowOne, common.NeutronCommandWithExtraArgs):
'--network-segment',
metavar='<network-segment>',
help=_(
"Network segment to associate with this subnet " "(name or ID)"
"Network segment to associate with this subnet (name or ID)"
),
)
parser.add_argument(
@ -465,7 +465,7 @@ class DeleteSubnet(command.Command):
if result > 0:
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,
'total': total,
}

View File

@ -256,7 +256,7 @@ class DeleteSubnetPool(command.Command):
if result > 0:
total = len(parsed_args.subnet_pool)
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}
raise exceptions.CommandError(msg)
@ -290,7 +290,7 @@ class ListSubnetPool(command.Lister):
'--default',
action='store_true',
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(

View File

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

View File

@ -37,7 +37,7 @@ class UserTests(common.IdentityTests):
new_username = data_utils.rand_name('NewTestUser')
new_email = data_utils.rand_name() + '@example.com'
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']
)
)

View File

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

View File

@ -50,35 +50,35 @@ class ApplicationCredentialTests(common.IdentityTests):
def _create_role_assignments(self):
try:
user = self.openstack(
'configuration show -f value' ' -c auth.username'
'configuration show -f value -c auth.username'
)
except Exception:
user = self.openstack(
'configuration show -f value' ' -c auth.user_id'
'configuration show -f value -c auth.user_id'
)
try:
user_domain = self.openstack(
'configuration show -f value' ' -c auth.user_domain_name'
'configuration show -f value -c auth.user_domain_name'
)
except Exception:
user_domain = self.openstack(
'configuration show -f value' ' -c auth.user_domain_id'
'configuration show -f value -c auth.user_domain_id'
)
try:
project = self.openstack(
'configuration show -f value' ' -c auth.project_name'
'configuration show -f value -c auth.project_name'
)
except Exception:
project = self.openstack(
'configuration show -f value' ' -c auth.project_id'
'configuration show -f value -c auth.project_id'
)
try:
project_domain = self.openstack(
'configuration show -f value' ' -c auth.project_domain_name'
'configuration show -f value -c auth.project_domain_name'
)
except Exception:
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()
role2 = self._create_dummy_role()
@ -130,7 +130,7 @@ class ApplicationCredentialTests(common.IdentityTests):
def test_application_credential_delete(self):
name = data_utils.rand_name('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))
def test_application_credential_list(self):
@ -147,6 +147,6 @@ class ApplicationCredentialTests(common.IdentityTests):
self.openstack,
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)
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)
project_id = self._create_dummy_project(add_clean_up=False)
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))
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)
project_id = self._create_dummy_project(add_clean_up=False)
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))
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))

View File

@ -36,14 +36,14 @@ class GroupTests(common.IdentityTests):
def test_group_delete(self):
group_name = self._create_dummy_group(add_clean_up=False)
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))
def test_group_show(self):
group_name = self._create_dummy_group()
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)
self.assert_show_fields(items, self.GROUP_FIELDS)
@ -59,7 +59,7 @@ class GroupTests(common.IdentityTests):
)
self.assertEqual(0, len(raw_output))
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)
self.assertEqual(new_group_name, group['name'])

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ class RegisteredLimitTestCase(common.IdentityTests):
def test_registered_limit_create_with_service_id(self):
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_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)
self.addCleanup(
self.openstack,
'registered limit delete' f' {registered_limit_id}',
f'registered limit delete {registered_limit_id}',
cloud=SYSTEM_CLOUD,
)
@ -178,7 +178,7 @@ class RegisteredLimitTestCase(common.IdentityTests):
add_clean_up=False
)
raw_output = self.openstack(
'registered limit delete' f' {registered_limit_id}',
f'registered limit delete {registered_limit_id}',
cloud=SYSTEM_CLOUD,
)
self.assertEqual(0, len(raw_output))

View File

@ -23,7 +23,7 @@ class RoleTests(common.IdentityTests):
role_name = data_utils.rand_name('TestRole')
description = data_utils.rand_name('description')
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)
self.addCleanup(self.openstack, 'role delete {}'.format(role['id']))

View File

@ -24,35 +24,25 @@ class RoleAssignmentTests(common.IdentityTests):
username = self._create_dummy_user()
system = 'all'
raw_output = self.openstack(
'role add '
f'--user {username} '
f'--system {system} '
f'{role_name}'
f'role add --user {username} --system {system} {role_name}'
)
self.addCleanup(
self.openstack,
'role remove '
f'--user {username} '
f'--system {system} '
f'{role_name}',
f'role remove --user {username} --system {system} {role_name}',
)
self.assertEqual(0, len(raw_output))
raw_output = self.openstack(
'role assignment list ' f'--user {username} '
)
raw_output = self.openstack(f'role assignment list --user {username} ')
items = self.parse_listing(raw_output)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
raw_output = self.openstack(
'role assignment list ' f'--role {role_name} '
f'role assignment list --role {role_name} '
)
items = self.parse_listing(raw_output)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
raw_output = self.openstack(
'role assignment list ' f'--system {system} '
)
raw_output = self.openstack(f'role assignment list --system {system} ')
items = self.parse_listing(raw_output)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
@ -61,22 +51,14 @@ class RoleAssignmentTests(common.IdentityTests):
group = self._create_dummy_group()
system = 'all'
raw_output = self.openstack(
'role add '
f'--group {group} '
f'--system {system} '
f'{role_name}'
f'role add --group {group} --system {system} {role_name}'
)
self.addCleanup(
self.openstack,
'role remove '
f'--group {group} '
f'--system {system} '
f'{role_name}',
f'role remove --group {group} --system {system} {role_name}',
)
self.assertEqual(0, len(raw_output))
raw_output = self.openstack(
'role assignment list ' f'--group {group} '
)
raw_output = self.openstack(f'role assignment list --group {group} ')
items = self.parse_listing(raw_output)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
@ -98,7 +80,7 @@ class RoleAssignmentTests(common.IdentityTests):
)
self.assertEqual(0, len(raw_output))
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)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
@ -121,23 +103,23 @@ class RoleAssignmentTests(common.IdentityTests):
)
self.assertEqual(0, len(raw_output))
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)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
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)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
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)
self.assert_table_structure(items, self.ROLE_ASSIGNMENT_LIST_HEADERS)
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)
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):
username = self._create_dummy_user(add_clean_up=False)
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))
@ -34,19 +34,19 @@ class UserTests(common.IdentityTests):
def test_user_set(self):
username = self._create_dummy_user()
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)
new_username = data_utils.rand_name('NewTestUser')
new_email = data_utils.rand_name() + '@example.com'
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']
)
)
self.assertEqual(0, len(raw_output))
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)
self.assertEqual(user['id'], updated_user['id'])
@ -57,7 +57,7 @@ class UserTests(common.IdentityTests):
project_name = self._create_dummy_project()
# get original user details
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)
# update user
@ -74,12 +74,12 @@ class UserTests(common.IdentityTests):
self.assertEqual(0, len(raw_output))
# get updated user details
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)
# get project details
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)
# check updated user details
@ -89,7 +89,7 @@ class UserTests(common.IdentityTests):
def test_user_show(self):
username = self._create_dummy_user()
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)
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])
raw_output = self.openstack(
f'--debug network l3 conntrack helper delete {router_id} '
f'{ct_ids}'
f'--debug network l3 conntrack helper delete {router_id} {ct_ids}'
)
self.assertOutput('', raw_output)

View File

@ -31,7 +31,7 @@ class L3NDPProxyTests(common.NetworkTests):
self.created_ndp_proxies = []
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,
)
self.assertIsNotNone(json_output['id'])
@ -88,8 +88,7 @@ class L3NDPProxyTests(common.NetworkTests):
self.assertIsNotNone(json_output['id'])
self.INT_SUB_ID = json_output['id']
json_output = self.openstack(
f'port create --network {self.INT_NET_ID} '
f'{self.INT_PORT_NAME}',
f'port create --network {self.INT_NET_ID} {self.INT_PORT_NAME}',
parse_output=True,
)
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.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(
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):
"""Test create, set (as admin), show, delete"""
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,
)
id_ = json_output.get('id')
@ -257,7 +257,7 @@ class PortTests(common.NetworkTagTests):
self.assertEqual([sg_id1], json_output.get('security_group_ids'))
raw_output = self.openstack(
'port set ' f'--security-group {sg_name2} {name}'
f'port set --security-group {sg_name2} {name}'
)
self.assertOutput('', raw_output)
@ -296,17 +296,17 @@ class PortTests(common.NetworkTagTests):
sport2 = uuid.uuid4().hex
trunk = uuid.uuid4().hex
json_output = self.openstack(
'port create ' f'--network {self.NETWORK_NAME} {pport}',
f'port create --network {self.NETWORK_NAME} {pport}',
parse_output=True,
)
pport_id = json_output.get('id')
json_output = self.openstack(
'port create ' f'--network {self.NETWORK_NAME} {sport1}',
f'port create --network {self.NETWORK_NAME} {sport1}',
parse_output=True,
)
sport1_id = json_output.get('id')
json_output = self.openstack(
'port create ' f'--network {self.NETWORK_NAME} {sport2}',
f'port create --network {self.NETWORK_NAME} {sport2}',
parse_output=True,
)
sport2_id = json_output.get('id')

View File

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

View File

@ -4967,7 +4967,7 @@ class TestServerList(_TestServerList):
self.fail('CommandError should be raised.')
except exceptions.CommandError as e:
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')
@ -5454,7 +5454,7 @@ class TestServerListV273(_TestServerList):
self.fail('CommandError should be raised.')
except exceptions.CommandError as e:
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')

View File

@ -228,7 +228,7 @@ class FakeExtension:
extension_info = {
'name': 'name-' + uuid.uuid4().hex,
'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,
'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.fail('CommandError should be raised.')
except exceptions.CommandError as e:
self.assertEqual(
'1 of 2 access rules failed to' ' delete.', str(e)
)
self.assertEqual('1 of 2 access rules failed to delete.', str(e))
calls = []
for a in arglist:

View File

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

View File

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

View File

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

View File

@ -263,7 +263,7 @@ class TestCreateNetworkTrunk(TestNetworkTrunk):
'--parent-port',
self.new_trunk.port_id,
'--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_type=subport['segmentation_type'],
),
@ -727,7 +727,7 @@ class TestSetNetworkTrunk(TestNetworkTrunk):
subport = self._trunk['sub_ports'][0]
arglist = [
'--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_type=subport['segmentation_type'],
),

View File

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

View File

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

View File

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

View File

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

View File

@ -1619,7 +1619,7 @@ class TestVolumeSet(TestVolume):
result = self.cmd.take_action(parsed_args)
self.volumes_mock.retype.assert_not_called()
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)

View File

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

View File

@ -2027,7 +2027,7 @@ class TestVolumeSet(volume_fakes.TestVolume):
result = self.cmd.take_action(parsed_args)
self.volumes_mock.retype.assert_not_called()
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)

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