Remove six
Remove all usages of six. Change-Id: I6ea8d1cdc3060d5c2a4311c7454b66ba75109b0c
This commit is contained in:
@@ -67,7 +67,6 @@ requests==2.14.2
|
|||||||
requestsexceptions==1.2.0
|
requestsexceptions==1.2.0
|
||||||
rfc3986==0.3.1
|
rfc3986==0.3.1
|
||||||
simplejson==3.5.1
|
simplejson==3.5.1
|
||||||
six==1.10.0
|
|
||||||
snowballstemmer==1.2.1
|
snowballstemmer==1.2.1
|
||||||
stestr==2.0.0
|
stestr==2.0.0
|
||||||
stevedore==1.20.0
|
stevedore==1.20.0
|
||||||
|
@@ -9,7 +9,6 @@ oslo.i18n>=3.15.3 # Apache-2.0
|
|||||||
oslo.utils>=3.33.0 # Apache-2.0
|
oslo.utils>=3.33.0 # Apache-2.0
|
||||||
Babel!=2.4.0,>=2.3.4 # BSD
|
Babel!=2.4.0,>=2.3.4 # BSD
|
||||||
keystoneauth1>=3.4.0 # Apache-2.0
|
keystoneauth1>=3.4.0 # Apache-2.0
|
||||||
six>=1.10.0 # MIT
|
|
||||||
python-swiftclient>=3.2.0 # Apache-2.0
|
python-swiftclient>=3.2.0 # Apache-2.0
|
||||||
python-mistralclient!=3.2.0,>=3.1.0 # Apache-2.0
|
python-mistralclient!=3.2.0,>=3.1.0 # Apache-2.0
|
||||||
osc-lib>=1.8.0 # Apache-2.0
|
osc-lib>=1.8.0 # Apache-2.0
|
||||||
|
@@ -21,7 +21,6 @@ import abc
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import six
|
|
||||||
from stevedore import extension
|
from stevedore import extension
|
||||||
|
|
||||||
from troveclient.apiclient import exceptions
|
from troveclient.apiclient import exceptions
|
||||||
@@ -54,7 +53,7 @@ def load_auth_system_opts(parser):
|
|||||||
"""
|
"""
|
||||||
group = parser.add_argument_group("Common auth options")
|
group = parser.add_argument_group("Common auth options")
|
||||||
BaseAuthPlugin.add_common_opts(group)
|
BaseAuthPlugin.add_common_opts(group)
|
||||||
for name, auth_plugin in six.iteritems(_discovered_plugins):
|
for name, auth_plugin in _discovered_plugins.items():
|
||||||
group = parser.add_argument_group(
|
group = parser.add_argument_group(
|
||||||
"Auth-system '%s' options" % name,
|
"Auth-system '%s' options" % name,
|
||||||
conflict_handler="resolve")
|
conflict_handler="resolve")
|
||||||
@@ -85,7 +84,7 @@ def load_plugin_from_args(args):
|
|||||||
plugin.sufficient_options()
|
plugin.sufficient_options()
|
||||||
return plugin
|
return plugin
|
||||||
|
|
||||||
for plugin_auth_system in sorted(six.iterkeys(_discovered_plugins)):
|
for plugin_auth_system in sorted(_discovered_plugins.keys()):
|
||||||
plugin_class = _discovered_plugins[plugin_auth_system]
|
plugin_class = _discovered_plugins[plugin_auth_system]
|
||||||
plugin = plugin_class()
|
plugin = plugin_class()
|
||||||
plugin.parse_opts(args)
|
plugin.parse_opts(args)
|
||||||
@@ -97,8 +96,7 @@ def load_plugin_from_args(args):
|
|||||||
raise exceptions.AuthPluginOptionsMissing(["auth_system"])
|
raise exceptions.AuthPluginOptionsMissing(["auth_system"])
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class BaseAuthPlugin(metaclass=abc.ABCMeta):
|
||||||
class BaseAuthPlugin(object):
|
|
||||||
"""Base class for authentication plugins.
|
"""Base class for authentication plugins.
|
||||||
|
|
||||||
An authentication plugin needs to override at least the authenticate
|
An authentication plugin needs to override at least the authenticate
|
||||||
|
@@ -28,8 +28,7 @@ import copy
|
|||||||
|
|
||||||
from oslo_utils import reflection
|
from oslo_utils import reflection
|
||||||
from oslo_utils import strutils
|
from oslo_utils import strutils
|
||||||
import six
|
from urllib import parse
|
||||||
from six.moves.urllib import parse
|
|
||||||
|
|
||||||
from troveclient.apiclient import exceptions
|
from troveclient.apiclient import exceptions
|
||||||
|
|
||||||
@@ -203,8 +202,7 @@ class BaseManager(HookableMixin):
|
|||||||
return self.client.delete(url)
|
return self.client.delete(url)
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
class ManagerWithFind(BaseManager, metaclass=abc.ABCMeta):
|
||||||
class ManagerWithFind(BaseManager):
|
|
||||||
"""Manager with additional `find()`/`findall()` methods."""
|
"""Manager with additional `find()`/`findall()` methods."""
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@@ -293,7 +291,7 @@ class CrudManager(BaseManager):
|
|||||||
|
|
||||||
def _filter_kwargs(self, kwargs):
|
def _filter_kwargs(self, kwargs):
|
||||||
"""Drop null values and handle ids."""
|
"""Drop null values and handle ids."""
|
||||||
for key, ref in six.iteritems(kwargs.copy()):
|
for key, ref in kwargs.copy().items():
|
||||||
if ref is None:
|
if ref is None:
|
||||||
kwargs.pop(key)
|
kwargs.pop(key)
|
||||||
else:
|
else:
|
||||||
@@ -449,7 +447,7 @@ class Resource(object):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def _add_details(self, info):
|
def _add_details(self, info):
|
||||||
for (k, v) in six.iteritems(info):
|
for (k, v) in info.items():
|
||||||
try:
|
try:
|
||||||
setattr(self, k, v)
|
setattr(self, k, v)
|
||||||
self._info[k] = v
|
self._info[k] = v
|
||||||
|
@@ -23,8 +23,6 @@ Exception definitions.
|
|||||||
import inspect
|
import inspect
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
class ClientException(Exception):
|
class ClientException(Exception):
|
||||||
"""The base exception class for all exceptions this library raises.
|
"""The base exception class for all exceptions this library raises.
|
||||||
@@ -397,7 +395,7 @@ class HttpVersionNotSupported(HttpServerError):
|
|||||||
# _code_map contains all the classes that have http_status attribute.
|
# _code_map contains all the classes that have http_status attribute.
|
||||||
_code_map = dict(
|
_code_map = dict(
|
||||||
(getattr(obj, 'http_status', None), obj)
|
(getattr(obj, 'http_status', None), obj)
|
||||||
for name, obj in six.iteritems(vars(sys.modules[__name__]))
|
for name, obj in vars(sys.modules[__name__]).items()
|
||||||
if inspect.isclass(obj) and getattr(obj, 'http_status', False)
|
if inspect.isclass(obj) and getattr(obj, 'http_status', False)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -18,7 +18,6 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
import six
|
|
||||||
|
|
||||||
from troveclient import exceptions
|
from troveclient import exceptions
|
||||||
|
|
||||||
@@ -51,7 +50,7 @@ def load_auth_system_opts(parser):
|
|||||||
This function will try to populate the parser with options from the
|
This function will try to populate the parser with options from the
|
||||||
available plugins.
|
available plugins.
|
||||||
"""
|
"""
|
||||||
for name, auth_plugin in six.iteritems(_discovered_plugins):
|
for name, auth_plugin in _discovered_plugins.items():
|
||||||
add_opts_fn = getattr(auth_plugin, "add_opts", None)
|
add_opts_fn = getattr(auth_plugin, "add_opts", None)
|
||||||
if add_opts_fn:
|
if add_opts_fn:
|
||||||
group = parser.add_argument_group("Auth-system '%s' options" %
|
group = parser.add_argument_group("Auth-system '%s' options" %
|
||||||
|
@@ -23,8 +23,7 @@ import contextlib
|
|||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import six
|
from urllib import parse
|
||||||
from six.moves.urllib import parse
|
|
||||||
|
|
||||||
from troveclient.apiclient import base
|
from troveclient.apiclient import base
|
||||||
from troveclient.apiclient import exceptions
|
from troveclient.apiclient import exceptions
|
||||||
@@ -199,7 +198,7 @@ class Manager(utils.HookableMixin):
|
|||||||
return body
|
return body
|
||||||
|
|
||||||
|
|
||||||
class ManagerWithFind(six.with_metaclass(abc.ABCMeta, Manager)):
|
class ManagerWithFind(Manager, metaclass=abc.ABCMeta):
|
||||||
"""Like a `Manager`, but with additional `find()`/`findall()` methods."""
|
"""Like a `Manager`, but with additional `find()`/`findall()` methods."""
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
|
@@ -24,7 +24,7 @@ import logging
|
|||||||
from keystoneauth1 import adapter
|
from keystoneauth1 import adapter
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
import requests
|
import requests
|
||||||
import six.moves.urllib.parse as urlparse
|
from urllib import parse as urlparse
|
||||||
|
|
||||||
from troveclient.apiclient import client
|
from troveclient.apiclient import client
|
||||||
from troveclient import exceptions
|
from troveclient import exceptions
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from six.moves.urllib import parse
|
from urllib import parse
|
||||||
|
|
||||||
from troveclient.apiclient import exceptions
|
from troveclient.apiclient import exceptions
|
||||||
|
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
import six
|
|
||||||
from troveclient.compat import exceptions
|
from troveclient.compat import exceptions
|
||||||
|
|
||||||
|
|
||||||
@@ -19,7 +18,7 @@ def get_authenticator_cls(cls_or_name):
|
|||||||
"""Factory method to retrieve Authenticator class."""
|
"""Factory method to retrieve Authenticator class."""
|
||||||
if isinstance(cls_or_name, type):
|
if isinstance(cls_or_name, type):
|
||||||
return cls_or_name
|
return cls_or_name
|
||||||
elif isinstance(cls_or_name, six.string_types):
|
elif isinstance(cls_or_name, str):
|
||||||
if cls_or_name == "keystone":
|
if cls_or_name == "keystone":
|
||||||
return KeyStoneV3Authenticator
|
return KeyStoneV3Authenticator
|
||||||
elif cls_or_name == "auth1.1":
|
elif cls_or_name == "auth1.1":
|
||||||
|
@@ -17,9 +17,8 @@ import json
|
|||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
import pickle
|
import pickle
|
||||||
import six
|
|
||||||
from six.moves.urllib import parse
|
|
||||||
import sys
|
import sys
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
from troveclient.compat import client
|
from troveclient.compat import client
|
||||||
from troveclient.compat import exceptions
|
from troveclient.compat import exceptions
|
||||||
@@ -44,7 +43,7 @@ def check_for_exceptions(resp, body):
|
|||||||
def print_actions(cmd, actions):
|
def print_actions(cmd, actions):
|
||||||
"""Print help for the command with list of options and description."""
|
"""Print help for the command with list of options and description."""
|
||||||
print("Available actions for '%s' cmd:" % cmd)
|
print("Available actions for '%s' cmd:" % cmd)
|
||||||
for k, v in six.iteritems(actions):
|
for k, v in actions.items():
|
||||||
print("\t%-20s%s" % (k, v.__doc__))
|
print("\t%-20s%s" % (k, v.__doc__))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
@@ -53,7 +52,7 @@ def print_commands(commands):
|
|||||||
"""Print the list of available commands and description."""
|
"""Print the list of available commands and description."""
|
||||||
|
|
||||||
print("Available commands")
|
print("Available commands")
|
||||||
for k, v in six.iteritems(commands):
|
for k, v in commands.items():
|
||||||
print("\t%-20s%s" % (k, v.__doc__))
|
print("\t%-20s%s" % (k, v.__doc__))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
from osc_lib import utils as osc_utils
|
from osc_lib import utils as osc_utils
|
||||||
import six
|
|
||||||
|
|
||||||
from troveclient.i18n import _
|
from troveclient.i18n import _
|
||||||
|
|
||||||
@@ -167,7 +166,7 @@ class ShowDatabaseBackup(command.ShowOne):
|
|||||||
database_backups = self.app.client_manager.database.backups
|
database_backups = self.app.client_manager.database.backups
|
||||||
backup = osc_utils.find_resource(database_backups, parsed_args.backup)
|
backup = osc_utils.find_resource(database_backups, parsed_args.backup)
|
||||||
backup = set_attributes_for_print_detail(backup)
|
backup = set_attributes_for_print_detail(backup)
|
||||||
return zip(*sorted(six.iteritems(backup)))
|
return zip(*sorted(backup.items()))
|
||||||
|
|
||||||
|
|
||||||
class DeleteDatabaseBackup(command.Command):
|
class DeleteDatabaseBackup(command.Command):
|
||||||
@@ -257,7 +256,7 @@ class CreateDatabaseBackup(command.ShowOne):
|
|||||||
swift_container=parsed_args.swift_container
|
swift_container=parsed_args.swift_container
|
||||||
)
|
)
|
||||||
backup = set_attributes_for_print_detail(backup)
|
backup = set_attributes_for_print_detail(backup)
|
||||||
return zip(*sorted(six.iteritems(backup)))
|
return zip(*sorted(backup.items()))
|
||||||
|
|
||||||
|
|
||||||
class DeleteDatabaseBackupExecution(command.Command):
|
class DeleteDatabaseBackupExecution(command.Command):
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
from osc_lib import utils
|
from osc_lib import utils
|
||||||
import six
|
|
||||||
|
|
||||||
from troveclient.i18n import _
|
from troveclient.i18n import _
|
||||||
from troveclient.v1.shell import _parse_extended_properties
|
from troveclient.v1.shell import _parse_extended_properties
|
||||||
@@ -103,7 +102,7 @@ class ShowDatabaseCluster(command.ShowOne):
|
|||||||
database_clusters = self.app.client_manager.database.clusters
|
database_clusters = self.app.client_manager.database.clusters
|
||||||
cluster = utils.find_resource(database_clusters, parsed_args.cluster)
|
cluster = utils.find_resource(database_clusters, parsed_args.cluster)
|
||||||
cluster = set_attributes_for_print_detail(cluster)
|
cluster = set_attributes_for_print_detail(cluster)
|
||||||
return zip(*sorted(six.iteritems(cluster)))
|
return zip(*sorted(cluster.items()))
|
||||||
|
|
||||||
|
|
||||||
class DeleteDatabaseCluster(command.Command):
|
class DeleteDatabaseCluster(command.Command):
|
||||||
@@ -200,7 +199,7 @@ class CreateDatabaseCluster(command.ShowOne):
|
|||||||
extended_properties=extended_properties,
|
extended_properties=extended_properties,
|
||||||
configuration=parsed_args.configuration)
|
configuration=parsed_args.configuration)
|
||||||
cluster = set_attributes_for_print_detail(cluster)
|
cluster = set_attributes_for_print_detail(cluster)
|
||||||
return zip(*sorted(six.iteritems(cluster)))
|
return zip(*sorted(cluster.items()))
|
||||||
|
|
||||||
|
|
||||||
class ResetDatabaseClusterStatus(command.Command):
|
class ResetDatabaseClusterStatus(command.Command):
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
import json
|
import json
|
||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import utils as osc_utils
|
from osc_lib import utils as osc_utils
|
||||||
import six
|
|
||||||
|
|
||||||
from troveclient import exceptions
|
from troveclient import exceptions
|
||||||
from troveclient.i18n import _
|
from troveclient.i18n import _
|
||||||
@@ -81,7 +80,7 @@ class ShowDatabaseConfiguration(command.ShowOne):
|
|||||||
configuration = osc_utils.find_resource(
|
configuration = osc_utils.find_resource(
|
||||||
db_configurations, parsed_args.configuration_group)
|
db_configurations, parsed_args.configuration_group)
|
||||||
configuration = set_attributes_for_print_detail(configuration)
|
configuration = set_attributes_for_print_detail(configuration)
|
||||||
return zip(*sorted(six.iteritems(configuration)))
|
return zip(*sorted(configuration.items()))
|
||||||
|
|
||||||
|
|
||||||
class ListDatabaseConfigurationParameters(command.Lister):
|
class ListDatabaseConfigurationParameters(command.Lister):
|
||||||
@@ -177,7 +176,7 @@ class ShowDatabaseConfigurationParameter(command.ShowOne):
|
|||||||
' parameter for the'
|
' parameter for the'
|
||||||
' configuration group'
|
' configuration group'
|
||||||
' by name.'))
|
' by name.'))
|
||||||
return zip(*sorted(six.iteritems(param._info)))
|
return zip(*sorted(param._info.items()))
|
||||||
|
|
||||||
|
|
||||||
class DeleteDatabaseConfiguration(command.Command):
|
class DeleteDatabaseConfiguration(command.Command):
|
||||||
@@ -252,7 +251,7 @@ class CreateDatabaseConfiguration(command.ShowOne):
|
|||||||
datastore=parsed_args.datastore,
|
datastore=parsed_args.datastore,
|
||||||
datastore_version=parsed_args.datastore_version)
|
datastore_version=parsed_args.datastore_version)
|
||||||
config_grp = set_attributes_for_print_detail(config_grp)
|
config_grp = set_attributes_for_print_detail(config_grp)
|
||||||
return zip(*sorted(six.iteritems(config_grp)))
|
return zip(*sorted(config_grp.items()))
|
||||||
|
|
||||||
|
|
||||||
class AttachDatabaseConfiguration(command.Command):
|
class AttachDatabaseConfiguration(command.Command):
|
||||||
@@ -371,7 +370,7 @@ class DefaultDatabaseConfiguration(command.ShowOne):
|
|||||||
instance = osc_utils.find_resource(db_instances,
|
instance = osc_utils.find_resource(db_instances,
|
||||||
parsed_args.instance)
|
parsed_args.instance)
|
||||||
configs = db_instances.configuration(instance)
|
configs = db_instances.configuration(instance)
|
||||||
return zip(*sorted(six.iteritems(configs._info['configuration'])))
|
return zip(*sorted(configs._info['configuration'].items()))
|
||||||
|
|
||||||
|
|
||||||
class SetDatabaseConfiguration(command.Command):
|
class SetDatabaseConfiguration(command.Command):
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
"""Database v1 Instances action implementations"""
|
"""Database v1 Instances action implementations"""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import six
|
|
||||||
|
|
||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
@@ -174,7 +173,7 @@ class ShowDatabaseInstance(command.ShowOne):
|
|||||||
db_instances = self.app.client_manager.database.instances
|
db_instances = self.app.client_manager.database.instances
|
||||||
instance = osc_utils.find_resource(db_instances, parsed_args.instance)
|
instance = osc_utils.find_resource(db_instances, parsed_args.instance)
|
||||||
instance = set_attributes_for_print_detail(instance)
|
instance = set_attributes_for_print_detail(instance)
|
||||||
return zip(*sorted(six.iteritems(instance)))
|
return zip(*sorted(instance.items()))
|
||||||
|
|
||||||
|
|
||||||
class DeleteDatabaseInstance(base.TroveDeleter):
|
class DeleteDatabaseInstance(base.TroveDeleter):
|
||||||
@@ -447,7 +446,7 @@ class CreateDatabaseInstance(command.ShowOne):
|
|||||||
access=access
|
access=access
|
||||||
)
|
)
|
||||||
instance = set_attributes_for_print_detail(instance)
|
instance = set_attributes_for_print_detail(instance)
|
||||||
return zip(*sorted(six.iteritems(instance)))
|
return zip(*sorted(instance.items()))
|
||||||
|
|
||||||
|
|
||||||
class ResetDatabaseInstanceStatus(command.Command):
|
class ResetDatabaseInstanceStatus(command.Command):
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import utils as osc_utils
|
from osc_lib import utils as osc_utils
|
||||||
import six
|
|
||||||
|
|
||||||
from troveclient import exceptions
|
from troveclient import exceptions
|
||||||
from troveclient.i18n import _
|
from troveclient.i18n import _
|
||||||
@@ -99,7 +98,7 @@ class SetDatabaseInstanceLog(command.ShowOne):
|
|||||||
)
|
)
|
||||||
result = log_info._info
|
result = log_info._info
|
||||||
|
|
||||||
return zip(*sorted(six.iteritems(result)))
|
return zip(*sorted(result.items()))
|
||||||
|
|
||||||
|
|
||||||
class ShowDatabaseInstanceLog(command.ShowOne):
|
class ShowDatabaseInstanceLog(command.ShowOne):
|
||||||
@@ -132,7 +131,7 @@ class ShowDatabaseInstanceLog(command.ShowOne):
|
|||||||
log_info = db_instances.log_show(instance, parsed_args.log_name)
|
log_info = db_instances.log_show(instance, parsed_args.log_name)
|
||||||
result = log_info._info
|
result = log_info._info
|
||||||
|
|
||||||
return zip(*sorted(six.iteritems(result)))
|
return zip(*sorted(result.items()))
|
||||||
|
|
||||||
|
|
||||||
class ShowDatabaseInstanceLogContents(command.Command):
|
class ShowDatabaseInstanceLogContents(command.Command):
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import utils as osc_utils
|
from osc_lib import utils as osc_utils
|
||||||
import six
|
|
||||||
|
|
||||||
from troveclient.i18n import _
|
from troveclient.i18n import _
|
||||||
|
|
||||||
@@ -71,4 +70,4 @@ class UpdateDatabaseQuota(command.ShowOne):
|
|||||||
}
|
}
|
||||||
updated_quota = db_quota.update(parsed_args.tenant_id,
|
updated_quota = db_quota.update(parsed_args.tenant_id,
|
||||||
update_params)
|
update_params)
|
||||||
return zip(*sorted(six.iteritems(updated_quota)))
|
return zip(*sorted(updated_quota.items()))
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
from osc_lib import utils as osc_utils
|
from osc_lib import utils as osc_utils
|
||||||
import six
|
|
||||||
|
|
||||||
from troveclient.i18n import _
|
from troveclient.i18n import _
|
||||||
|
|
||||||
@@ -80,7 +79,7 @@ class EnableDatabaseRoot(command.ShowOne):
|
|||||||
|
|
||||||
result = {'name': root[0],
|
result = {'name': root[0],
|
||||||
'password': root[1]}
|
'password': root[1]}
|
||||||
return zip(*sorted(six.iteritems(result)))
|
return zip(*sorted(result.items()))
|
||||||
|
|
||||||
|
|
||||||
class DisableDatabaseRoot(command.Command):
|
class DisableDatabaseRoot(command.Command):
|
||||||
@@ -136,4 +135,4 @@ class ShowDatabaseRoot(command.ShowOne):
|
|||||||
root = db_root.is_cluster_root_enabled(instance_or_cluster)
|
root = db_root.is_cluster_root_enabled(instance_or_cluster)
|
||||||
|
|
||||||
result = {'is_root_enabled': root.rootEnabled}
|
result = {'is_root_enabled': root.rootEnabled}
|
||||||
return zip(*sorted(six.iteritems(result)))
|
return zip(*sorted(result.items()))
|
||||||
|
@@ -15,7 +15,6 @@
|
|||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import exceptions
|
from osc_lib import exceptions
|
||||||
from osc_lib import utils
|
from osc_lib import utils
|
||||||
import six
|
|
||||||
|
|
||||||
from troveclient.i18n import _
|
from troveclient.i18n import _
|
||||||
|
|
||||||
@@ -129,7 +128,7 @@ class ShowDatabaseUser(command.ShowOne):
|
|||||||
parsed_args.instance)
|
parsed_args.instance)
|
||||||
user = db_users.get(instance, parsed_args.name,
|
user = db_users.get(instance, parsed_args.name,
|
||||||
hostname=parsed_args.host)
|
hostname=parsed_args.host)
|
||||||
return zip(*sorted(six.iteritems(user._info)))
|
return zip(*sorted(user._info.items()))
|
||||||
|
|
||||||
|
|
||||||
class DeleteDatabaseUser(command.Command):
|
class DeleteDatabaseUser(command.Command):
|
||||||
|
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
from osc_lib import utils
|
from osc_lib import utils
|
||||||
import six
|
|
||||||
|
|
||||||
from troveclient import exceptions
|
from troveclient import exceptions
|
||||||
from troveclient.i18n import _
|
from troveclient.i18n import _
|
||||||
@@ -65,7 +64,7 @@ class ShowDatastore(command.ShowOne):
|
|||||||
datastore = utils.find_resource(datastore_client,
|
datastore = utils.find_resource(datastore_client,
|
||||||
parsed_args.datastore)
|
parsed_args.datastore)
|
||||||
datastore = set_attributes_for_print_detail(datastore)
|
datastore = set_attributes_for_print_detail(datastore)
|
||||||
return zip(*sorted(six.iteritems(datastore)))
|
return zip(*sorted(datastore.items()))
|
||||||
|
|
||||||
|
|
||||||
class DeleteDatastore(command.Command):
|
class DeleteDatastore(command.Command):
|
||||||
@@ -146,7 +145,7 @@ class ShowDatastoreVersion(command.ShowOne):
|
|||||||
' datastore version by name.'))
|
' datastore version by name.'))
|
||||||
if datastore_version._info.get('links'):
|
if datastore_version._info.get('links'):
|
||||||
del (datastore_version._info['links'])
|
del (datastore_version._info['links'])
|
||||||
return zip(*sorted(six.iteritems(datastore_version._info)))
|
return zip(*sorted(datastore_version._info.items()))
|
||||||
|
|
||||||
|
|
||||||
class DeleteDatastoreVersion(command.Command):
|
class DeleteDatastoreVersion(command.Command):
|
||||||
|
@@ -34,7 +34,6 @@ from keystoneauth1 import loading
|
|||||||
from oslo_utils import encodeutils
|
from oslo_utils import encodeutils
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
import six
|
|
||||||
|
|
||||||
from troveclient.apiclient import exceptions as exc
|
from troveclient.apiclient import exceptions as exc
|
||||||
import troveclient.auth_plugin
|
import troveclient.auth_plugin
|
||||||
@@ -758,8 +757,8 @@ def main():
|
|||||||
sys.exit(130)
|
sys.exit(130)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.debug(e, exc_info=1)
|
LOG.debug(e, exc_info=1)
|
||||||
message = six.text_type(e)
|
message = str(e)
|
||||||
if not isinstance(message, six.string_types):
|
if not isinstance(message, str):
|
||||||
message = str(message)
|
message = str(message)
|
||||||
print(_("ERROR: %s") % encodeutils.safe_encode(message),
|
print(_("ERROR: %s") % encodeutils.safe_encode(message),
|
||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
|
@@ -12,10 +12,10 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from six.moves.urllib import parse
|
|
||||||
from troveclient import client as base_client
|
from troveclient import client as base_client
|
||||||
from troveclient.tests import utils
|
from troveclient.tests import utils
|
||||||
from troveclient.v1 import client
|
from troveclient.v1 import client
|
||||||
|
from urllib import parse
|
||||||
|
|
||||||
|
|
||||||
def get_version_map():
|
def get_version_map():
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import io
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
@@ -18,7 +19,6 @@ from unittest import mock
|
|||||||
import fixtures
|
import fixtures
|
||||||
from keystoneauth1 import fixture
|
from keystoneauth1 import fixture
|
||||||
import requests_mock
|
import requests_mock
|
||||||
import six
|
|
||||||
import testtools
|
import testtools
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
@@ -101,8 +101,8 @@ class ShellTest(testtools.TestCase):
|
|||||||
orig = sys.stdout
|
orig = sys.stdout
|
||||||
orig_stderr = sys.stderr
|
orig_stderr = sys.stderr
|
||||||
try:
|
try:
|
||||||
sys.stdout = six.StringIO()
|
sys.stdout = io.StringIO()
|
||||||
sys.stderr = six.StringIO()
|
sys.stderr = io.StringIO()
|
||||||
_shell = troveclient.shell.OpenStackTroveShell()
|
_shell = troveclient.shell.OpenStackTroveShell()
|
||||||
_shell.main(argstr.split())
|
_shell.main(argstr.split())
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
|
@@ -22,7 +22,6 @@ import uuid
|
|||||||
|
|
||||||
from oslo_utils import encodeutils
|
from oslo_utils import encodeutils
|
||||||
import prettytable
|
import prettytable
|
||||||
import six
|
|
||||||
|
|
||||||
from troveclient.apiclient import exceptions
|
from troveclient.apiclient import exceptions
|
||||||
|
|
||||||
@@ -179,7 +178,7 @@ def print_list(objs, fields, formatters={}, order_by=None, obj_is_dict=False,
|
|||||||
data = obj.get(field, '')
|
data = obj.get(field, '')
|
||||||
else:
|
else:
|
||||||
data = getattr(obj, field, '')
|
data = getattr(obj, field, '')
|
||||||
if isinstance(data, six.string_types):
|
if isinstance(data, str):
|
||||||
row.append(data.encode('utf-8'))
|
row.append(data.encode('utf-8'))
|
||||||
else:
|
else:
|
||||||
row.append(str(data))
|
row.append(str(data))
|
||||||
@@ -204,7 +203,7 @@ def print_dict(d, property="Property"):
|
|||||||
pass
|
pass
|
||||||
pt = prettytable.PrettyTable([property, 'Value'], caching=False)
|
pt = prettytable.PrettyTable([property, 'Value'], caching=False)
|
||||||
pt.align = 'l'
|
pt.align = 'l'
|
||||||
[pt.add_row(list(r)) for r in six.iteritems(d)]
|
[pt.add_row(list(r)) for r in d.items()]
|
||||||
_print(pt, property)
|
_print(pt, property)
|
||||||
|
|
||||||
|
|
||||||
@@ -222,7 +221,7 @@ def find_resource(manager, name_or_id):
|
|||||||
# is integer and instance name is digital.
|
# is integer and instance name is digital.
|
||||||
# Related to bug/1740015.
|
# Related to bug/1740015.
|
||||||
if isinstance(name_or_id, int):
|
if isinstance(name_or_id, int):
|
||||||
name_or_id = six.text_type(name_or_id)
|
name_or_id = str(name_or_id)
|
||||||
elif sys.version_info <= (3, 0):
|
elif sys.version_info <= (3, 0):
|
||||||
name_or_id = encodeutils.safe_decode(name_or_id)
|
name_or_id = encodeutils.safe_decode(name_or_id)
|
||||||
|
|
||||||
@@ -351,7 +350,7 @@ def do_action_on_many(action, resources, success_msg, error_msg):
|
|||||||
print(success_msg % resource)
|
print(success_msg % resource)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
failure_flag = True
|
failure_flag = True
|
||||||
print(encodeutils.safe_encode(six.text_type(e)))
|
print(encodeutils.safe_encode(str(e)))
|
||||||
|
|
||||||
if failure_flag:
|
if failure_flag:
|
||||||
raise exceptions.CommandError(error_msg)
|
raise exceptions.CommandError(error_msg)
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import six
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from mistralclient.api.client import client as mistral_client
|
from mistralclient.api.client import client as mistral_client
|
||||||
@@ -132,7 +131,7 @@ class Backups(base.ManagerWithFind):
|
|||||||
project_name=tenant_name)
|
project_name=tenant_name)
|
||||||
|
|
||||||
def _build_schedule(self, cron_trigger, wf_input):
|
def _build_schedule(self, cron_trigger, wf_input):
|
||||||
if isinstance(wf_input, six.string_types):
|
if isinstance(wf_input, str):
|
||||||
wf_input = json.loads(wf_input)
|
wf_input = json.loads(wf_input)
|
||||||
sched_info = {"id": cron_trigger.name,
|
sched_info = {"id": cron_trigger.name,
|
||||||
"name": wf_input["name"],
|
"name": wf_input["name"],
|
||||||
|
Reference in New Issue
Block a user