trivial: Prepare for pyupgrade pre-commit hook
This change is entirely automated save for the update of some mocks from 'io.open' to '__builtins__.open'). We are keeping this change separate from addition of the actual hook so that we can ignore the commit later. Change-Id: I0a9d8736632084473b57b57b693322447d7be519 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
3de6969dbe
commit
c5b772db76
@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# OpenStack Command Line Client documentation build configuration file, created
|
||||
# by sphinx-quickstart on Wed May 16 12:05:58 2012.
|
||||
|
@ -45,7 +45,7 @@ raised that includes the name of the file that was attempted to be opened.
|
||||
public_key = parsed_args.public_key
|
||||
if public_key:
|
||||
try:
|
||||
with io.open(
|
||||
with open(
|
||||
os.path.expanduser(parsed_args.public_key),
|
||||
"rb"
|
||||
) as p:
|
||||
|
@ -21,7 +21,7 @@ import simplejson as json
|
||||
from openstackclient.i18n import _
|
||||
|
||||
|
||||
class KeystoneSession(object):
|
||||
class KeystoneSession:
|
||||
"""Wrapper for the Keystone Session
|
||||
|
||||
Restore some requests.session.Session compatibility;
|
||||
@ -40,7 +40,7 @@ class KeystoneSession(object):
|
||||
requests on this API.
|
||||
"""
|
||||
|
||||
super(KeystoneSession, self).__init__()
|
||||
super().__init__()
|
||||
|
||||
# a requests.Session-style interface
|
||||
self.session = session
|
||||
@ -95,7 +95,7 @@ class BaseAPI(KeystoneSession):
|
||||
requests on this API.
|
||||
"""
|
||||
|
||||
super(BaseAPI, self).__init__(session=session, endpoint=endpoint)
|
||||
super().__init__(session=session, endpoint=endpoint)
|
||||
|
||||
self.service_type = service_type
|
||||
|
||||
@ -303,7 +303,7 @@ class BaseAPI(KeystoneSession):
|
||||
"""
|
||||
|
||||
try:
|
||||
ret = self._request('GET', "/%s/%s" % (path, value)).json()
|
||||
ret = self._request('GET', f"/{path}/{value}").json()
|
||||
except ks_exceptions.NotFound:
|
||||
kwargs = {attr: value}
|
||||
try:
|
||||
|
@ -30,7 +30,7 @@ class APIv2(api.BaseAPI):
|
||||
"""Compute v2 API"""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(APIv2, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
# Overrides
|
||||
|
||||
@ -76,7 +76,7 @@ class APIv2(api.BaseAPI):
|
||||
"""
|
||||
|
||||
try:
|
||||
ret = self._request('GET', "/%s/%s" % (path, value)).json()
|
||||
ret = self._request('GET', f"/{path}/{value}").json()
|
||||
if isinstance(ret, dict):
|
||||
# strip off the enclosing dict
|
||||
key = list(ret.keys())[0]
|
||||
@ -136,7 +136,7 @@ class APIv2(api.BaseAPI):
|
||||
|
||||
return self._request(
|
||||
"POST",
|
||||
"/%s/%s/action" % (url, server['id']),
|
||||
"/{}/{}/action".format(url, server['id']),
|
||||
json={'addFloatingIp': body},
|
||||
)
|
||||
|
||||
@ -180,7 +180,7 @@ class APIv2(api.BaseAPI):
|
||||
url = "/os-floating-ips"
|
||||
|
||||
if floating_ip_id is not None:
|
||||
return self.delete('/%s/%s' % (url, floating_ip_id))
|
||||
return self.delete(f'/{url}/{floating_ip_id}')
|
||||
|
||||
return None
|
||||
|
||||
@ -248,7 +248,7 @@ class APIv2(api.BaseAPI):
|
||||
|
||||
return self._request(
|
||||
"POST",
|
||||
"/%s/%s/action" % (url, server['id']),
|
||||
"/{}/{}/action".format(url, server['id']),
|
||||
json={'removeFloatingIp': body},
|
||||
)
|
||||
|
||||
@ -316,7 +316,7 @@ class APIv2(api.BaseAPI):
|
||||
else:
|
||||
return self._request(
|
||||
"PUT",
|
||||
"/%s/%s" % (url, host),
|
||||
f"/{url}/{host}",
|
||||
json=params,
|
||||
).json()
|
||||
|
||||
@ -398,7 +398,7 @@ class APIv2(api.BaseAPI):
|
||||
value=network,
|
||||
)['id']
|
||||
if network is not None:
|
||||
return self.delete('/%s/%s' % (url, network))
|
||||
return self.delete(f'/{url}/{network}')
|
||||
|
||||
return None
|
||||
|
||||
@ -487,7 +487,7 @@ class APIv2(api.BaseAPI):
|
||||
value=security_group,
|
||||
)['id']
|
||||
if security_group is not None:
|
||||
return self.delete('/%s/%s' % (url, security_group))
|
||||
return self.delete(f'/{url}/{security_group}')
|
||||
|
||||
return None
|
||||
|
||||
@ -535,7 +535,7 @@ class APIv2(api.BaseAPI):
|
||||
|
||||
params = {}
|
||||
if search_opts is not None:
|
||||
params = dict((k, v) for (k, v) in search_opts.items() if v)
|
||||
params = {k: v for (k, v) in search_opts.items() if v}
|
||||
if limit:
|
||||
params['limit'] = limit
|
||||
if marker:
|
||||
@ -549,7 +549,7 @@ class APIv2(api.BaseAPI):
|
||||
security_group=None,
|
||||
# name=None,
|
||||
# description=None,
|
||||
**params
|
||||
**params,
|
||||
):
|
||||
"""Update a security group
|
||||
|
||||
@ -579,7 +579,7 @@ class APIv2(api.BaseAPI):
|
||||
security_group[k] = v
|
||||
return self._request(
|
||||
"PUT",
|
||||
"/%s/%s" % (url, security_group['id']),
|
||||
"/{}/{}".format(url, security_group['id']),
|
||||
json={'security_group': security_group},
|
||||
).json()['security_group']
|
||||
return None
|
||||
@ -648,6 +648,6 @@ class APIv2(api.BaseAPI):
|
||||
|
||||
url = "/os-security-group-rules"
|
||||
if security_group_rule_id is not None:
|
||||
return self.delete('/%s/%s' % (url, security_group_rule_id))
|
||||
return self.delete(f'/{url}/{security_group_rule_id}')
|
||||
|
||||
return None
|
||||
|
@ -22,7 +22,7 @@ class APIv1(api.BaseAPI):
|
||||
_endpoint_suffix = '/v1'
|
||||
|
||||
def __init__(self, endpoint=None, **kwargs):
|
||||
super(APIv1, self).__init__(endpoint=endpoint, **kwargs)
|
||||
super().__init__(endpoint=endpoint, **kwargs)
|
||||
|
||||
self.endpoint = self.endpoint.rstrip('/')
|
||||
self._munge_url()
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
"""Object Store v1 API Library"""
|
||||
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
@ -33,7 +32,7 @@ class APIv1(api.BaseAPI):
|
||||
"""Object Store v1 API"""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(APIv1, self).__init__(**kwargs)
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def container_create(
|
||||
self, container=None, public=False, storage_policy=None
|
||||
@ -257,11 +256,11 @@ class APIv1(api.BaseAPI):
|
||||
# object's name in the container.
|
||||
object_name_str = name if name else object
|
||||
|
||||
full_url = "%s/%s" % (
|
||||
full_url = "{}/{}".format(
|
||||
urllib.parse.quote(container),
|
||||
urllib.parse.quote(object_name_str),
|
||||
)
|
||||
with io.open(object, 'rb') as f:
|
||||
with open(object, 'rb') as f:
|
||||
response = self.create(
|
||||
full_url,
|
||||
method='PUT',
|
||||
|
@ -47,7 +47,7 @@ def _xform_compute_availability_zone(az, include_extra):
|
||||
for svc, state in services.items():
|
||||
info = copy.deepcopy(host_info)
|
||||
info['service_name'] = svc
|
||||
info['service_status'] = '%s %s %s' % (
|
||||
info['service_status'] = '{} {} {}'.format(
|
||||
'enabled' if state['active'] else 'disabled',
|
||||
':-)' if state['available'] else 'XXX',
|
||||
state['updated_at'],
|
||||
|
@ -51,7 +51,7 @@ class ClientManager(clientmanager.ClientManager):
|
||||
api_version=None,
|
||||
pw_func=None,
|
||||
):
|
||||
super(ClientManager, self).__init__(
|
||||
super().__init__(
|
||||
cli_options=cli_options,
|
||||
api_version=api_version,
|
||||
pw_func=pw_func,
|
||||
@ -94,7 +94,7 @@ class ClientManager(clientmanager.ClientManager):
|
||||
except TypeError as e:
|
||||
self._fallback_load_auth_plugin(e)
|
||||
|
||||
return super(ClientManager, self).setup_auth()
|
||||
return super().setup_auth()
|
||||
|
||||
def _fallback_load_auth_plugin(self, e):
|
||||
# NOTES(RuiChen): Hack to avoid auth plugins choking on data they don't
|
||||
@ -170,7 +170,9 @@ def get_plugin_modules(group):
|
||||
module = importlib.import_module(module_name)
|
||||
except Exception as err:
|
||||
sys.stderr.write(
|
||||
"WARNING: Failed to import plugin %s: %s.\n" % (ep.name, err)
|
||||
"WARNING: Failed to import plugin {}: {}.\n".format(
|
||||
ep.name, err
|
||||
)
|
||||
)
|
||||
continue
|
||||
|
||||
|
@ -27,7 +27,7 @@ class ShowConfiguration(command.ShowOne):
|
||||
auth_required = False
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowConfiguration, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
mask_group = parser.add_mutually_exclusive_group()
|
||||
mask_group.add_argument(
|
||||
"--mask",
|
||||
|
@ -148,7 +148,7 @@ class ShowExtension(command.ShowOne):
|
||||
_description = _("Show API extension")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowExtension, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'extension',
|
||||
metavar='<extension>',
|
||||
|
@ -28,7 +28,7 @@ class ShowLimits(command.Lister):
|
||||
_description = _("Show compute and block storage limits")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowLimits, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
type_group = parser.add_mutually_exclusive_group(required=True)
|
||||
type_group.add_argument(
|
||||
"--absolute",
|
||||
|
@ -29,7 +29,7 @@ class ListCommand(command.Lister):
|
||||
auth_required = False
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListCommand, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--group',
|
||||
metavar='<group-keyword>',
|
||||
@ -72,7 +72,7 @@ class ListModule(command.ShowOne):
|
||||
auth_required = False
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListModule, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--all',
|
||||
action='store_true',
|
||||
|
@ -16,7 +16,7 @@
|
||||
import sys
|
||||
|
||||
|
||||
class _ProgressBarBase(object):
|
||||
class _ProgressBarBase:
|
||||
"""A progress bar provider for a wrapped object.
|
||||
|
||||
Base abstract class used by specific class wrapper to show
|
||||
@ -39,7 +39,7 @@ class _ProgressBarBase(object):
|
||||
self._percent += size_read / self._totalsize
|
||||
# Output something like this: [==========> ] 49%
|
||||
sys.stdout.write(
|
||||
'\r[{0:<30}] {1:.0%}'.format(
|
||||
'\r[{:<30}] {:.0%}'.format(
|
||||
'=' * int(round(self._percent * 29)) + '>', self._percent
|
||||
)
|
||||
)
|
||||
|
@ -46,7 +46,7 @@ class ProjectCleanup(command.Command):
|
||||
_description = _("Clean resources associated with a project")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ProjectCleanup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
action_group = parser.add_mutually_exclusive_group()
|
||||
action_group.add_argument(
|
||||
'--dry-run',
|
||||
|
@ -383,7 +383,7 @@ class ListQuota(command.Lister):
|
||||
and ex.http_status <= 499
|
||||
):
|
||||
# Project not found, move on to next one
|
||||
LOG.warning("Project %s not found: %s" % (p, ex))
|
||||
LOG.warning(f"Project {p} not found: {ex}")
|
||||
continue
|
||||
else:
|
||||
raise
|
||||
@ -446,7 +446,7 @@ class ListQuota(command.Lister):
|
||||
except Exception as ex:
|
||||
if type(ex).__name__ == 'NotFound':
|
||||
# Project not found, move on to next one
|
||||
LOG.warning("Project %s not found: %s" % (p, ex))
|
||||
LOG.warning(f"Project {p} not found: {ex}")
|
||||
continue
|
||||
else:
|
||||
raise
|
||||
@ -500,7 +500,7 @@ class ListQuota(command.Lister):
|
||||
except Exception as ex:
|
||||
if type(ex).__name__ == 'NotFound':
|
||||
# Project not found, move on to next one
|
||||
LOG.warning("Project %s not found: %s" % (p, ex))
|
||||
LOG.warning(f"Project {p} not found: {ex}")
|
||||
continue
|
||||
else:
|
||||
raise
|
||||
@ -590,7 +590,7 @@ class SetQuota(common.NetDetectionMixin, command.Command):
|
||||
return rets
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetQuota, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'project',
|
||||
metavar='<project/class>',
|
||||
|
@ -23,7 +23,7 @@ class ShowVersions(command.Lister):
|
||||
_description = _("Show available versions of services")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowVersions, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
interface_group = parser.add_mutually_exclusive_group()
|
||||
interface_group.add_argument(
|
||||
"--all-interfaces",
|
||||
|
@ -36,7 +36,7 @@ class CreateAgent(command.ShowOne):
|
||||
"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateAgent, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument("os", metavar="<os>", help=_("Type of OS"))
|
||||
parser.add_argument(
|
||||
"architecture",
|
||||
@ -77,7 +77,7 @@ class DeleteAgent(command.Command):
|
||||
"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteAgent, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"id", metavar="<id>", nargs='+', help=_("ID of agent(s) to delete")
|
||||
)
|
||||
@ -114,7 +114,7 @@ class ListAgent(command.Lister):
|
||||
"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListAgent, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"--hypervisor",
|
||||
metavar="<hypervisor>",
|
||||
@ -155,7 +155,7 @@ class SetAgent(command.Command):
|
||||
"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetAgent, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument("id", metavar="<id>", help=_("ID of the agent"))
|
||||
parser.add_argument(
|
||||
"--agent-version",
|
||||
|
@ -55,7 +55,7 @@ class AddAggregateHost(command.ShowOne):
|
||||
_description = _("Add host to aggregate")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddAggregateHost, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'aggregate',
|
||||
metavar='<aggregate>',
|
||||
@ -88,7 +88,7 @@ class CreateAggregate(command.ShowOne):
|
||||
_description = _("Create a new aggregate")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateAggregate, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"name", metavar="<name>", help=_("New aggregate name")
|
||||
)
|
||||
@ -136,7 +136,7 @@ class DeleteAggregate(command.Command):
|
||||
_description = _("Delete existing aggregate(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteAggregate, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'aggregate',
|
||||
metavar='<aggregate>',
|
||||
@ -178,7 +178,7 @@ class ListAggregate(command.Lister):
|
||||
_description = _("List all aggregates")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListAggregate, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--long',
|
||||
action='store_true',
|
||||
@ -232,7 +232,7 @@ class RemoveAggregateHost(command.ShowOne):
|
||||
_description = _("Remove host from aggregate")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveAggregateHost, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'aggregate',
|
||||
metavar='<aggregate>',
|
||||
@ -265,7 +265,7 @@ class SetAggregate(command.Command):
|
||||
_description = _("Set aggregate properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetAggregate, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'aggregate',
|
||||
metavar='<aggregate>',
|
||||
@ -337,7 +337,7 @@ class ShowAggregate(command.ShowOne):
|
||||
_description = _("Display aggregate details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowAggregate, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'aggregate',
|
||||
metavar='<aggregate>',
|
||||
@ -366,7 +366,7 @@ class UnsetAggregate(command.Command):
|
||||
_description = _("Unset aggregate properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetAggregate, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"aggregate",
|
||||
metavar="<aggregate>",
|
||||
@ -403,7 +403,7 @@ class CacheImageForAggregate(command.Command):
|
||||
# not be anything to return.
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CacheImageForAggregate, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'aggregate',
|
||||
metavar='<aggregate>',
|
||||
|
@ -36,7 +36,7 @@ class ShowConsoleLog(command.Command):
|
||||
_description = _("Show server's console output")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowConsoleLog, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -78,7 +78,7 @@ class ShowConsoleURL(command.ShowOne):
|
||||
_description = _("Show server's remote console URL")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowConsoleURL, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
|
@ -58,7 +58,7 @@ class CreateFlavor(command.ShowOne):
|
||||
_description = _("Create new flavor")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"name", metavar="<flavor-name>", help=_("New flavor name")
|
||||
)
|
||||
@ -214,7 +214,7 @@ class DeleteFlavor(command.Command):
|
||||
_description = _("Delete flavor(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"flavor",
|
||||
metavar="<flavor>",
|
||||
@ -253,7 +253,7 @@ class ListFlavor(command.Lister):
|
||||
_description = _("List flavors")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
public_group = parser.add_mutually_exclusive_group()
|
||||
public_group.add_argument(
|
||||
"--public",
|
||||
@ -375,7 +375,7 @@ class SetFlavor(command.Command):
|
||||
_description = _("Set flavor properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"flavor",
|
||||
metavar="<flavor>",
|
||||
@ -491,7 +491,7 @@ class ShowFlavor(command.ShowOne):
|
||||
_description = _("Display flavor details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"flavor",
|
||||
metavar="<flavor>",
|
||||
@ -540,7 +540,7 @@ class UnsetFlavor(command.Command):
|
||||
_description = _("Unset flavor properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"flavor",
|
||||
metavar="<flavor>",
|
||||
|
@ -65,7 +65,7 @@ class SetHost(command.Command):
|
||||
_description = _("Set host properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetHost, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"host", metavar="<host>", help=_("Host to modify (name only)")
|
||||
)
|
||||
|
@ -16,7 +16,6 @@
|
||||
"""Keypair action implementations"""
|
||||
|
||||
import collections
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
|
||||
@ -77,7 +76,7 @@ class CreateKeypair(command.ShowOne):
|
||||
_description = _("Create new public or private key for server ssh access")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateKeypair, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name', metavar='<name>', help=_("New public or private key name")
|
||||
)
|
||||
@ -130,9 +129,9 @@ class CreateKeypair(command.ShowOne):
|
||||
if parsed_args.public_key:
|
||||
generated_keypair = None
|
||||
try:
|
||||
with io.open(os.path.expanduser(parsed_args.public_key)) as p:
|
||||
with open(os.path.expanduser(parsed_args.public_key)) as p:
|
||||
public_key = p.read()
|
||||
except IOError as e:
|
||||
except OSError as e:
|
||||
msg = _("Key file %(public_key)s not found: %(exception)s")
|
||||
raise exceptions.CommandError(
|
||||
msg
|
||||
@ -150,11 +149,11 @@ class CreateKeypair(command.ShowOne):
|
||||
# If user have us a file, save private key into specified file
|
||||
if parsed_args.private_key:
|
||||
try:
|
||||
with io.open(
|
||||
with open(
|
||||
os.path.expanduser(parsed_args.private_key), 'w+'
|
||||
) as p:
|
||||
p.write(generated_keypair.private_key)
|
||||
except IOError as e:
|
||||
except OSError as e:
|
||||
msg = _(
|
||||
"Key file %(private_key)s can not be saved: "
|
||||
"%(exception)s"
|
||||
@ -212,7 +211,7 @@ class DeleteKeypair(command.Command):
|
||||
_description = _("Delete public or private key(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteKeypair, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name',
|
||||
metavar='<key>',
|
||||
@ -388,7 +387,7 @@ class ShowKeypair(command.ShowOne):
|
||||
_description = _("Display key details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowKeypair, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name',
|
||||
metavar='<key>',
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
import argparse
|
||||
import getpass
|
||||
import io
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
@ -233,7 +232,7 @@ def _prep_server_detail(compute_client, image_client, server, refresh=True):
|
||||
image_id = image_info.get('id', '')
|
||||
try:
|
||||
image = image_client.get_image(image_id)
|
||||
info['image'] = "%s (%s)" % (image.name, image_id)
|
||||
info['image'] = f"{image.name} ({image_id})"
|
||||
except Exception:
|
||||
info['image'] = image_id
|
||||
else:
|
||||
@ -251,7 +250,7 @@ def _prep_server_detail(compute_client, image_client, server, refresh=True):
|
||||
flavor_id = flavor_info.get('id', '')
|
||||
try:
|
||||
flavor = utils.find_resource(compute_client.flavors, flavor_id)
|
||||
info['flavor'] = "%s (%s)" % (flavor.name, flavor_id)
|
||||
info['flavor'] = f"{flavor.name} ({flavor_id})"
|
||||
except Exception:
|
||||
info['flavor'] = flavor_id
|
||||
else: # microversion >= 2.47
|
||||
@ -358,7 +357,7 @@ class AddFixedIP(command.ShowOne):
|
||||
_description = _("Add fixed IP address to server")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddFixedIP, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"server",
|
||||
metavar="<server>",
|
||||
@ -551,7 +550,7 @@ class AddPort(command.Command):
|
||||
_description = _("Add port to server")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddPort, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"server",
|
||||
metavar="<server>",
|
||||
@ -605,7 +604,7 @@ class AddNetwork(command.Command):
|
||||
_description = _("Add network to server")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddNetwork, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"server",
|
||||
metavar="<server>",
|
||||
@ -660,7 +659,7 @@ class AddServerSecurityGroup(command.Command):
|
||||
_description = _("Add security group to server")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddServerSecurityGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -696,7 +695,7 @@ with status ``SHELVED`` or ``SHELVED_OFFLOADED``."""
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddServerVolume, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -1050,7 +1049,7 @@ class CreateServer(command.ShowOne):
|
||||
_description = _("Create a new server")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server_name',
|
||||
metavar='<server-name>',
|
||||
@ -1519,7 +1518,7 @@ class CreateServer(command.ShowOne):
|
||||
img_dict_items.extend(list(img.properties.items()))
|
||||
for key, value in img_dict_items:
|
||||
try:
|
||||
set([key, value])
|
||||
{key, value}
|
||||
except TypeError:
|
||||
if key != 'properties':
|
||||
LOG.debug(
|
||||
@ -1595,8 +1594,8 @@ class CreateServer(command.ShowOne):
|
||||
for f in parsed_args.file:
|
||||
dst, src = f.split('=', 1)
|
||||
try:
|
||||
files[dst] = io.open(src, 'rb')
|
||||
except IOError as e:
|
||||
files[dst] = open(src, 'rb')
|
||||
except OSError as e:
|
||||
msg = _("Can't open '%(source)s': %(exception)s")
|
||||
raise exceptions.CommandError(
|
||||
msg % {'source': src, 'exception': e}
|
||||
@ -1617,8 +1616,8 @@ class CreateServer(command.ShowOne):
|
||||
userdata = None
|
||||
if parsed_args.user_data:
|
||||
try:
|
||||
userdata = io.open(parsed_args.user_data)
|
||||
except IOError as e:
|
||||
userdata = open(parsed_args.user_data)
|
||||
except OSError as e:
|
||||
msg = _("Can't open '%(data)s': %(exception)s")
|
||||
raise exceptions.CommandError(
|
||||
msg % {'data': parsed_args.user_data, 'exception': e}
|
||||
@ -2065,7 +2064,7 @@ class CreateServerDump(command.Command):
|
||||
"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateServerDump, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -2085,7 +2084,7 @@ class DeleteServer(command.Command):
|
||||
_description = _("Delete server(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -2190,7 +2189,7 @@ class ListServer(command.Lister):
|
||||
_description = _("List servers")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--reservation-id',
|
||||
metavar='<reservation-id>',
|
||||
@ -2876,11 +2875,11 @@ class ListServer(command.Lister):
|
||||
# present on microversion 2.47 or later and 'flavor' won't be
|
||||
# present if there are infra failures
|
||||
if parsed_args.name_lookup_one_by_one or flavor_id:
|
||||
for f_id in set(
|
||||
for f_id in {
|
||||
s.flavor['id']
|
||||
for s in data
|
||||
if s.flavor and s.flavor.get('id')
|
||||
):
|
||||
}:
|
||||
try:
|
||||
flavors[f_id] = compute_client.find_flavor(
|
||||
f_id, ignore_missing=False
|
||||
@ -2988,7 +2987,7 @@ A non-admin user will not be able to execute actions."""
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(LockServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -3052,7 +3051,7 @@ revert to release the new server and restart the old one."""
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(MigrateServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -3226,7 +3225,7 @@ class PauseServer(command.Command):
|
||||
_description = _("Pause server(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(PauseServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -3309,7 +3308,7 @@ class RebuildServer(command.ShowOne):
|
||||
_description = _("Rebuild server")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RebuildServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -3564,8 +3563,8 @@ class RebuildServer(command.ShowOne):
|
||||
raise exceptions.CommandError(msg)
|
||||
|
||||
try:
|
||||
userdata = io.open(parsed_args.user_data)
|
||||
except IOError as e:
|
||||
userdata = open(parsed_args.user_data)
|
||||
except OSError as e:
|
||||
msg = _("Can't open '%(data)s': %(exception)s")
|
||||
raise exceptions.CommandError(
|
||||
msg % {'data': parsed_args.user_data, 'exception': e}
|
||||
@ -3700,7 +3699,7 @@ host."""
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(EvacuateServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -3807,7 +3806,7 @@ class RemoveFixedIP(command.Command):
|
||||
_description = _("Remove fixed IP address from server")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveFixedIP, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"server",
|
||||
metavar="<server>",
|
||||
@ -3869,7 +3868,7 @@ class RemovePort(command.Command):
|
||||
_description = _("Remove port from server")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemovePort, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"server",
|
||||
metavar="<server>",
|
||||
@ -3908,7 +3907,7 @@ class RemoveNetwork(command.Command):
|
||||
_description = _("Remove all ports of a network from server")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveNetwork, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"server",
|
||||
metavar="<server>",
|
||||
@ -3948,7 +3947,7 @@ class RemoveServerSecurityGroup(command.Command):
|
||||
_description = _("Remove security group from server")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveServerSecurityGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -3984,7 +3983,7 @@ volume from a server with status ``SHELVED`` or ``SHELVED_OFFLOADED``."""
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveServerVolume, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -4026,7 +4025,7 @@ server booted from a volume."""
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RescueServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -4078,7 +4077,7 @@ release the new server and restart the old one."""
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ResizeServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
phase_group = parser.add_mutually_exclusive_group()
|
||||
parser.add_argument(
|
||||
'server',
|
||||
@ -4176,7 +4175,7 @@ Confirm (verify) success of resize operation and release the old server."""
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ResizeConfirm, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -4225,7 +4224,7 @@ one."""
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ResizeRevert, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -4269,7 +4268,7 @@ class RestoreServer(command.Command):
|
||||
_description = _("Restore server(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RestoreServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -4292,7 +4291,7 @@ class ResumeServer(command.Command):
|
||||
_description = _("Resume server(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ResumeServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -4315,7 +4314,7 @@ class SetServer(command.Command):
|
||||
_description = _("Set server properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -4589,7 +4588,7 @@ information for the server."""
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -4657,7 +4656,7 @@ class SshServer(command.Command):
|
||||
_description = _("SSH to server")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SshServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -4809,7 +4808,7 @@ class SshServer(command.Command):
|
||||
)
|
||||
|
||||
cmd = ' '.join(['ssh', ip_address] + args)
|
||||
LOG.debug("ssh command: {cmd}".format(cmd=cmd))
|
||||
LOG.debug(f"ssh command: {cmd}")
|
||||
# we intentionally pass through user-provided arguments and run this in
|
||||
# the user's shell
|
||||
os.system(cmd) # nosec: B605
|
||||
@ -4899,7 +4898,7 @@ class SuspendServer(command.Command):
|
||||
_description = _("Suspend server(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SuspendServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -4945,7 +4944,7 @@ class UnpauseServer(command.Command):
|
||||
_description = _("Unpause server(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnpauseServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -4968,7 +4967,7 @@ class UnrescueServer(command.Command):
|
||||
_description = _("Restore server from rescue mode")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnrescueServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -4988,7 +4987,7 @@ class UnsetServer(command.Command):
|
||||
_description = _("Unset server properties and tags")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetServer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
|
@ -33,7 +33,7 @@ class CreateServerBackup(command.ShowOne):
|
||||
}
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateServerBackup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
|
@ -56,7 +56,7 @@ class CreateServerGroup(command.ShowOne):
|
||||
_description = _("Create a new server group.")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateServerGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name',
|
||||
metavar='<name>',
|
||||
@ -143,7 +143,7 @@ class DeleteServerGroup(command.Command):
|
||||
_description = _("Delete existing server group(s).")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteServerGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server_group',
|
||||
metavar='<server-group>',
|
||||
@ -178,7 +178,7 @@ class ListServerGroup(command.Lister):
|
||||
_description = _("List all server groups.")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListServerGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--all-projects',
|
||||
action='store_true',
|
||||
@ -255,7 +255,7 @@ class ShowServerGroup(command.ShowOne):
|
||||
_description = _("Display server group details.")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowServerGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server_group',
|
||||
metavar='<server-group>',
|
||||
|
@ -38,7 +38,7 @@ class CreateServerImage(command.ShowOne):
|
||||
}
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateServerImage, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
|
@ -28,7 +28,7 @@ class ListMigration(command.Lister):
|
||||
_description = _("""List server migrations""")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListMigration, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--server',
|
||||
metavar='<server>',
|
||||
@ -381,7 +381,7 @@ class AbortMigration(command.Command):
|
||||
"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AbortMigration, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
@ -448,7 +448,7 @@ class ForceCompleteMigration(command.Command):
|
||||
"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ForceCompleteMigration, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server>',
|
||||
|
@ -32,7 +32,7 @@ class DeleteService(command.Command):
|
||||
_description = _("Delete compute service(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteService, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"service",
|
||||
metavar="<service>",
|
||||
@ -85,7 +85,7 @@ deployment."""
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListService, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"--host",
|
||||
metavar="<host>",
|
||||
@ -147,7 +147,7 @@ class SetService(command.Command):
|
||||
_description = _("Set compute service properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetService, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument("host", metavar="<host>", help=_("Name of host"))
|
||||
parser.add_argument(
|
||||
"service",
|
||||
|
@ -109,7 +109,7 @@ class ListUsage(command.Lister):
|
||||
_description = _("List resource usage per project")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListUsage, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"--start",
|
||||
metavar="<start>",
|
||||
@ -210,7 +210,7 @@ class ShowUsage(command.ShowOne):
|
||||
_description = _("Show resource usage for a single project")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowUsage, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"--project",
|
||||
metavar="<project>",
|
||||
|
@ -39,7 +39,7 @@ class EndpointsColumn(cliff_columns.FormattableColumn):
|
||||
for endpoint_type in ['publicURL', 'internalURL', 'adminURL']:
|
||||
url = ep.get(endpoint_type)
|
||||
if url:
|
||||
ret += " %s: %s\n" % (endpoint_type, url)
|
||||
ret += f" {endpoint_type}: {url}\n"
|
||||
return ret
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ class ShowCatalog(command.ShowOne):
|
||||
_description = _("Display service catalog details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowCatalog, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'service',
|
||||
metavar='<service>',
|
||||
|
@ -32,7 +32,7 @@ class CreateEC2Creds(command.ShowOne):
|
||||
_description = _("Create EC2 credentials")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateEC2Creds, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--project',
|
||||
metavar='<project>',
|
||||
@ -86,7 +86,7 @@ class DeleteEC2Creds(command.Command):
|
||||
_description = _("Delete EC2 credentials")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteEC2Creds, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'access_keys',
|
||||
metavar='<access-key>',
|
||||
@ -138,7 +138,7 @@ class ListEC2Creds(command.Lister):
|
||||
_description = _("List EC2 credentials")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListEC2Creds, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--user',
|
||||
metavar='<user>',
|
||||
@ -179,7 +179,7 @@ class ShowEC2Creds(command.ShowOne):
|
||||
_description = _("Display EC2 credentials details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowEC2Creds, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'access_key',
|
||||
metavar='<access-key>',
|
||||
|
@ -32,7 +32,7 @@ class CreateEndpoint(command.ShowOne):
|
||||
_description = _("Create new endpoint")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateEndpoint, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'service',
|
||||
metavar='<service>',
|
||||
@ -83,7 +83,7 @@ class DeleteEndpoint(command.Command):
|
||||
_description = _("Delete endpoint(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteEndpoint, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'endpoints',
|
||||
metavar='<endpoint-id>',
|
||||
@ -121,7 +121,7 @@ class ListEndpoint(command.Lister):
|
||||
_description = _("List endpoints")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListEndpoint, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--long',
|
||||
action='store_true',
|
||||
@ -167,7 +167,7 @@ class ShowEndpoint(command.ShowOne):
|
||||
_description = _("Display endpoint details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowEndpoint, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'endpoint_or_service',
|
||||
metavar='<endpoint>',
|
||||
|
@ -34,7 +34,7 @@ class CreateProject(command.ShowOne):
|
||||
_description = _("Create new project")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateProject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name',
|
||||
metavar='<project-name>',
|
||||
@ -108,7 +108,7 @@ class DeleteProject(command.Command):
|
||||
_description = _("Delete project(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteProject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'projects',
|
||||
metavar='<project>',
|
||||
@ -150,7 +150,7 @@ class ListProject(command.Lister):
|
||||
_description = _("List projects")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListProject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--long',
|
||||
action='store_true',
|
||||
@ -193,7 +193,7 @@ class SetProject(command.Command):
|
||||
_description = _("Set project properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetProject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'project',
|
||||
metavar='<project>',
|
||||
@ -264,7 +264,7 @@ class ShowProject(command.ShowOne):
|
||||
_description = _("Display project details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowProject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'project',
|
||||
metavar='<project>',
|
||||
@ -322,7 +322,7 @@ class UnsetProject(command.Command):
|
||||
_description = _("Unset project properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetProject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'project',
|
||||
metavar='<project>',
|
||||
|
@ -32,7 +32,7 @@ class AddRole(command.ShowOne):
|
||||
_description = _("Add role to project:user")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'role',
|
||||
metavar='<role>',
|
||||
@ -75,7 +75,7 @@ class CreateRole(command.ShowOne):
|
||||
_description = _("Create new role")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'role_name',
|
||||
metavar='<name>',
|
||||
@ -111,7 +111,7 @@ class DeleteRole(command.Command):
|
||||
_description = _("Delete role(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'roles',
|
||||
metavar='<role>',
|
||||
@ -176,7 +176,7 @@ class RemoveRole(command.Command):
|
||||
_description = _("Remove role from project : user")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'role',
|
||||
metavar='<role>',
|
||||
@ -211,7 +211,7 @@ class ShowRole(command.ShowOne):
|
||||
_description = _("Display role details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'role',
|
||||
metavar='<role>',
|
||||
|
@ -24,7 +24,7 @@ class ListRoleAssignment(command.Lister):
|
||||
_description = _("List role assignments")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListRoleAssignment, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--user',
|
||||
metavar='<user>',
|
||||
|
@ -32,7 +32,7 @@ class CreateService(command.ShowOne):
|
||||
_description = _("Create new service")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateService, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'type',
|
||||
metavar='<type>',
|
||||
@ -71,7 +71,7 @@ class DeleteService(command.Command):
|
||||
_description = _("Delete service(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteService, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'services',
|
||||
metavar='<service>',
|
||||
@ -110,7 +110,7 @@ class ListService(command.Lister):
|
||||
_description = _("List services")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListService, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--long',
|
||||
action='store_true',
|
||||
@ -135,7 +135,7 @@ class ShowService(command.ShowOne):
|
||||
_description = _("Display service details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowService, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'service',
|
||||
metavar='<service>',
|
||||
|
@ -28,7 +28,7 @@ class IssueToken(command.ShowOne):
|
||||
required_scope = False
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(IssueToken, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@ -56,7 +56,7 @@ class RevokeToken(command.Command):
|
||||
_description = _("Revoke existing token")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RevokeToken, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'token',
|
||||
metavar='<token>',
|
||||
|
@ -42,7 +42,7 @@ class ProjectColumn(cliff_columns.FormattableColumn):
|
||||
"""
|
||||
|
||||
def __init__(self, value, project_cache=None):
|
||||
super(ProjectColumn, self).__init__(value)
|
||||
super().__init__(value)
|
||||
self.project_cache = project_cache or {}
|
||||
|
||||
def human_readable(self):
|
||||
@ -59,7 +59,7 @@ class CreateUser(command.ShowOne):
|
||||
_description = _("Create new user")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateUser, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name',
|
||||
metavar='<name>',
|
||||
@ -162,7 +162,7 @@ class DeleteUser(command.Command):
|
||||
_description = _("Delete user(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteUser, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'users',
|
||||
metavar='<user>',
|
||||
@ -205,7 +205,7 @@ class ListUser(command.Lister):
|
||||
_description = _("List users")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListUser, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--project',
|
||||
metavar='<project>',
|
||||
@ -294,7 +294,7 @@ class SetUser(command.Command):
|
||||
_description = _("Set user properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetUser, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'user',
|
||||
metavar='<user>',
|
||||
@ -392,7 +392,7 @@ class ShowUser(command.ShowOne):
|
||||
_description = _("Display user details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowUser, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'user',
|
||||
metavar='<user>',
|
||||
|
@ -32,7 +32,7 @@ class DeleteAccessRule(command.Command):
|
||||
_description = _("Delete access rule(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteAccessRule, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'access_rule',
|
||||
metavar='<access-rule>',
|
||||
@ -73,7 +73,7 @@ class ListAccessRule(command.Lister):
|
||||
_description = _("List access rules")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListAccessRule, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--user',
|
||||
metavar='<user>',
|
||||
@ -110,7 +110,7 @@ class ShowAccessRule(command.ShowOne):
|
||||
_description = _("Display access rule details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowAccessRule, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'access_rule',
|
||||
metavar='<access-rule>',
|
||||
|
@ -34,7 +34,7 @@ class CreateApplicationCredential(command.ShowOne):
|
||||
_description = _("Create new application credential")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateApplicationCredential, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name',
|
||||
metavar='<name>',
|
||||
@ -137,7 +137,7 @@ class CreateApplicationCredential(command.ShowOne):
|
||||
try:
|
||||
with open(parsed_args.access_rules) as f:
|
||||
access_rules = json.load(f)
|
||||
except IOError:
|
||||
except OSError:
|
||||
msg = _(
|
||||
"Access rules is not valid JSON string or file does"
|
||||
" not exist."
|
||||
@ -171,7 +171,7 @@ class DeleteApplicationCredential(command.Command):
|
||||
_description = _("Delete application credentials(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteApplicationCredential, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'application_credential',
|
||||
metavar='<application-credential>',
|
||||
@ -213,7 +213,7 @@ class ListApplicationCredential(command.Lister):
|
||||
_description = _("List application credentials")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListApplicationCredential, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--user',
|
||||
metavar='<user>',
|
||||
@ -250,7 +250,7 @@ class ShowApplicationCredential(command.ShowOne):
|
||||
_description = _("Display application credential details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowApplicationCredential, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'application_credential',
|
||||
metavar='<application-credential>',
|
||||
|
@ -34,7 +34,7 @@ class EndpointsColumn(cliff_columns.FormattableColumn):
|
||||
for ep in self._value:
|
||||
region = ep.get('region_id') or ep.get('region') or '<none>'
|
||||
ret += region + '\n'
|
||||
ret += " %s: %s\n" % (ep['interface'], ep['url'])
|
||||
ret += " {}: {}\n".format(ep['interface'], ep['url'])
|
||||
return ret
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ class ShowCatalog(command.ShowOne):
|
||||
_description = _("Display service catalog details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowCatalog, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'service',
|
||||
metavar='<service>',
|
||||
|
@ -31,7 +31,7 @@ class CreateConsumer(command.ShowOne):
|
||||
_description = _("Create new consumer")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateConsumer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--description',
|
||||
metavar='<description>',
|
||||
@ -52,7 +52,7 @@ class DeleteConsumer(command.Command):
|
||||
_description = _("Delete consumer(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteConsumer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'consumer',
|
||||
metavar='<consumer>',
|
||||
@ -111,7 +111,7 @@ class SetConsumer(command.Command):
|
||||
_description = _("Set consumer properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetConsumer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'consumer',
|
||||
metavar='<consumer>',
|
||||
@ -142,7 +142,7 @@ class ShowConsumer(command.ShowOne):
|
||||
_description = _("Display consumer details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowConsumer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'consumer',
|
||||
metavar='<consumer>',
|
||||
|
@ -32,7 +32,7 @@ class CreateCredential(command.ShowOne):
|
||||
_description = _("Create new credential")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateCredential, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'user',
|
||||
metavar='<user>',
|
||||
@ -85,7 +85,7 @@ class DeleteCredential(command.Command):
|
||||
_description = _("Delete credential(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteCredential, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'credential',
|
||||
metavar='<credential-id>',
|
||||
@ -122,7 +122,7 @@ class ListCredential(command.Lister):
|
||||
_description = _("List credentials")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListCredential, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--user',
|
||||
metavar='<user>',
|
||||
@ -171,7 +171,7 @@ class SetCredential(command.Command):
|
||||
_description = _("Set credential properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetCredential, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'credential',
|
||||
metavar='<credential-id>',
|
||||
@ -232,7 +232,7 @@ class ShowCredential(command.ShowOne):
|
||||
_description = _("Display credential details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowCredential, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'credential',
|
||||
metavar='<credential-id>',
|
||||
|
@ -33,7 +33,7 @@ class CreateDomain(command.ShowOne):
|
||||
_description = _("Create new domain")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateDomain, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name',
|
||||
metavar='<domain-name>',
|
||||
@ -96,7 +96,7 @@ class DeleteDomain(command.Command):
|
||||
_description = _("Delete domain(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteDomain, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'domain',
|
||||
metavar='<domain>',
|
||||
@ -135,7 +135,7 @@ class ListDomain(command.Lister):
|
||||
_description = _("List domains")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListDomain, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--name',
|
||||
metavar='<name>',
|
||||
@ -175,7 +175,7 @@ class SetDomain(command.Command):
|
||||
_description = _("Set domain properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetDomain, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'domain',
|
||||
metavar='<domain>',
|
||||
@ -232,7 +232,7 @@ class ShowDomain(command.ShowOne):
|
||||
_description = _("Display domain details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowDomain, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'domain',
|
||||
metavar='<domain>',
|
||||
|
@ -60,7 +60,7 @@ class CreateEC2Creds(command.ShowOne):
|
||||
_description = _("Create EC2 credentials")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateEC2Creds, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--project',
|
||||
metavar='<project>',
|
||||
@ -122,7 +122,7 @@ class DeleteEC2Creds(command.Command):
|
||||
_description = _("Delete EC2 credentials")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteEC2Creds, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'access_key',
|
||||
metavar='<access-key>',
|
||||
@ -166,7 +166,7 @@ class ListEC2Creds(command.Lister):
|
||||
_description = _("List EC2 credentials")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListEC2Creds, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--user',
|
||||
metavar='<user>',
|
||||
@ -200,7 +200,7 @@ class ShowEC2Creds(command.ShowOne):
|
||||
_description = _("Display EC2 credentials details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowEC2Creds, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'access_key',
|
||||
metavar='<access-key>',
|
||||
|
@ -39,7 +39,7 @@ class AddProjectToEndpoint(command.Command):
|
||||
_description = _("Associate a project to an endpoint")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddProjectToEndpoint, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'endpoint',
|
||||
metavar='<endpoint>',
|
||||
@ -75,7 +75,7 @@ class CreateEndpoint(command.ShowOne):
|
||||
_description = _("Create new endpoint")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateEndpoint, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'service',
|
||||
metavar='<service>',
|
||||
@ -137,7 +137,7 @@ class DeleteEndpoint(command.Command):
|
||||
_description = _("Delete endpoint(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteEndpoint, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'endpoint',
|
||||
metavar='<endpoint-id>',
|
||||
@ -177,7 +177,7 @@ class ListEndpoint(command.Lister):
|
||||
_description = _("List endpoints")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListEndpoint, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--service',
|
||||
metavar='<service>',
|
||||
@ -285,7 +285,7 @@ class RemoveProjectFromEndpoint(command.Command):
|
||||
_description = _("Dissociate a project from an endpoint")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveProjectFromEndpoint, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'endpoint',
|
||||
metavar='<endpoint>',
|
||||
@ -321,7 +321,7 @@ class SetEndpoint(command.Command):
|
||||
_description = _("Set endpoint properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetEndpoint, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'endpoint',
|
||||
metavar='<endpoint-id>',
|
||||
@ -393,7 +393,7 @@ class ShowEndpoint(command.ShowOne):
|
||||
_description = _("Display endpoint details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowEndpoint, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'endpoint',
|
||||
metavar='<endpoint>',
|
||||
|
@ -27,7 +27,7 @@ from openstackclient.identity import common
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class _FiltersReader(object):
|
||||
class _FiltersReader:
|
||||
_description = _("Helper class capable of reading filters from files")
|
||||
|
||||
def _read_filters(self, path):
|
||||
@ -63,7 +63,7 @@ class AddProjectToEndpointGroup(command.Command):
|
||||
_description = _("Add a project to an endpoint group")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddProjectToEndpointGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'endpointgroup',
|
||||
metavar='<endpoint-group>',
|
||||
@ -97,7 +97,7 @@ class CreateEndpointGroup(command.ShowOne, _FiltersReader):
|
||||
_description = _("Create new endpoint group")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateEndpointGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name',
|
||||
metavar='<name>',
|
||||
@ -137,7 +137,7 @@ class DeleteEndpointGroup(command.Command):
|
||||
_description = _("Delete endpoint group(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteEndpointGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'endpointgroup',
|
||||
metavar='<endpoint-group>',
|
||||
@ -177,7 +177,7 @@ class ListEndpointGroup(command.Lister):
|
||||
_description = _("List endpoint groups")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListEndpointGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
list_group = parser.add_mutually_exclusive_group()
|
||||
list_group.add_argument(
|
||||
'--endpointgroup',
|
||||
@ -242,9 +242,7 @@ class RemoveProjectFromEndpointGroup(command.Command):
|
||||
_description = _("Remove project from endpoint group")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveProjectFromEndpointGroup, self).get_parser(
|
||||
prog_name
|
||||
)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'endpointgroup',
|
||||
metavar='<endpoint-group>',
|
||||
@ -278,7 +276,7 @@ class SetEndpointGroup(command.Command, _FiltersReader):
|
||||
_description = _("Set endpoint group properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetEndpointGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'endpointgroup',
|
||||
metavar='<endpoint-group>',
|
||||
@ -324,7 +322,7 @@ class ShowEndpointGroup(command.ShowOne):
|
||||
_description = _("Display endpoint group details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowEndpointGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'endpointgroup',
|
||||
metavar='<endpointgroup>',
|
||||
|
@ -30,7 +30,7 @@ class CreateProtocol(command.ShowOne):
|
||||
_description = _("Create new federation protocol")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateProtocol, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'federation_protocol',
|
||||
metavar='<name>',
|
||||
@ -79,7 +79,7 @@ class DeleteProtocol(command.Command):
|
||||
_description = _("Delete federation protocol(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteProtocol, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'federation_protocol',
|
||||
metavar='<federation-protocol>',
|
||||
@ -129,7 +129,7 @@ class ListProtocols(command.Lister):
|
||||
_description = _("List federation protocols")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListProtocols, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--identity-provider',
|
||||
metavar='<identity-provider>',
|
||||
@ -158,7 +158,7 @@ class SetProtocol(command.Command):
|
||||
_description = _("Set federation protocol properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetProtocol, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'federation_protocol',
|
||||
metavar='<name>',
|
||||
@ -202,7 +202,7 @@ class ShowProtocol(command.ShowOne):
|
||||
_description = _("Display federation protocol details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowProtocol, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'federation_protocol',
|
||||
metavar='<federation-protocol>',
|
||||
|
@ -33,7 +33,7 @@ class AddUserToGroup(command.Command):
|
||||
_description = _("Add user to group")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddUserToGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'group',
|
||||
metavar='<group>',
|
||||
@ -93,7 +93,7 @@ class CheckUserInGroup(command.Command):
|
||||
_description = _("Check user membership in group")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CheckUserInGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'group',
|
||||
metavar='<group>',
|
||||
@ -141,7 +141,7 @@ class CreateGroup(command.ShowOne):
|
||||
_description = _("Create new group")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name',
|
||||
metavar='<group-name>',
|
||||
@ -194,7 +194,7 @@ class DeleteGroup(command.Command):
|
||||
_description = _("Delete group(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'groups',
|
||||
metavar='<group>',
|
||||
@ -241,7 +241,7 @@ class ListGroup(command.Lister):
|
||||
_description = _("List groups")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--domain',
|
||||
metavar='<domain>',
|
||||
@ -304,7 +304,7 @@ class RemoveUserFromGroup(command.Command):
|
||||
_description = _("Remove user from group")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveUserFromGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'group',
|
||||
metavar='<group>',
|
||||
@ -364,7 +364,7 @@ class SetGroup(command.Command):
|
||||
_description = _("Set group properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'group',
|
||||
metavar='<group>',
|
||||
@ -405,7 +405,7 @@ class ShowGroup(command.ShowOne):
|
||||
_description = _("Display group details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'group',
|
||||
metavar='<group>',
|
||||
|
@ -31,7 +31,7 @@ class CreateIdentityProvider(command.ShowOne):
|
||||
_description = _("Create new identity provider")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateIdentityProvider, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'identity_provider_id',
|
||||
metavar='<name>',
|
||||
@ -146,7 +146,7 @@ class DeleteIdentityProvider(command.Command):
|
||||
_description = _("Delete identity provider(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteIdentityProvider, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'identity_provider',
|
||||
metavar='<identity-provider>',
|
||||
@ -184,7 +184,7 @@ class ListIdentityProvider(command.Lister):
|
||||
_description = _("List identity providers")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListIdentityProvider, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--id',
|
||||
metavar='<id>',
|
||||
@ -226,7 +226,7 @@ class SetIdentityProvider(command.Command):
|
||||
_description = _("Set identity provider properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetIdentityProvider, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'identity_provider',
|
||||
metavar='<identity-provider>',
|
||||
@ -326,7 +326,7 @@ class ShowIdentityProvider(command.ShowOne):
|
||||
_description = _("Display identity provider details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowIdentityProvider, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'identity_provider',
|
||||
metavar='<identity-provider>',
|
||||
|
@ -51,7 +51,7 @@ class CreateImpliedRole(command.ShowOne):
|
||||
_description = _("Creates an association between prior and implied roles")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateImpliedRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'role',
|
||||
metavar='<role>',
|
||||
@ -81,7 +81,7 @@ class DeleteImpliedRole(command.Command):
|
||||
_description = _("Deletes an association between prior and implied roles")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteImpliedRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'role',
|
||||
metavar='<role>',
|
||||
@ -113,7 +113,7 @@ class ListImpliedRole(command.Lister):
|
||||
]
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListImpliedRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
|
@ -29,7 +29,7 @@ class CreateLimit(command.ShowOne):
|
||||
_description = _("Create a limit")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateLimit, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--description',
|
||||
metavar='<description>',
|
||||
@ -108,7 +108,7 @@ class ListLimit(command.Lister):
|
||||
_description = _("List limits")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListLimit, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--service',
|
||||
metavar='<service>',
|
||||
@ -190,7 +190,7 @@ class ShowLimit(command.ShowOne):
|
||||
_description = _("Display limit details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowLimit, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'limit_id',
|
||||
metavar='<limit-id>',
|
||||
@ -209,7 +209,7 @@ class SetLimit(command.ShowOne):
|
||||
_description = _("Update information about a limit")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetLimit, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'limit_id',
|
||||
metavar='<limit-id>',
|
||||
@ -247,7 +247,7 @@ class DeleteLimit(command.Command):
|
||||
_description = _("Delete a limit")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteLimit, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'limit_id',
|
||||
metavar='<limit-id>',
|
||||
|
@ -28,7 +28,7 @@ from openstackclient.i18n import _
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class _RulesReader(object):
|
||||
class _RulesReader:
|
||||
_description = _("Helper class capable of reading rules from files")
|
||||
|
||||
def _read_rules(self, path):
|
||||
@ -101,7 +101,7 @@ class CreateMapping(command.ShowOne, _RulesReader):
|
||||
_description = _("Create new mapping")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateMapping, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'mapping',
|
||||
metavar='<name>',
|
||||
@ -134,7 +134,7 @@ class DeleteMapping(command.Command):
|
||||
_description = _("Delete mapping(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteMapping, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'mapping',
|
||||
metavar='<mapping>',
|
||||
@ -185,7 +185,7 @@ class SetMapping(command.Command, _RulesReader):
|
||||
_description = _("Set mapping properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetMapping, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'mapping',
|
||||
metavar='<name>',
|
||||
@ -218,7 +218,7 @@ class ShowMapping(command.ShowOne):
|
||||
_description = _("Display mapping details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowMapping, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'mapping',
|
||||
metavar='<mapping>',
|
||||
|
@ -31,7 +31,7 @@ class CreatePolicy(command.ShowOne):
|
||||
_description = _("Create new policy")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreatePolicy, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--type',
|
||||
metavar='<type>',
|
||||
@ -65,7 +65,7 @@ class DeletePolicy(command.Command):
|
||||
_description = _("Delete policy(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeletePolicy, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'policy',
|
||||
metavar='<policy>',
|
||||
@ -105,7 +105,7 @@ class ListPolicy(command.Lister):
|
||||
_description = _("List policies")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListPolicy, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--long',
|
||||
action='store_true',
|
||||
@ -139,7 +139,7 @@ class SetPolicy(command.Command):
|
||||
_description = _("Set policy properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetPolicy, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'policy',
|
||||
metavar='<policy>',
|
||||
@ -177,7 +177,7 @@ class ShowPolicy(command.ShowOne):
|
||||
_description = _("Display policy details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowPolicy, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'policy',
|
||||
metavar='<policy>',
|
||||
|
@ -34,7 +34,7 @@ class CreateProject(command.ShowOne):
|
||||
_description = _("Create new project")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateProject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name',
|
||||
metavar='<project-name>',
|
||||
@ -146,7 +146,7 @@ class DeleteProject(command.Command):
|
||||
_description = _("Delete project(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteProject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'projects',
|
||||
metavar='<project>',
|
||||
@ -200,7 +200,7 @@ class ListProject(command.Lister):
|
||||
_description = _("List projects")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListProject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--domain',
|
||||
metavar='<domain>',
|
||||
@ -314,7 +314,7 @@ class SetProject(command.Command):
|
||||
_description = _("Set project properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetProject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'project',
|
||||
metavar='<project>',
|
||||
@ -389,7 +389,7 @@ class ShowProject(command.ShowOne):
|
||||
_description = _("Display project details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowProject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'project',
|
||||
metavar='<project>',
|
||||
|
@ -29,7 +29,7 @@ class CreateRegion(command.ShowOne):
|
||||
_description = _("Create new region")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateRegion, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
# NOTE(stevemar): The API supports an optional region ID, but that
|
||||
# seems like poor UX, we will only support user-defined IDs.
|
||||
parser.add_argument(
|
||||
@ -68,7 +68,7 @@ class DeleteRegion(command.Command):
|
||||
_description = _("Delete region(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteRegion, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'region',
|
||||
metavar='<region-id>',
|
||||
@ -106,7 +106,7 @@ class ListRegion(command.Lister):
|
||||
_description = _("List regions")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListRegion, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--parent-region',
|
||||
metavar='<region-id>',
|
||||
@ -142,7 +142,7 @@ class SetRegion(command.Command):
|
||||
_description = _("Set region properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetRegion, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'region',
|
||||
metavar='<region-id>',
|
||||
@ -176,7 +176,7 @@ class ShowRegion(command.ShowOne):
|
||||
_description = _("Display region details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowRegion, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'region',
|
||||
metavar='<region-id>',
|
||||
|
@ -29,7 +29,7 @@ class CreateRegisteredLimit(command.ShowOne):
|
||||
_description = _("Create a registered limit")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateRegisteredLimit, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--description',
|
||||
metavar='<description>',
|
||||
@ -98,7 +98,7 @@ class DeleteRegisteredLimit(command.Command):
|
||||
_description = _("Delete a registered limit")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteRegisteredLimit, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'registered_limit_id',
|
||||
metavar='<registered-limit-id>',
|
||||
@ -140,7 +140,7 @@ class ListRegisteredLimit(command.Lister):
|
||||
_description = _("List registered limits")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListRegisteredLimit, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--service',
|
||||
metavar='<service>',
|
||||
@ -207,7 +207,7 @@ class SetRegisteredLimit(command.ShowOne):
|
||||
_description = _("Update information about a registered limit")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetRegisteredLimit, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'registered_limit_id',
|
||||
metavar='<registered-limit-id>',
|
||||
@ -298,7 +298,7 @@ class ShowRegisteredLimit(command.ShowOne):
|
||||
_description = _("Display registered limit details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowRegisteredLimit, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'registered_limit_id',
|
||||
metavar='<registered-limit-id>',
|
||||
|
@ -134,7 +134,7 @@ class AddRole(command.Command):
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'role',
|
||||
metavar='<role>',
|
||||
@ -179,7 +179,7 @@ class CreateRole(command.ShowOne):
|
||||
_description = _("Create new role")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name',
|
||||
metavar='<role-name>',
|
||||
@ -241,7 +241,7 @@ class DeleteRole(command.Command):
|
||||
_description = _("Delete role(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'roles',
|
||||
metavar='<role>',
|
||||
@ -293,7 +293,7 @@ class ListRole(command.Lister):
|
||||
_description = _("List roles")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--domain',
|
||||
metavar='<domain>',
|
||||
@ -336,7 +336,7 @@ class RemoveRole(command.Command):
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'role',
|
||||
metavar='<role>',
|
||||
@ -383,7 +383,7 @@ class SetRole(command.Command):
|
||||
_description = _("Set role properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'role',
|
||||
metavar='<role>',
|
||||
@ -433,7 +433,7 @@ class ShowRole(command.ShowOne):
|
||||
_description = _("Display role details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowRole, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'role',
|
||||
metavar='<role>',
|
||||
|
@ -24,7 +24,7 @@ class ListRoleAssignment(command.Lister):
|
||||
_description = _("List role assignments")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListRoleAssignment, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--effective',
|
||||
action="store_true",
|
||||
|
@ -32,7 +32,7 @@ class CreateService(command.ShowOne):
|
||||
_description = _("Create new service")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateService, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'type',
|
||||
metavar='<type>',
|
||||
@ -83,7 +83,7 @@ class DeleteService(command.Command):
|
||||
_description = _("Delete service(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteService, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'service',
|
||||
metavar='<service>',
|
||||
@ -121,7 +121,7 @@ class ListService(command.Lister):
|
||||
_description = _("List services")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListService, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--long',
|
||||
action='store_true',
|
||||
@ -146,7 +146,7 @@ class SetService(command.Command):
|
||||
_description = _("Set service properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetService, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'service',
|
||||
metavar='<service>',
|
||||
@ -203,7 +203,7 @@ class ShowService(command.ShowOne):
|
||||
_description = _("Display service details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowService, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'service',
|
||||
metavar='<service>',
|
||||
|
@ -29,7 +29,7 @@ class CreateServiceProvider(command.ShowOne):
|
||||
_description = _("Create new service provider")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateServiceProvider, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'service_provider_id',
|
||||
metavar='<name>',
|
||||
@ -94,7 +94,7 @@ class DeleteServiceProvider(command.Command):
|
||||
_description = _("Delete service provider(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteServiceProvider, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'service_provider',
|
||||
metavar='<service-provider>',
|
||||
@ -153,7 +153,7 @@ class SetServiceProvider(command.Command):
|
||||
_description = _("Set service provider properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetServiceProvider, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'service_provider',
|
||||
metavar='<service-provider>',
|
||||
@ -213,7 +213,7 @@ class ShowServiceProvider(command.ShowOne):
|
||||
_description = _("Display service provider details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowServiceProvider, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'service_provider',
|
||||
metavar='<service-provider>',
|
||||
|
@ -27,7 +27,7 @@ class AuthorizeRequestToken(command.ShowOne):
|
||||
_description = _("Authorize a request token")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AuthorizeRequestToken, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--request-key',
|
||||
metavar='<request-key>',
|
||||
@ -70,7 +70,7 @@ class CreateAccessToken(command.ShowOne):
|
||||
_description = _("Create an access token")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateAccessToken, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--consumer-key',
|
||||
metavar='<consumer-key>',
|
||||
@ -119,7 +119,7 @@ class CreateRequestToken(command.ShowOne):
|
||||
_description = _("Create a request token")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateRequestToken, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--consumer-key',
|
||||
metavar='<consumer-key>',
|
||||
@ -178,7 +178,7 @@ class IssueToken(command.ShowOne):
|
||||
required_scope = False
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(IssueToken, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@ -214,7 +214,7 @@ class RevokeToken(command.Command):
|
||||
_description = _("Revoke existing token")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RevokeToken, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'token',
|
||||
metavar='<token>',
|
||||
|
@ -32,7 +32,7 @@ class CreateTrust(command.ShowOne):
|
||||
_description = _("Create new trust")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateTrust, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'trustor',
|
||||
metavar='<trustor-user>',
|
||||
@ -150,7 +150,7 @@ class DeleteTrust(command.Command):
|
||||
_description = _("Delete trust(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteTrust, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'trust',
|
||||
metavar='<trust>',
|
||||
@ -300,7 +300,7 @@ class ShowTrust(command.ShowOne):
|
||||
_description = _("Display trust details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowTrust, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'trust',
|
||||
metavar='<trust>',
|
||||
|
@ -188,7 +188,7 @@ class CreateUser(command.ShowOne):
|
||||
_description = _("Create new user")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateUser, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name',
|
||||
metavar='<name>',
|
||||
@ -308,7 +308,7 @@ class DeleteUser(command.Command):
|
||||
_description = _("Delete user(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteUser, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'users',
|
||||
metavar='<user>',
|
||||
@ -368,7 +368,7 @@ class ListUser(command.Lister):
|
||||
_description = _("List users")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListUser, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--domain',
|
||||
metavar='<domain>',
|
||||
@ -488,7 +488,7 @@ class SetUser(command.Command):
|
||||
_description = _("Set user properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetUser, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'user',
|
||||
metavar='<user>',
|
||||
@ -621,7 +621,7 @@ class SetPasswordUser(command.Command):
|
||||
required_scope = False
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetPasswordUser, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--password',
|
||||
metavar='<new-password>',
|
||||
@ -686,7 +686,7 @@ class ShowUser(command.ShowOne):
|
||||
_description = _("Display user details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowUser, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'user',
|
||||
metavar='<user>',
|
||||
|
@ -16,7 +16,6 @@
|
||||
"""Image V1 Action Implementations"""
|
||||
|
||||
import argparse
|
||||
import io
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
@ -110,7 +109,7 @@ class CreateImage(command.ShowOne):
|
||||
_description = _("Create/upload an image")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateImage, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"name",
|
||||
metavar="<image-name>",
|
||||
@ -320,7 +319,7 @@ class CreateImage(command.ShowOne):
|
||||
elif parsed_args.file:
|
||||
# Send an open file handle to glanceclient so it will
|
||||
# do a chunked transfer
|
||||
kwargs["data"] = io.open(parsed_args.file, "rb")
|
||||
kwargs["data"] = open(parsed_args.file, "rb")
|
||||
else:
|
||||
# Read file from stdin
|
||||
if not sys.stdin.isatty():
|
||||
@ -363,7 +362,7 @@ class DeleteImage(command.Command):
|
||||
_description = _("Delete image(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteImage, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"images",
|
||||
metavar="<image>",
|
||||
@ -403,7 +402,7 @@ class ListImage(command.Lister):
|
||||
_description = _("List available images")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListImage, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
public_group = parser.add_mutually_exclusive_group()
|
||||
public_group.add_argument(
|
||||
"--public",
|
||||
@ -534,7 +533,7 @@ class SaveImage(command.Command):
|
||||
_description = _("Save an image locally")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SaveImage, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"--file",
|
||||
metavar="<filename>",
|
||||
@ -564,7 +563,7 @@ class SetImage(command.Command):
|
||||
_description = _("Set image properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetImage, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"image",
|
||||
metavar="<image>",
|
||||
@ -771,7 +770,7 @@ class SetImage(command.Command):
|
||||
elif parsed_args.file:
|
||||
# Send an open file handle to glanceclient so it will
|
||||
# do a chunked transfer
|
||||
kwargs["data"] = io.open(parsed_args.file, "rb")
|
||||
kwargs["data"] = open(parsed_args.file, "rb")
|
||||
else:
|
||||
# Read file from stdin
|
||||
if sys.stdin.isatty() is not True:
|
||||
@ -809,7 +808,7 @@ class ShowImage(command.ShowOne):
|
||||
_description = _("Display image details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowImage, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"--human-readable",
|
||||
default=False,
|
||||
|
@ -64,7 +64,7 @@ class ShowTask(command.ShowOne):
|
||||
_description = _('Display task details')
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowTask, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
|
||||
parser.add_argument(
|
||||
'task',
|
||||
|
@ -132,7 +132,7 @@ class NetDetectionMixin(metaclass=abc.ABCMeta):
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
LOG.debug('get_parser(%s)', prog_name)
|
||||
parser = super(NetDetectionMixin, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser = self.update_parser_common(parser)
|
||||
LOG.debug('common parser: %s', parser)
|
||||
if self.is_neutron or self.is_docs_build:
|
||||
@ -318,7 +318,7 @@ class NeutronCommandWithExtraArgs(command.Command):
|
||||
return result
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(NeutronCommandWithExtraArgs, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--extra-property',
|
||||
metavar='type=<property_type>,name=<property_name>,'
|
||||
|
@ -27,7 +27,7 @@ def transform_compute_security_group_rule(sg_rule):
|
||||
elif from_port is None and to_port is None:
|
||||
port_range = {'port_range': ""}
|
||||
else:
|
||||
port_range = {'port_range': "%s:%s" % (from_port, to_port)}
|
||||
port_range = {'port_range': f"{from_port}:{to_port}"}
|
||||
info.update(port_range)
|
||||
if 'cidr' in info['ip_range']:
|
||||
info['ip_range'] = info['ip_range']['cidr']
|
||||
@ -76,7 +76,7 @@ def str2dict(strdict):
|
||||
msg = _("missing value for key '%s'")
|
||||
raise exceptions.CommandError(msg % kv)
|
||||
else:
|
||||
kvlist[i - 1] = "%s;%s" % (kvlist[i - 1], kv)
|
||||
kvlist[i - 1] = f"{kvlist[i - 1]};{kv}"
|
||||
for kv in kvlist:
|
||||
key, sep, value = kv.partition(':')
|
||||
result[key] = value
|
||||
|
@ -61,7 +61,7 @@ class CreateAddressGroup(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Create a new Address Group")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateAddressGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name', metavar="<name>", help=_("New address group name")
|
||||
)
|
||||
@ -108,7 +108,7 @@ class DeleteAddressGroup(command.Command):
|
||||
_description = _("Delete address group(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteAddressGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'address_group',
|
||||
metavar="<address-group>",
|
||||
@ -148,7 +148,7 @@ class ListAddressGroup(command.Lister):
|
||||
_description = _("List address groups")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListAddressGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
|
||||
parser.add_argument(
|
||||
'--name',
|
||||
@ -213,7 +213,7 @@ class SetAddressGroup(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set address group properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetAddressGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'address_group',
|
||||
metavar="<address-group>",
|
||||
@ -265,7 +265,7 @@ class ShowAddressGroup(command.ShowOne):
|
||||
_description = _("Display address group details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowAddressGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'address_group',
|
||||
metavar="<address-group>",
|
||||
@ -289,7 +289,7 @@ class UnsetAddressGroup(command.Command):
|
||||
_description = _("Unset address group properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetAddressGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'address_group',
|
||||
metavar="<address-group>",
|
||||
|
@ -62,7 +62,7 @@ class CreateAddressScope(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Create a new Address Scope")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateAddressScope, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name', metavar="<name>", help=_("New address scope name")
|
||||
)
|
||||
@ -113,7 +113,7 @@ class DeleteAddressScope(command.Command):
|
||||
_description = _("Delete address scope(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteAddressScope, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'address_scope',
|
||||
metavar="<address-scope>",
|
||||
@ -155,7 +155,7 @@ class ListAddressScope(command.Lister):
|
||||
_description = _("List address scopes")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListAddressScope, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
|
||||
parser.add_argument(
|
||||
'--name',
|
||||
@ -249,7 +249,7 @@ class SetAddressScope(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set address scope properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetAddressScope, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'address_scope',
|
||||
metavar="<address-scope>",
|
||||
@ -294,7 +294,7 @@ class ShowAddressScope(command.ShowOne):
|
||||
_description = _("Display address scope details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowAddressScope, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'address_scope',
|
||||
metavar="<address-scope>",
|
||||
|
@ -440,7 +440,7 @@ class SetFloatingIP(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set floating IP Properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetFloatingIP, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'floating_ip',
|
||||
metavar='<floating-ip>',
|
||||
@ -548,7 +548,7 @@ class UnsetFloatingIP(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Unset floating IP Properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetFloatingIP, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'floating_ip',
|
||||
metavar='<floating-ip>',
|
||||
|
@ -98,9 +98,7 @@ class CreateFloatingIPPortForwarding(
|
||||
_description = _("Create floating IP port forwarding")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateFloatingIPPortForwarding, self).get_parser(
|
||||
prog_name
|
||||
)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--internal-ip-address',
|
||||
required=True,
|
||||
@ -201,9 +199,7 @@ class DeleteFloatingIPPortForwarding(command.Command):
|
||||
_description = _("Delete floating IP port forwarding")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteFloatingIPPortForwarding, self).get_parser(
|
||||
prog_name
|
||||
)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'floating_ip',
|
||||
metavar='<floating-ip>',
|
||||
@ -256,9 +252,7 @@ class ListFloatingIPPortForwarding(command.Lister):
|
||||
_description = _("List floating IP port forwarding")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListFloatingIPPortForwarding, self).get_parser(
|
||||
prog_name
|
||||
)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'floating_ip',
|
||||
metavar='<floating-ip>',
|
||||
@ -358,7 +352,7 @@ class SetFloatingIPPortForwarding(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set floating IP Port Forwarding Properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetFloatingIPPortForwarding, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'floating_ip',
|
||||
metavar='<floating-ip>',
|
||||
@ -458,9 +452,7 @@ class ShowFloatingIPPortForwarding(command.ShowOne):
|
||||
_description = _("Display floating IP Port Forwarding details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowFloatingIPPortForwarding, self).get_parser(
|
||||
prog_name
|
||||
)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'floating_ip',
|
||||
metavar='<floating-ip>',
|
||||
|
@ -39,7 +39,7 @@ class ListIPAvailability(command.Lister):
|
||||
_description = _("List IP availability for network")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListIPAvailability, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--ip-version',
|
||||
type=int,
|
||||
@ -105,7 +105,7 @@ class ShowIPAvailability(command.ShowOne):
|
||||
_description = _("Show network IP availability details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowIPAvailability, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'network',
|
||||
metavar="<network>",
|
||||
|
@ -49,7 +49,7 @@ class CreateConntrackHelper(command.ShowOne):
|
||||
_description = _("Create a new L3 conntrack helper")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateConntrackHelper, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar='<router>',
|
||||
@ -95,7 +95,7 @@ class DeleteConntrackHelper(command.Command):
|
||||
_description = _("Delete L3 conntrack helper")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteConntrackHelper, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar='<router>',
|
||||
@ -143,7 +143,7 @@ class ListConntrackHelper(command.Lister):
|
||||
_description = _("List L3 conntrack helpers")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListConntrackHelper, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar='<router>',
|
||||
@ -206,7 +206,7 @@ class SetConntrackHelper(command.Command):
|
||||
_description = _("Set L3 conntrack helper properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetConntrackHelper, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar='<router>',
|
||||
@ -253,7 +253,7 @@ class ShowConntrackHelper(command.ShowOne):
|
||||
_description = _("Display L3 conntrack helper details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowConntrackHelper, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar='<router>',
|
||||
|
@ -694,7 +694,7 @@ class SetNetwork(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set network properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetNetwork, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'network',
|
||||
metavar="<network>",
|
||||
@ -838,7 +838,7 @@ class UnsetNetwork(common.NeutronUnsetCommandWithExtraArgs):
|
||||
_description = _("Unset network properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetNetwork, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'network',
|
||||
metavar="<network>",
|
||||
|
@ -60,7 +60,7 @@ class AddNetworkToAgent(command.Command):
|
||||
_description = _("Add network to an agent")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddNetworkToAgent, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--dhcp',
|
||||
action='store_true',
|
||||
@ -99,7 +99,7 @@ class AddRouterToAgent(command.Command):
|
||||
_description = _("Add router to an agent")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddRouterToAgent, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--l3', action='store_true', help=_('Add router to an L3 agent')
|
||||
)
|
||||
@ -128,7 +128,7 @@ class DeleteNetworkAgent(command.Command):
|
||||
_description = _("Delete network agent(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteNetworkAgent, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'network_agent',
|
||||
metavar="<network-agent>",
|
||||
@ -168,7 +168,7 @@ class ListNetworkAgent(command.Lister):
|
||||
_description = _("List network agents")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListNetworkAgent, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--agent-type',
|
||||
metavar='<agent-type>',
|
||||
@ -293,7 +293,7 @@ class RemoveNetworkFromAgent(command.Command):
|
||||
_description = _("Remove network from an agent.")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveNetworkFromAgent, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--dhcp',
|
||||
action='store_true',
|
||||
@ -331,7 +331,7 @@ class RemoveRouterFromAgent(command.Command):
|
||||
_description = _("Remove router from an agent")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveRouterFromAgent, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--l3',
|
||||
action='store_true',
|
||||
@ -364,7 +364,7 @@ class SetNetworkAgent(command.Command):
|
||||
_description = _("Set network agent properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetNetworkAgent, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'network_agent',
|
||||
metavar="<network-agent>",
|
||||
@ -403,7 +403,7 @@ class ShowNetworkAgent(command.ShowOne):
|
||||
_description = _("Display network agent details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowNetworkAgent, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'network_agent',
|
||||
metavar="<network-agent>",
|
||||
|
@ -65,7 +65,7 @@ class CreateAutoAllocatedTopology(command.ShowOne):
|
||||
_description = _("Create the auto allocated topology for project")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateAutoAllocatedTopology, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--project',
|
||||
metavar='<project>',
|
||||
@ -126,7 +126,7 @@ class DeleteAutoAllocatedTopology(command.Command):
|
||||
_description = _("Delete auto allocated topology for project")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteAutoAllocatedTopology, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--project',
|
||||
metavar='<project>',
|
||||
|
@ -63,7 +63,7 @@ class AddNetworkFlavorToProfile(command.Command):
|
||||
_description = _("Add a service profile to a network flavor")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddNetworkFlavorToProfile, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'flavor', metavar="<flavor>", help=_("Network flavor (name or ID)")
|
||||
)
|
||||
@ -93,7 +93,7 @@ class CreateNetworkFlavor(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Create new network flavor")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateNetworkFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name', metavar="<name>", help=_("Name for the flavor")
|
||||
)
|
||||
@ -146,7 +146,7 @@ class DeleteNetworkFlavor(command.Command):
|
||||
_description = _("Delete network flavors")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteNetworkFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
|
||||
parser.add_argument(
|
||||
'flavor',
|
||||
@ -214,9 +214,7 @@ class RemoveNetworkFlavorFromProfile(command.Command):
|
||||
_description = _("Remove service profile from network flavor")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveNetworkFlavorFromProfile, self).get_parser(
|
||||
prog_name
|
||||
)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'flavor', metavar="<flavor>", help=_("Network flavor (name or ID)")
|
||||
)
|
||||
@ -246,7 +244,7 @@ class SetNetworkFlavor(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set network flavor properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetNetworkFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'flavor',
|
||||
metavar="<flavor>",
|
||||
@ -290,7 +288,7 @@ class ShowNetworkFlavor(command.ShowOne):
|
||||
_description = _("Display network flavor details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowNetworkFlavor, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'flavor',
|
||||
metavar='<flavor>',
|
||||
|
@ -67,7 +67,7 @@ class CreateNetworkFlavorProfile(
|
||||
_description = _("Create new network flavor profile")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateNetworkFlavorProfile, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--project',
|
||||
metavar="<project>",
|
||||
@ -129,7 +129,7 @@ class DeleteNetworkFlavorProfile(command.Command):
|
||||
_description = _("Delete network flavor profile")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteNetworkFlavorProfile, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
|
||||
parser.add_argument(
|
||||
'flavor_profile',
|
||||
@ -206,7 +206,7 @@ class SetNetworkFlavorProfile(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set network flavor profile properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetNetworkFlavorProfile, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'flavor_profile',
|
||||
metavar="<flavor-profile>",
|
||||
@ -263,7 +263,7 @@ class ShowNetworkFlavorProfile(command.ShowOne):
|
||||
_description = _("Display network flavor profile details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowNetworkFlavorProfile, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'flavor_profile',
|
||||
metavar='<flavor-profile>',
|
||||
|
@ -65,7 +65,7 @@ class CreateMeter(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Create network meter")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateMeter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
|
||||
parser.add_argument(
|
||||
'--description',
|
||||
@ -118,7 +118,7 @@ class DeleteMeter(command.Command):
|
||||
_description = _("Delete network meter")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteMeter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
|
||||
parser.add_argument(
|
||||
'meter',
|
||||
@ -187,7 +187,7 @@ class ShowMeter(command.ShowOne):
|
||||
_description = _("Show network meter")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowMeter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'meter', metavar='<meter>', help=_('Meter to display (name or ID)')
|
||||
)
|
||||
|
@ -69,7 +69,7 @@ class CreateMeterRule(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Create a new meter rule")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateMeterRule, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
|
||||
parser.add_argument(
|
||||
'--project',
|
||||
@ -146,7 +146,7 @@ class DeleteMeterRule(command.Command):
|
||||
_description = _("Delete meter rule(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteMeterRule, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
|
||||
parser.add_argument(
|
||||
'meter_rule_id',
|
||||
@ -222,7 +222,7 @@ class ShowMeterRule(command.ShowOne):
|
||||
_description = _("Display meter rules details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowMeterRule, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'meter_rule_id',
|
||||
metavar='<meter-rule-id>',
|
||||
|
@ -85,7 +85,7 @@ class CreateNetworkQosPolicy(
|
||||
_description = _("Create a QoS policy")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateNetworkQosPolicy, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name', metavar='<name>', help=_("Name of QoS policy to create")
|
||||
)
|
||||
@ -144,7 +144,7 @@ class DeleteNetworkQosPolicy(command.Command):
|
||||
_description = _("Delete Qos Policy(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteNetworkQosPolicy, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'policy',
|
||||
metavar="<qos-policy>",
|
||||
@ -185,7 +185,7 @@ class ListNetworkQosPolicy(command.Lister):
|
||||
_description = _("List QoS policies")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListNetworkQosPolicy, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--project',
|
||||
metavar='<project>',
|
||||
@ -244,7 +244,7 @@ class SetNetworkQosPolicy(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set QoS policy properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetNetworkQosPolicy, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'policy',
|
||||
metavar="<qos-policy>",
|
||||
@ -296,7 +296,7 @@ class ShowNetworkQosPolicy(command.ShowOne):
|
||||
_description = _("Display QoS policy details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowNetworkQosPolicy, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'policy',
|
||||
metavar="<qos-policy>",
|
||||
|
@ -159,10 +159,10 @@ def _get_item_properties(item, fields):
|
||||
|
||||
def _rule_action_call(client, action, rule_type):
|
||||
rule_type = rule_type.replace('-', '_')
|
||||
func_name = '%(action)s_qos_%(rule_type)s_rule' % {
|
||||
'action': action,
|
||||
'rule_type': rule_type,
|
||||
}
|
||||
func_name = '{action}_qos_{rule_type}_rule'.format(
|
||||
action=action,
|
||||
rule_type=rule_type,
|
||||
)
|
||||
return getattr(client, func_name)
|
||||
|
||||
|
||||
@ -243,7 +243,7 @@ class CreateNetworkQosRule(
|
||||
_description = _("Create new Network QoS rule")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateNetworkQosRule, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'qos_policy',
|
||||
metavar='<qos-policy>',
|
||||
@ -289,7 +289,7 @@ class DeleteNetworkQosRule(command.Command):
|
||||
_description = _("Delete Network QoS rule")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteNetworkQosRule, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'qos_policy',
|
||||
metavar='<qos-policy>',
|
||||
@ -326,7 +326,7 @@ class ListNetworkQosRule(command.Lister):
|
||||
_description = _("List Network QoS rules")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListNetworkQosRule, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'qos_policy',
|
||||
metavar='<qos-policy>',
|
||||
@ -372,7 +372,7 @@ class SetNetworkQosRule(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set Network QoS rule properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetNetworkQosRule, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'qos_policy',
|
||||
metavar='<qos-policy>',
|
||||
@ -418,7 +418,7 @@ class ShowNetworkQosRule(command.ShowOne):
|
||||
_description = _("Display Network QoS rule details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowNetworkQosRule, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'qos_policy',
|
||||
metavar='<qos-policy>',
|
||||
|
@ -83,7 +83,7 @@ class ShowNetworkQosRuleType(command.ShowOne):
|
||||
_description = _("Show details about supported QoS rule type")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowNetworkQosRuleType, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'rule_type',
|
||||
metavar="<qos-rule-type-name>",
|
||||
|
@ -96,7 +96,7 @@ class CreateNetworkRBAC(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Create network RBAC policy")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateNetworkRBAC, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'rbac_object',
|
||||
metavar="<rbac-object>",
|
||||
@ -182,7 +182,7 @@ class DeleteNetworkRBAC(command.Command):
|
||||
_description = _("Delete network RBAC policy(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteNetworkRBAC, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'rbac_policy',
|
||||
metavar="<rbac-policy>",
|
||||
@ -221,7 +221,7 @@ class ListNetworkRBAC(command.Lister):
|
||||
_description = _("List network RBAC policies")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListNetworkRBAC, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--type',
|
||||
metavar='<type>',
|
||||
@ -315,7 +315,7 @@ class SetNetworkRBAC(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set network RBAC policy properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetNetworkRBAC, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'rbac_policy',
|
||||
metavar="<rbac-policy>",
|
||||
@ -364,7 +364,7 @@ class ShowNetworkRBAC(command.ShowOne):
|
||||
_description = _("Display network RBAC policy details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowNetworkRBAC, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'rbac_policy',
|
||||
metavar="<rbac-policy>",
|
||||
|
@ -39,7 +39,7 @@ class CreateNetworkSegment(
|
||||
_description = _("Create new network segment")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateNetworkSegment, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name', metavar='<name>', help=_('New network segment name')
|
||||
)
|
||||
@ -109,7 +109,7 @@ class DeleteNetworkSegment(command.Command):
|
||||
_description = _("Delete network segment(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteNetworkSegment, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'network_segment',
|
||||
metavar='<network-segment>',
|
||||
@ -150,7 +150,7 @@ class ListNetworkSegment(command.Lister):
|
||||
_description = _("List network segments")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListNetworkSegment, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--long',
|
||||
action='store_true',
|
||||
@ -213,7 +213,7 @@ class SetNetworkSegment(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set network segment properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetNetworkSegment, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'network_segment',
|
||||
metavar='<network-segment>',
|
||||
@ -251,7 +251,7 @@ class ShowNetworkSegment(command.ShowOne):
|
||||
_description = _("Display network segment details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowNetworkSegment, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'network_segment',
|
||||
metavar='<network-segment>',
|
||||
|
@ -44,9 +44,7 @@ def _get_ranges(item):
|
||||
for a, b in itertools.groupby(enumerate(item), lambda xy: xy[1] - xy[0]):
|
||||
b = list(b)
|
||||
yield (
|
||||
"%s-%s" % (b[0][1], b[-1][1])
|
||||
if b[0][1] != b[-1][1]
|
||||
else str(b[0][1])
|
||||
f"{b[0][1]}-{b[-1][1]}" if b[0][1] != b[-1][1] else str(b[0][1])
|
||||
)
|
||||
|
||||
|
||||
@ -100,7 +98,7 @@ class CreateNetworkSegmentRange(
|
||||
_description = _("Create new network segment range")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateNetworkSegmentRange, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
shared_group = parser.add_mutually_exclusive_group()
|
||||
shared_group.add_argument(
|
||||
"--private",
|
||||
@ -256,7 +254,7 @@ class DeleteNetworkSegmentRange(command.Command):
|
||||
_description = _("Delete network segment range(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteNetworkSegmentRange, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'network_segment_range',
|
||||
metavar='<network-segment-range>',
|
||||
@ -309,7 +307,7 @@ class ListNetworkSegmentRange(command.Lister):
|
||||
_description = _("List network segment ranges")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListNetworkSegmentRange, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--long',
|
||||
action='store_true',
|
||||
@ -425,7 +423,7 @@ class SetNetworkSegmentRange(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set network segment range properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetNetworkSegmentRange, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'network_segment_range',
|
||||
metavar='<network-segment-range>',
|
||||
@ -490,7 +488,7 @@ class ShowNetworkSegmentRange(command.ShowOne):
|
||||
_description = _("Display network segment range details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowNetworkSegmentRange, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'network_segment_range',
|
||||
metavar='<network-segment-range>',
|
||||
|
@ -43,7 +43,7 @@ class CreateNetworkTrunk(command.ShowOne):
|
||||
"""Create a network trunk for a given project"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateNetworkTrunk, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name', metavar='<name>', help=_("Name of the trunk to create")
|
||||
)
|
||||
@ -100,7 +100,7 @@ class DeleteNetworkTrunk(command.Command):
|
||||
"""Delete a given network trunk"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteNetworkTrunk, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'trunk',
|
||||
metavar="<trunk>",
|
||||
@ -138,7 +138,7 @@ class ListNetworkTrunk(command.Lister):
|
||||
"""List all network trunks"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListNetworkTrunk, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--long',
|
||||
action='store_true',
|
||||
@ -177,7 +177,7 @@ class SetNetworkTrunk(command.Command):
|
||||
"""Set network trunk properties"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetNetworkTrunk, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'trunk', metavar="<trunk>", help=_("Trunk to modify (name or ID)")
|
||||
)
|
||||
@ -242,7 +242,7 @@ class ShowNetworkTrunk(command.ShowOne):
|
||||
"""Show information of a given network trunk"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowNetworkTrunk, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'trunk', metavar="<trunk>", help=_("Trunk to display (name or ID)")
|
||||
)
|
||||
@ -263,7 +263,7 @@ class ListNetworkSubport(command.Lister):
|
||||
"""List all subports for a given network trunk"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListNetworkSubport, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--trunk',
|
||||
required=True,
|
||||
@ -294,7 +294,7 @@ class UnsetNetworkTrunk(command.Command):
|
||||
"""Unset subports from a given network trunk"""
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetNetworkTrunk, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'trunk',
|
||||
metavar="<trunk>",
|
||||
|
@ -444,7 +444,7 @@ class CreatePort(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Create a new port")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreatePort, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
|
||||
parser.add_argument(
|
||||
'--network',
|
||||
@ -681,7 +681,7 @@ class DeletePort(command.Command):
|
||||
_description = _("Delete port(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeletePort, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'port',
|
||||
metavar="<port>",
|
||||
@ -723,7 +723,7 @@ class ListPort(command.Lister):
|
||||
_description = _("List ports")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListPort, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--device-owner',
|
||||
metavar='<device-owner>',
|
||||
@ -896,7 +896,7 @@ class SetPort(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set port properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetPort, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
_add_updatable_args(parser)
|
||||
admin_group = parser.add_mutually_exclusive_group()
|
||||
admin_group.add_argument(
|
||||
@ -1135,7 +1135,7 @@ class ShowPort(command.ShowOne):
|
||||
_description = _("Display port details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowPort, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'port', metavar="<port>", help=_("Port to display (name or ID)")
|
||||
)
|
||||
@ -1155,7 +1155,7 @@ class UnsetPort(common.NeutronUnsetCommandWithExtraArgs):
|
||||
_description = _("Unset port properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetPort, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--fixed-ip',
|
||||
metavar='subnet=<subnet>,ip-address=<ip-address>',
|
||||
|
@ -301,7 +301,7 @@ class AddPortToRouter(command.Command):
|
||||
_description = _("Add a port to a router")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddPortToRouter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar='<router>',
|
||||
@ -325,7 +325,7 @@ class AddSubnetToRouter(command.Command):
|
||||
_description = _("Add a subnet to a router")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddSubnetToRouter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar='<router>',
|
||||
@ -351,7 +351,7 @@ class AddExtraRoutesToRouter(command.ShowOne):
|
||||
_description = _("Add extra static routes to a router's routing table.")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(AddExtraRoutesToRouter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar='<router>',
|
||||
@ -402,7 +402,7 @@ class RemoveExtraRoutesFromRouter(command.ShowOne):
|
||||
)
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveExtraRoutesFromRouter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar='<router>',
|
||||
@ -453,7 +453,7 @@ class CreateRouter(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Create a new router")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateRouter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name', metavar='<name>', help=_("New router name")
|
||||
)
|
||||
@ -627,7 +627,7 @@ class DeleteRouter(command.Command):
|
||||
_description = _("Delete router(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteRouter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar="<router>",
|
||||
@ -669,7 +669,7 @@ class ListRouter(command.Lister):
|
||||
_description = _("List routers")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListRouter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--name',
|
||||
metavar='<name>',
|
||||
@ -813,7 +813,7 @@ class RemovePortFromRouter(command.Command):
|
||||
_description = _("Remove a port from a router")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemovePortFromRouter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar='<router>',
|
||||
@ -839,7 +839,7 @@ class RemoveSubnetFromRouter(command.Command):
|
||||
_description = _("Remove a subnet from a router")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(RemoveSubnetFromRouter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar='<router>',
|
||||
@ -869,7 +869,7 @@ class SetRouter(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set router properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetRouter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar="<router>",
|
||||
@ -1103,7 +1103,7 @@ class ShowRouter(command.ShowOne):
|
||||
_description = _("Display router details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowRouter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'router',
|
||||
metavar="<router>",
|
||||
@ -1139,7 +1139,7 @@ class UnsetRouter(common.NeutronUnsetCommandWithExtraArgs):
|
||||
_description = _("Unset router properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetRouter, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--route',
|
||||
metavar='destination=<subnet>,gateway=<ip-address>',
|
||||
|
@ -434,7 +434,7 @@ class UnsetSecurityGroup(command.Command):
|
||||
_description = _("Unset security group properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetSecurityGroup, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'group',
|
||||
metavar="<group>",
|
||||
|
@ -46,7 +46,7 @@ def _update_arguments(obj_list, parsed_args_list, option):
|
||||
class AllocationPoolsColumn(cliff_columns.FormattableColumn):
|
||||
def human_readable(self):
|
||||
pool_formatted = [
|
||||
'%s-%s' % (pool.get('start', ''), pool.get('end', ''))
|
||||
'{}-{}'.format(pool.get('start', ''), pool.get('end', ''))
|
||||
for pool in self._value
|
||||
]
|
||||
return ','.join(pool_formatted)
|
||||
@ -292,7 +292,7 @@ class CreateSubnet(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Create a subnet")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateSubnet, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name', metavar='<name>', help=_("New subnet name")
|
||||
)
|
||||
@ -436,7 +436,7 @@ class DeleteSubnet(command.Command):
|
||||
_description = _("Delete subnet(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteSubnet, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'subnet',
|
||||
metavar="<subnet>",
|
||||
@ -478,7 +478,7 @@ class ListSubnet(command.Lister):
|
||||
_description = _("List subnets")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListSubnet, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--long',
|
||||
action='store_true',
|
||||
@ -651,7 +651,7 @@ class SetSubnet(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set subnet properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetSubnet, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'subnet',
|
||||
metavar="<subnet>",
|
||||
@ -744,7 +744,7 @@ class ShowSubnet(command.ShowOne):
|
||||
_description = _("Display subnet details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowSubnet, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'subnet',
|
||||
metavar="<subnet>",
|
||||
@ -765,7 +765,7 @@ class UnsetSubnet(common.NeutronUnsetCommandWithExtraArgs):
|
||||
_description = _("Unset subnet properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetSubnet, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--allocation-pool',
|
||||
metavar='start=<ip-address>,end=<ip-address>',
|
||||
|
@ -155,7 +155,7 @@ class CreateSubnetPool(command.ShowOne, common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Create subnet pool")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateSubnetPool, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'name', metavar='<name>', help=_("Name of the new subnet pool")
|
||||
)
|
||||
@ -226,7 +226,7 @@ class DeleteSubnetPool(command.Command):
|
||||
_description = _("Delete subnet pool(s)")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteSubnetPool, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'subnet_pool',
|
||||
metavar='<subnet-pool>',
|
||||
@ -267,7 +267,7 @@ class ListSubnetPool(command.Lister):
|
||||
_description = _("List subnet pools")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListSubnetPool, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--long',
|
||||
action='store_true',
|
||||
@ -393,7 +393,7 @@ class SetSubnetPool(common.NeutronCommandWithExtraArgs):
|
||||
_description = _("Set subnet pool properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetSubnetPool, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'subnet_pool',
|
||||
metavar='<subnet-pool>',
|
||||
@ -464,7 +464,7 @@ class ShowSubnetPool(command.ShowOne):
|
||||
_description = _("Display subnet pool details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowSubnetPool, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'subnet_pool',
|
||||
metavar='<subnet-pool>',
|
||||
@ -486,7 +486,7 @@ class UnsetSubnetPool(command.Command):
|
||||
_description = _("Unset subnet pool properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetSubnetPool, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'subnet_pool',
|
||||
metavar="<subnet-pool>",
|
||||
|
@ -24,7 +24,7 @@ class SetAccount(command.Command):
|
||||
_description = _("Set account properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetAccount, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"--property",
|
||||
metavar="<key=value>",
|
||||
@ -59,7 +59,7 @@ class UnsetAccount(command.Command):
|
||||
_description = _("Unset account properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetAccount, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--property',
|
||||
metavar='<key>',
|
||||
|
@ -32,7 +32,7 @@ class CreateContainer(command.Lister):
|
||||
_description = _("Create new container")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateContainer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--public',
|
||||
action='store_true',
|
||||
@ -85,7 +85,7 @@ class DeleteContainer(command.Command):
|
||||
_description = _("Delete container")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteContainer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'--recursive',
|
||||
'-r',
|
||||
@ -121,7 +121,7 @@ class ListContainer(command.Lister):
|
||||
_description = _("List containers")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListContainer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"--prefix",
|
||||
metavar="<prefix>",
|
||||
@ -184,7 +184,7 @@ class SaveContainer(command.Command):
|
||||
_description = _("Save container contents locally")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SaveContainer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'container',
|
||||
metavar='<container>',
|
||||
@ -202,7 +202,7 @@ class SetContainer(command.Command):
|
||||
_description = _("Set container properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetContainer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'container',
|
||||
metavar='<container>',
|
||||
@ -231,7 +231,7 @@ class ShowContainer(command.ShowOne):
|
||||
_description = _("Display container details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowContainer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'container',
|
||||
metavar='<container>',
|
||||
@ -253,7 +253,7 @@ class UnsetContainer(command.Command):
|
||||
_description = _("Unset container properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetContainer, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'container',
|
||||
metavar='<container>',
|
||||
|
@ -34,7 +34,7 @@ class CreateObject(command.Lister):
|
||||
_description = _("Upload object to container")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CreateObject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'container',
|
||||
metavar='<container>',
|
||||
@ -99,7 +99,7 @@ class DeleteObject(command.Command):
|
||||
_description = _("Delete object from container")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(DeleteObject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'container',
|
||||
metavar='<container>',
|
||||
@ -125,7 +125,7 @@ class ListObject(command.Lister):
|
||||
_description = _("List objects")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListObject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"container",
|
||||
metavar="<container>",
|
||||
@ -208,7 +208,7 @@ class SaveObject(command.Command):
|
||||
_description = _("Save object locally")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SaveObject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"--file",
|
||||
metavar="<filename>",
|
||||
@ -241,7 +241,7 @@ class SetObject(command.Command):
|
||||
_description = _("Set object properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(SetObject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'container',
|
||||
metavar='<container>',
|
||||
@ -276,7 +276,7 @@ class ShowObject(command.ShowOne):
|
||||
_description = _("Display object details")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowObject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'container',
|
||||
metavar='<container>',
|
||||
@ -304,7 +304,7 @@ class UnsetObject(command.Command):
|
||||
_description = _("Unset object properties")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UnsetObject, self).get_parser(prog_name)
|
||||
parser = super().get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'container',
|
||||
metavar='<container>',
|
||||
|
@ -32,7 +32,7 @@ DEFAULT_DOMAIN = 'default'
|
||||
|
||||
class OpenStackShell(shell.OpenStackShell):
|
||||
def __init__(self):
|
||||
super(OpenStackShell, self).__init__(
|
||||
super().__init__(
|
||||
description=__doc__.strip(),
|
||||
version=openstackclient.__version__,
|
||||
command_manager=commandmanager.CommandManager('openstack.cli'),
|
||||
@ -49,15 +49,13 @@ class OpenStackShell(shell.OpenStackShell):
|
||||
warnings.filterwarnings('ignore', module='openstack')
|
||||
|
||||
def build_option_parser(self, description, version):
|
||||
parser = super(OpenStackShell, self).build_option_parser(
|
||||
description, version
|
||||
)
|
||||
parser = super().build_option_parser(description, version)
|
||||
parser = clientmanager.build_plugin_option_parser(parser)
|
||||
parser = auth.build_auth_plugins_option_parser(parser)
|
||||
return parser
|
||||
|
||||
def _final_defaults(self):
|
||||
super(OpenStackShell, self)._final_defaults()
|
||||
super()._final_defaults()
|
||||
|
||||
# Set the default plugin to admin_token if endpoint and token are given
|
||||
if self.options.endpoint and self.options.token:
|
||||
@ -132,7 +130,7 @@ class OpenStackShell(shell.OpenStackShell):
|
||||
self.command_manager.add_command_group('openstack.extension')
|
||||
|
||||
def initialize_app(self, argv):
|
||||
super(OpenStackShell, self).initialize_app(argv)
|
||||
super().initialize_app(argv)
|
||||
|
||||
# Re-create the client_manager with our subclass
|
||||
self.client_manager = clientmanager.ClientManager(
|
||||
|
@ -137,7 +137,7 @@ class TestCase(testtools.TestCase):
|
||||
|
||||
@classmethod
|
||||
def get_opts(cls, fields, output_format='value'):
|
||||
return ' -f {0} {1}'.format(
|
||||
return ' -f {} {}'.format(
|
||||
output_format, ' '.join(['-c ' + it for it in fields])
|
||||
)
|
||||
|
||||
|
@ -23,7 +23,7 @@ class ExtensionTests(base.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(ExtensionTests, cls).setUpClass()
|
||||
super().setUpClass()
|
||||
cls.haz_network = cls.is_service_enabled('network')
|
||||
|
||||
def test_extension_list_compute(self):
|
||||
|
@ -60,12 +60,12 @@ class HelpTests(base.TestCase):
|
||||
"""Check server commands in main help message."""
|
||||
raw_output = self.openstack('help')
|
||||
for command, description in self.SERVER_COMMANDS:
|
||||
msg = 'Command: %s not found in help output:\n%s' % (
|
||||
msg = 'Command: {} not found in help output:\n{}'.format(
|
||||
command,
|
||||
raw_output,
|
||||
)
|
||||
self.assertIn(command, raw_output, msg)
|
||||
msg = 'Description: %s not found in help output:\n%s' % (
|
||||
msg = 'Description: {} not found in help output:\n{}'.format(
|
||||
description,
|
||||
raw_output,
|
||||
)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user