summaryrefslogtreecommitdiff
path: root/openstackclient
diff options
context:
space:
mode:
authorDean Troyer <dtroyer@gmail.com>2016-05-13 16:14:09 -0500
committerDean Troyer <dtroyer@gmail.com>2016-06-13 10:50:44 -0500
commite5e29a8fef7ba2396015918545a49e717fe75d15 (patch)
treec42c9581e6358c9327853e7800de0dfecc20a405 /openstackclient
parentd20c863ebc11cecaaefe043e615b2fb4f5f26063 (diff)
downloadpython-openstackclient-e5e29a8fef7ba2396015918545a49e717fe75d15.tar.gz
osc-lib: utils
Use osc-lib directly for utils. Leave openstackclient.common.utils for deprecation period. Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
Diffstat (limited to 'openstackclient')
-rw-r--r--openstackclient/api/auth.py2
-rw-r--r--openstackclient/api/object_store_v1.py3
-rw-r--r--openstackclient/common/availability_zone.py2
-rw-r--r--openstackclient/common/extension.py3
-rw-r--r--openstackclient/common/limits.py3
-rw-r--r--openstackclient/common/module.py5
-rw-r--r--openstackclient/common/quota.py5
-rw-r--r--openstackclient/compute/client.py3
-rw-r--r--openstackclient/compute/v2/agent.py2
-rw-r--r--openstackclient/compute/v2/aggregate.py2
-rw-r--r--openstackclient/compute/v2/console.py5
-rw-r--r--openstackclient/compute/v2/fixedip.py3
-rw-r--r--openstackclient/compute/v2/flavor.py2
-rw-r--r--openstackclient/compute/v2/floatingip.py3
-rw-r--r--openstackclient/compute/v2/floatingippool.py3
-rw-r--r--openstackclient/compute/v2/host.py3
-rw-r--r--openstackclient/compute/v2/hypervisor.py3
-rw-r--r--openstackclient/compute/v2/keypair.py2
-rw-r--r--openstackclient/compute/v2/server.py2
-rw-r--r--openstackclient/compute/v2/server_backup.py2
-rw-r--r--openstackclient/compute/v2/server_group.py2
-rw-r--r--openstackclient/compute/v2/service.py2
-rw-r--r--openstackclient/compute/v2/usage.py2
-rw-r--r--openstackclient/identity/client.py3
-rw-r--r--openstackclient/identity/common.py3
-rw-r--r--openstackclient/identity/v2_0/catalog.py2
-rw-r--r--openstackclient/identity/v2_0/ec2creds.py2
-rw-r--r--openstackclient/identity/v2_0/endpoint.py2
-rw-r--r--openstackclient/identity/v2_0/project.py5
-rw-r--r--openstackclient/identity/v2_0/role.py2
-rw-r--r--openstackclient/identity/v2_0/service.py2
-rw-r--r--openstackclient/identity/v2_0/user.py5
-rw-r--r--openstackclient/identity/v3/catalog.py2
-rw-r--r--openstackclient/identity/v3/consumer.py5
-rw-r--r--openstackclient/identity/v3/credential.py2
-rw-r--r--openstackclient/identity/v3/domain.py4
-rw-r--r--openstackclient/identity/v3/ec2creds.py2
-rw-r--r--openstackclient/identity/v3/endpoint.py5
-rw-r--r--openstackclient/identity/v3/federation_protocol.py2
-rw-r--r--openstackclient/identity/v3/group.py4
-rw-r--r--openstackclient/identity/v3/identity_provider.py2
-rw-r--r--openstackclient/identity/v3/mapping.py5
-rw-r--r--openstackclient/identity/v3/policy.py5
-rw-r--r--openstackclient/identity/v3/project.py5
-rw-r--r--openstackclient/identity/v3/region.py2
-rw-r--r--openstackclient/identity/v3/role.py4
-rw-r--r--openstackclient/identity/v3/role_assignment.py3
-rw-r--r--openstackclient/identity/v3/service.py5
-rw-r--r--openstackclient/identity/v3/service_provider.py5
-rw-r--r--openstackclient/identity/v3/token.py5
-rw-r--r--openstackclient/identity/v3/trust.py3
-rw-r--r--openstackclient/identity/v3/unscoped_saml.py2
-rw-r--r--openstackclient/identity/v3/user.py4
-rw-r--r--openstackclient/image/client.py3
-rw-r--r--openstackclient/image/v1/image.py3
-rw-r--r--openstackclient/image/v2/image.py4
-rw-r--r--openstackclient/network/client.py2
-rw-r--r--openstackclient/network/v2/address_scope.py2
-rw-r--r--openstackclient/network/v2/floating_ip.py3
-rw-r--r--openstackclient/network/v2/ip_availability.py3
-rw-r--r--openstackclient/network/v2/network.py3
-rw-r--r--openstackclient/network/v2/network_segment.py3
-rw-r--r--openstackclient/network/v2/port.py2
-rw-r--r--openstackclient/network/v2/router.py3
-rw-r--r--openstackclient/network/v2/security_group.py3
-rw-r--r--openstackclient/network/v2/security_group_rule.py2
-rw-r--r--openstackclient/network/v2/subnet.py2
-rw-r--r--openstackclient/network/v2/subnet_pool.py3
-rw-r--r--openstackclient/object/client.py3
-rw-r--r--openstackclient/object/v1/account.py2
-rw-r--r--openstackclient/object/v1/container.py2
-rw-r--r--openstackclient/object/v1/object.py2
-rw-r--r--openstackclient/shell.py2
-rw-r--r--openstackclient/tests/common/test_utils.py401
-rw-r--r--openstackclient/tests/compute/v2/test_flavor.py2
-rw-r--r--openstackclient/tests/compute/v2/test_server.py4
-rw-r--r--openstackclient/tests/compute/v2/test_server_backup.py2
-rw-r--r--openstackclient/tests/compute/v2/test_server_group.py2
-rw-r--r--openstackclient/tests/identity/v2_0/test_user.py4
-rw-r--r--openstackclient/tests/identity/v3/test_project.py4
-rw-r--r--openstackclient/tests/identity/v3/test_user.py6
-rw-r--r--openstackclient/tests/image/v1/test_image.py2
-rw-r--r--openstackclient/tests/image/v2/fakes.py5
-rw-r--r--openstackclient/tests/image/v2/test_image.py6
-rw-r--r--openstackclient/tests/network/v2/test_ip_availability.py5
-rw-r--r--openstackclient/tests/network/v2/test_network.py2
-rw-r--r--openstackclient/tests/network/v2/test_port.py2
-rw-r--r--openstackclient/tests/network/v2/test_router.py3
-rw-r--r--openstackclient/tests/network/v2/test_subnet.py3
-rw-r--r--openstackclient/tests/network/v2/test_subnet_pool.py3
-rw-r--r--openstackclient/tests/volume/test_find_resource.py2
-rw-r--r--openstackclient/tests/volume/v1/test_qos_specs.py3
-rw-r--r--openstackclient/tests/volume/v2/fakes.py3
-rw-r--r--openstackclient/tests/volume/v2/test_qos_specs.py2
-rw-r--r--openstackclient/tests/volume/v2/test_snapshot.py3
-rw-r--r--openstackclient/tests/volume/v2/test_type.py3
-rw-r--r--openstackclient/tests/volume/v2/test_volume.py3
-rw-r--r--openstackclient/volume/client.py3
-rw-r--r--openstackclient/volume/v1/backup.py3
-rw-r--r--openstackclient/volume/v1/qos_specs.py2
-rw-r--r--openstackclient/volume/v1/service.py3
-rw-r--r--openstackclient/volume/v1/snapshot.py3
-rw-r--r--openstackclient/volume/v1/volume.py3
-rw-r--r--openstackclient/volume/v1/volume_transfer_request.py2
-rw-r--r--openstackclient/volume/v1/volume_type.py2
-rw-r--r--openstackclient/volume/v2/backup.py2
-rw-r--r--openstackclient/volume/v2/qos_specs.py2
-rw-r--r--openstackclient/volume/v2/service.py3
-rw-r--r--openstackclient/volume/v2/snapshot.py2
-rw-r--r--openstackclient/volume/v2/volume.py2
-rw-r--r--openstackclient/volume/v2/volume_transfer_request.py2
-rw-r--r--openstackclient/volume/v2/volume_type.py2
112 files changed, 183 insertions, 546 deletions
diff --git a/openstackclient/api/auth.py b/openstackclient/api/auth.py
index f1e53c49..a55af293 100644
--- a/openstackclient/api/auth.py
+++ b/openstackclient/api/auth.py
@@ -18,8 +18,8 @@ import logging
from keystoneauth1.loading import base
from osc_lib import exceptions as exc
+from osc_lib import utils
-from openstackclient.common import utils
from openstackclient.i18n import _
LOG = logging.getLogger(__name__)
diff --git a/openstackclient/api/object_store_v1.py b/openstackclient/api/object_store_v1.py
index 632e8b19..ae49922d 100644
--- a/openstackclient/api/object_store_v1.py
+++ b/openstackclient/api/object_store_v1.py
@@ -20,8 +20,9 @@ import os
import six
from six.moves import urllib
+from osc_lib import utils
+
from openstackclient.api import api
-from openstackclient.common import utils
class APIv1(api.BaseAPI):
diff --git a/openstackclient/common/availability_zone.py b/openstackclient/common/availability_zone.py
index df303137..6117c918 100644
--- a/openstackclient/common/availability_zone.py
+++ b/openstackclient/common/availability_zone.py
@@ -16,10 +16,10 @@
import copy
from novaclient import exceptions as nova_exceptions
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/common/extension.py b/openstackclient/common/extension.py
index ab46e7d8..6fcf9fa8 100644
--- a/openstackclient/common/extension.py
+++ b/openstackclient/common/extension.py
@@ -17,8 +17,9 @@
import itertools
+from osc_lib import utils
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/common/limits.py b/openstackclient/common/limits.py
index 939b9efb..249d1b44 100644
--- a/openstackclient/common/limits.py
+++ b/openstackclient/common/limits.py
@@ -17,8 +17,9 @@
import itertools
+from osc_lib import utils
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
diff --git a/openstackclient/common/module.py b/openstackclient/common/module.py
index 11895f7a..91e779fb 100644
--- a/openstackclient/common/module.py
+++ b/openstackclient/common/module.py
@@ -15,11 +15,12 @@
"""Module action implementation"""
-import six
import sys
+from osc_lib import utils
+import six
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/common/quota.py b/openstackclient/common/quota.py
index 67e442b3..6fd1e2f5 100644
--- a/openstackclient/common/quota.py
+++ b/openstackclient/common/quota.py
@@ -16,11 +16,12 @@
"""Quota action implementations"""
import itertools
-import six
import sys
+from osc_lib import utils
+import six
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/compute/client.py b/openstackclient/compute/client.py
index aa4c431f..a83700db 100644
--- a/openstackclient/compute/client.py
+++ b/openstackclient/compute/client.py
@@ -16,10 +16,11 @@
import logging
from osc_lib import exceptions
+from osc_lib import utils
-from openstackclient.common import utils
from openstackclient.i18n import _
+
LOG = logging.getLogger(__name__)
DEFAULT_API_VERSION = '2'
diff --git a/openstackclient/compute/v2/agent.py b/openstackclient/compute/v2/agent.py
index 7b1a301e..5f705076 100644
--- a/openstackclient/compute/v2/agent.py
+++ b/openstackclient/compute/v2/agent.py
@@ -16,10 +16,10 @@
"""Agent action implementations"""
from osc_lib import exceptions
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/compute/v2/aggregate.py b/openstackclient/compute/v2/aggregate.py
index 752e0fdf..69227b0c 100644
--- a/openstackclient/compute/v2/aggregate.py
+++ b/openstackclient/compute/v2/aggregate.py
@@ -16,11 +16,11 @@
"""Compute v2 Aggregate action implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/compute/v2/console.py b/openstackclient/compute/v2/console.py
index 1165862c..ee168016 100644
--- a/openstackclient/compute/v2/console.py
+++ b/openstackclient/compute/v2/console.py
@@ -15,12 +15,13 @@
"""Compute v2 Console action implementations"""
-import six
import sys
+from osc_lib import utils
+import six
+
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/compute/v2/fixedip.py b/openstackclient/compute/v2/fixedip.py
index daac97d1..e3b80c5f 100644
--- a/openstackclient/compute/v2/fixedip.py
+++ b/openstackclient/compute/v2/fixedip.py
@@ -15,8 +15,9 @@
"""Fixed IP action implementations"""
+from osc_lib import utils
+
from openstackclient.common import command
-from openstackclient.common import utils
class AddFixedIP(command.Command):
diff --git a/openstackclient/compute/v2/flavor.py b/openstackclient/compute/v2/flavor.py
index 7761ab43..7cca37e5 100644
--- a/openstackclient/compute/v2/flavor.py
+++ b/openstackclient/compute/v2/flavor.py
@@ -16,11 +16,11 @@
"""Flavor action implementations"""
from osc_lib import exceptions
+from osc_lib import utils
import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
diff --git a/openstackclient/compute/v2/floatingip.py b/openstackclient/compute/v2/floatingip.py
index fac4d2e3..780ea684 100644
--- a/openstackclient/compute/v2/floatingip.py
+++ b/openstackclient/compute/v2/floatingip.py
@@ -15,8 +15,9 @@
"""Floating IP action implementations"""
+from osc_lib import utils
+
from openstackclient.common import command
-from openstackclient.common import utils
class AddFloatingIP(command.Command):
diff --git a/openstackclient/compute/v2/floatingippool.py b/openstackclient/compute/v2/floatingippool.py
index 997e0324..eb7c9e86 100644
--- a/openstackclient/compute/v2/floatingippool.py
+++ b/openstackclient/compute/v2/floatingippool.py
@@ -15,8 +15,9 @@
"""Floating IP Pool action implementations"""
+from osc_lib import utils
+
from openstackclient.common import command
-from openstackclient.common import utils
class ListFloatingIPPool(command.Lister):
diff --git a/openstackclient/compute/v2/host.py b/openstackclient/compute/v2/host.py
index 73e2cdf9..15396d0c 100644
--- a/openstackclient/compute/v2/host.py
+++ b/openstackclient/compute/v2/host.py
@@ -15,8 +15,9 @@
"""Host action implementations"""
+from osc_lib import utils
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/compute/v2/hypervisor.py b/openstackclient/compute/v2/hypervisor.py
index 333a7dea..b13cdb47 100644
--- a/openstackclient/compute/v2/hypervisor.py
+++ b/openstackclient/compute/v2/hypervisor.py
@@ -16,10 +16,11 @@
"""Hypervisor action implementations"""
import re
+
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/compute/v2/keypair.py b/openstackclient/compute/v2/keypair.py
index 3810c1a3..acf467b3 100644
--- a/openstackclient/compute/v2/keypair.py
+++ b/openstackclient/compute/v2/keypair.py
@@ -20,10 +20,10 @@ import os
import sys
from osc_lib import exceptions
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py
index ee59bb34..7e810898 100644
--- a/openstackclient/compute/v2/server.py
+++ b/openstackclient/compute/v2/server.py
@@ -22,6 +22,7 @@ import os
import sys
from osc_lib import exceptions
+from osc_lib import utils
import six
try:
@@ -31,7 +32,6 @@ except ImportError:
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
diff --git a/openstackclient/compute/v2/server_backup.py b/openstackclient/compute/v2/server_backup.py
index f0b3edc5..972db660 100644
--- a/openstackclient/compute/v2/server_backup.py
+++ b/openstackclient/compute/v2/server_backup.py
@@ -18,11 +18,11 @@
import sys
from osc_lib import exceptions
+from osc_lib import utils
from oslo_utils import importutils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/compute/v2/server_group.py b/openstackclient/compute/v2/server_group.py
index 1b817018..5763ba2f 100644
--- a/openstackclient/compute/v2/server_group.py
+++ b/openstackclient/compute/v2/server_group.py
@@ -16,9 +16,9 @@
"""Compute v2 Server Group action implementations"""
from osc_lib import exceptions
+from osc_lib import utils
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/compute/v2/service.py b/openstackclient/compute/v2/service.py
index 2a589f6b..206344dc 100644
--- a/openstackclient/compute/v2/service.py
+++ b/openstackclient/compute/v2/service.py
@@ -16,9 +16,9 @@
"""Service action implementations"""
from osc_lib import exceptions
+from osc_lib import utils
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/compute/v2/usage.py b/openstackclient/compute/v2/usage.py
index b83bef13..cc24346f 100644
--- a/openstackclient/compute/v2/usage.py
+++ b/openstackclient/compute/v2/usage.py
@@ -18,10 +18,10 @@
import datetime
import sys
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/client.py b/openstackclient/identity/client.py
index c166e66a..1868b224 100644
--- a/openstackclient/identity/client.py
+++ b/openstackclient/identity/client.py
@@ -16,8 +16,9 @@
import logging
from keystoneclient.v2_0 import client as identity_client_v2
+from osc_lib import utils
+
from openstackclient.api import auth
-from openstackclient.common import utils
LOG = logging.getLogger(__name__)
diff --git a/openstackclient/identity/common.py b/openstackclient/identity/common.py
index 5a65c47c..16ee63e1 100644
--- a/openstackclient/identity/common.py
+++ b/openstackclient/identity/common.py
@@ -21,8 +21,7 @@ from keystoneclient.v3 import groups
from keystoneclient.v3 import projects
from keystoneclient.v3 import users
from osc_lib import exceptions
-
-from openstackclient.common import utils
+from osc_lib import utils
def find_service(identity_client, name_type_or_id):
diff --git a/openstackclient/identity/v2_0/catalog.py b/openstackclient/identity/v2_0/catalog.py
index 3210df76..2de1e8e7 100644
--- a/openstackclient/identity/v2_0/catalog.py
+++ b/openstackclient/identity/v2_0/catalog.py
@@ -14,10 +14,10 @@
"""Identity v2 Service Catalog action implementations"""
from osc_lib import exceptions
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v2_0/ec2creds.py b/openstackclient/identity/v2_0/ec2creds.py
index dfd67591..86f07bce 100644
--- a/openstackclient/identity/v2_0/ec2creds.py
+++ b/openstackclient/identity/v2_0/ec2creds.py
@@ -16,10 +16,10 @@
"""Identity v2 EC2 Credentials action implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v2_0/endpoint.py b/openstackclient/identity/v2_0/endpoint.py
index 09ea738f..89c8a38b 100644
--- a/openstackclient/identity/v2_0/endpoint.py
+++ b/openstackclient/identity/v2_0/endpoint.py
@@ -15,10 +15,10 @@
"""Endpoint action implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common
diff --git a/openstackclient/identity/v2_0/project.py b/openstackclient/identity/v2_0/project.py
index 80f88d73..688849fa 100644
--- a/openstackclient/identity/v2_0/project.py
+++ b/openstackclient/identity/v2_0/project.py
@@ -15,13 +15,12 @@
"""Identity v2 Project action implementations"""
-import six
-
from keystoneauth1 import exceptions as ks_exc
+from osc_lib import utils
+import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v2_0/role.py b/openstackclient/identity/v2_0/role.py
index 8914abfd..075234fc 100644
--- a/openstackclient/identity/v2_0/role.py
+++ b/openstackclient/identity/v2_0/role.py
@@ -17,10 +17,10 @@
from keystoneauth1 import exceptions as ks_exc
from osc_lib import exceptions
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v2_0/service.py b/openstackclient/identity/v2_0/service.py
index 1293afc7..631b8737 100644
--- a/openstackclient/identity/v2_0/service.py
+++ b/openstackclient/identity/v2_0/service.py
@@ -18,10 +18,10 @@
import argparse
from osc_lib import exceptions
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common
diff --git a/openstackclient/identity/v2_0/user.py b/openstackclient/identity/v2_0/user.py
index f8f5df29..a10d213b 100644
--- a/openstackclient/identity/v2_0/user.py
+++ b/openstackclient/identity/v2_0/user.py
@@ -15,12 +15,11 @@
"""Identity v2.0 User action implementations"""
-import six
-
from keystoneauth1 import exceptions as ks_exc
+from osc_lib import utils
+import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v3/catalog.py b/openstackclient/identity/v3/catalog.py
index 202c3a3f..a3286003 100644
--- a/openstackclient/identity/v3/catalog.py
+++ b/openstackclient/identity/v3/catalog.py
@@ -14,10 +14,10 @@
"""Identity v3 Service Catalog action implementations"""
from osc_lib import exceptions
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v3/consumer.py b/openstackclient/identity/v3/consumer.py
index a062b743..8aa92f6d 100644
--- a/openstackclient/identity/v3/consumer.py
+++ b/openstackclient/identity/v3/consumer.py
@@ -15,11 +15,12 @@
"""Identity v3 Consumer action implementations"""
-import six
import sys
+from osc_lib import utils
+import six
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v3/credential.py b/openstackclient/identity/v3/credential.py
index 99013478..6c65a206 100644
--- a/openstackclient/identity/v3/credential.py
+++ b/openstackclient/identity/v3/credential.py
@@ -15,10 +15,10 @@
"""Identity v3 Credential action implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v3/domain.py b/openstackclient/identity/v3/domain.py
index c345028f..b0cd4d55 100644
--- a/openstackclient/identity/v3/domain.py
+++ b/openstackclient/identity/v3/domain.py
@@ -15,13 +15,13 @@
"""Identity v3 Domain action implementations"""
-import six
import sys
from keystoneauth1 import exceptions as ks_exc
+from osc_lib import utils
+import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v3/ec2creds.py b/openstackclient/identity/v3/ec2creds.py
index 859ec2a7..fe052a3c 100644
--- a/openstackclient/identity/v3/ec2creds.py
+++ b/openstackclient/identity/v3/ec2creds.py
@@ -12,10 +12,10 @@
"""Identity v3 EC2 Credentials action implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common
diff --git a/openstackclient/identity/v3/endpoint.py b/openstackclient/identity/v3/endpoint.py
index 39022d27..8e433fb9 100644
--- a/openstackclient/identity/v3/endpoint.py
+++ b/openstackclient/identity/v3/endpoint.py
@@ -15,11 +15,12 @@
"""Identity v3 Endpoint action implementations"""
-import six
import sys
+from osc_lib import utils
+import six
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common
diff --git a/openstackclient/identity/v3/federation_protocol.py b/openstackclient/identity/v3/federation_protocol.py
index c0f4bc93..5050ec6f 100644
--- a/openstackclient/identity/v3/federation_protocol.py
+++ b/openstackclient/identity/v3/federation_protocol.py
@@ -14,10 +14,10 @@
"""Identity v3 Protocols actions implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v3/group.py b/openstackclient/identity/v3/group.py
index fdb94da6..85087214 100644
--- a/openstackclient/identity/v3/group.py
+++ b/openstackclient/identity/v3/group.py
@@ -15,13 +15,13 @@
"""Group action implementations"""
-import six
import sys
from keystoneauth1 import exceptions as ks_exc
+from osc_lib import utils
+import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common
diff --git a/openstackclient/identity/v3/identity_provider.py b/openstackclient/identity/v3/identity_provider.py
index 3749aa35..a082f2f4 100644
--- a/openstackclient/identity/v3/identity_provider.py
+++ b/openstackclient/identity/v3/identity_provider.py
@@ -13,10 +13,10 @@
"""Identity v3 IdentityProvider action implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v3/mapping.py b/openstackclient/identity/v3/mapping.py
index acf3a081..723e3bbc 100644
--- a/openstackclient/identity/v3/mapping.py
+++ b/openstackclient/identity/v3/mapping.py
@@ -17,12 +17,11 @@
import json
-import six
-
from osc_lib import exceptions
+from osc_lib import utils
+import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v3/policy.py b/openstackclient/identity/v3/policy.py
index 74a783b0..f0992031 100644
--- a/openstackclient/identity/v3/policy.py
+++ b/openstackclient/identity/v3/policy.py
@@ -15,11 +15,12 @@
"""Identity v3 Policy action implementations"""
-import six
import sys
+from osc_lib import utils
+import six
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v3/project.py b/openstackclient/identity/v3/project.py
index acf639f2..2d504950 100644
--- a/openstackclient/identity/v3/project.py
+++ b/openstackclient/identity/v3/project.py
@@ -15,13 +15,12 @@
"""Project action implementations"""
-import six
-
from keystoneauth1 import exceptions as ks_exc
+from osc_lib import utils
+import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common
diff --git a/openstackclient/identity/v3/region.py b/openstackclient/identity/v3/region.py
index 053e4b31..da8e3632 100644
--- a/openstackclient/identity/v3/region.py
+++ b/openstackclient/identity/v3/region.py
@@ -13,10 +13,10 @@
"""Identity v3 Region action implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v3/role.py b/openstackclient/identity/v3/role.py
index e7078f44..879dbc33 100644
--- a/openstackclient/identity/v3/role.py
+++ b/openstackclient/identity/v3/role.py
@@ -15,13 +15,13 @@
"""Identity v3 Role action implementations"""
-import six
import sys
from keystoneauth1 import exceptions as ks_exc
+from osc_lib import utils
+import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common
diff --git a/openstackclient/identity/v3/role_assignment.py b/openstackclient/identity/v3/role_assignment.py
index 521075fe..5e1d997a 100644
--- a/openstackclient/identity/v3/role_assignment.py
+++ b/openstackclient/identity/v3/role_assignment.py
@@ -13,8 +13,9 @@
"""Identity v3 Assignment action implementations """
+from osc_lib import utils
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common
diff --git a/openstackclient/identity/v3/service.py b/openstackclient/identity/v3/service.py
index 35507a63..450b066c 100644
--- a/openstackclient/identity/v3/service.py
+++ b/openstackclient/identity/v3/service.py
@@ -15,11 +15,12 @@
"""Identity v3 Service action implementations"""
-import six
import sys
+from osc_lib import utils
+import six
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common
diff --git a/openstackclient/identity/v3/service_provider.py b/openstackclient/identity/v3/service_provider.py
index f1e9f35d..5bb15463 100644
--- a/openstackclient/identity/v3/service_provider.py
+++ b/openstackclient/identity/v3/service_provider.py
@@ -13,11 +13,12 @@
"""Service Provider action implementations"""
-import six
import sys
+from osc_lib import utils
+import six
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v3/token.py b/openstackclient/identity/v3/token.py
index 5a47dfdd..0eefbf3b 100644
--- a/openstackclient/identity/v3/token.py
+++ b/openstackclient/identity/v3/token.py
@@ -15,12 +15,11 @@
"""Identity v3 Token action implementations"""
-import six
-
from osc_lib import exceptions
+from osc_lib import utils
+import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common
diff --git a/openstackclient/identity/v3/trust.py b/openstackclient/identity/v3/trust.py
index 336b703c..0f900250 100644
--- a/openstackclient/identity/v3/trust.py
+++ b/openstackclient/identity/v3/trust.py
@@ -14,10 +14,11 @@
"""Identity v3 Trust action implementations"""
import datetime
+
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common
diff --git a/openstackclient/identity/v3/unscoped_saml.py b/openstackclient/identity/v3/unscoped_saml.py
index 6eee27d2..901fa26e 100644
--- a/openstackclient/identity/v3/unscoped_saml.py
+++ b/openstackclient/identity/v3/unscoped_saml.py
@@ -18,9 +18,9 @@ the user can list domains and projects they are allowed to access, and request
a scoped token."""
from osc_lib import exceptions
+from osc_lib import utils
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/identity/v3/user.py b/openstackclient/identity/v3/user.py
index a71b4b78..b2e60f8f 100644
--- a/openstackclient/identity/v3/user.py
+++ b/openstackclient/identity/v3/user.py
@@ -16,13 +16,13 @@
"""Identity v3 User action implementations"""
import copy
-import six
import sys
from keystoneauth1 import exceptions as ks_exc
+from osc_lib import utils
+import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common
diff --git a/openstackclient/image/client.py b/openstackclient/image/client.py
index 9c45a63f..0ef694f4 100644
--- a/openstackclient/image/client.py
+++ b/openstackclient/image/client.py
@@ -15,7 +15,8 @@
import logging
-from openstackclient.common import utils
+from osc_lib import utils
+
from openstackclient.i18n import _
diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py
index e2109fca..73fbe290 100644
--- a/openstackclient/image/v1/image.py
+++ b/openstackclient/image/v1/image.py
@@ -27,10 +27,11 @@ else:
msvcrt = None
from glanceclient.common import utils as gc_utils
+from osc_lib import utils
+
from openstackclient.api import utils as api_utils
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py
index f23ba5e2..668e4ed9 100644
--- a/openstackclient/image/v2/image.py
+++ b/openstackclient/image/v2/image.py
@@ -16,15 +16,15 @@
"""Image V2 Action Implementations"""
import argparse
-import six
from glanceclient.common import utils as gc_utils
from osc_lib import exceptions
+from osc_lib import utils
+import six
from openstackclient.api import utils as api_utils
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common
diff --git a/openstackclient/network/client.py b/openstackclient/network/client.py
index d711f4fc..c81b7d87 100644
--- a/openstackclient/network/client.py
+++ b/openstackclient/network/client.py
@@ -15,8 +15,8 @@ import logging
from openstack import connection
from openstack import profile
+from osc_lib import utils
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/network/v2/address_scope.py b/openstackclient/network/v2/address_scope.py
index 9b670ea4..fc2ff3f3 100644
--- a/openstackclient/network/v2/address_scope.py
+++ b/openstackclient/network/v2/address_scope.py
@@ -14,9 +14,9 @@
"""Address scope action implementations"""
from osc_lib import exceptions
+from osc_lib import utils
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
diff --git a/openstackclient/network/v2/floating_ip.py b/openstackclient/network/v2/floating_ip.py
index 21f86599..c734c2ed 100644
--- a/openstackclient/network/v2/floating_ip.py
+++ b/openstackclient/network/v2/floating_ip.py
@@ -13,7 +13,8 @@
"""IP Floating action implementations"""
-from openstackclient.common import utils
+from osc_lib import utils
+
from openstackclient.i18n import _
from openstackclient.network import common
diff --git a/openstackclient/network/v2/ip_availability.py b/openstackclient/network/v2/ip_availability.py
index ff7b07c7..6974a246 100644
--- a/openstackclient/network/v2/ip_availability.py
+++ b/openstackclient/network/v2/ip_availability.py
@@ -13,8 +13,9 @@
"""IP Availability Info implementations"""
+from osc_lib import utils
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py
index 87e65dad..81e96fb2 100644
--- a/openstackclient/network/v2/network.py
+++ b/openstackclient/network/v2/network.py
@@ -13,8 +13,9 @@
"""Network action implementations"""
+from osc_lib import utils
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
from openstackclient.network import common
diff --git a/openstackclient/network/v2/network_segment.py b/openstackclient/network/v2/network_segment.py
index 818ffc02..e965d2eb 100644
--- a/openstackclient/network/v2/network_segment.py
+++ b/openstackclient/network/v2/network_segment.py
@@ -15,8 +15,9 @@
# TODO(rtheis): Add description and name properties when support is available.
+from osc_lib import utils
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py
index ae6d2dff..643207d9 100644
--- a/openstackclient/network/v2/port.py
+++ b/openstackclient/network/v2/port.py
@@ -17,10 +17,10 @@ import argparse
import logging
from osc_lib import exceptions
+from osc_lib import utils
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
diff --git a/openstackclient/network/v2/router.py b/openstackclient/network/v2/router.py
index 60908294..eab8b22c 100644
--- a/openstackclient/network/v2/router.py
+++ b/openstackclient/network/v2/router.py
@@ -17,9 +17,10 @@ import argparse
import json
import logging
+from osc_lib import utils
+
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
diff --git a/openstackclient/network/v2/security_group.py b/openstackclient/network/v2/security_group.py
index 1ef2754e..95971800 100644
--- a/openstackclient/network/v2/security_group.py
+++ b/openstackclient/network/v2/security_group.py
@@ -14,9 +14,10 @@
"""Security Group action implementations"""
import argparse
+
+from osc_lib import utils
import six
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
from openstackclient.network import common
diff --git a/openstackclient/network/v2/security_group_rule.py b/openstackclient/network/v2/security_group_rule.py
index a7f4fa7e..0132ef4e 100644
--- a/openstackclient/network/v2/security_group_rule.py
+++ b/openstackclient/network/v2/security_group_rule.py
@@ -21,10 +21,10 @@ except ImportError:
from novaclient.v1_1 import security_group_rules as compute_secgroup_rules
from osc_lib import exceptions
+from osc_lib import utils
import six
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
from openstackclient.network import common
diff --git a/openstackclient/network/v2/subnet.py b/openstackclient/network/v2/subnet.py
index 95c7e1ae..2b12ee03 100644
--- a/openstackclient/network/v2/subnet.py
+++ b/openstackclient/network/v2/subnet.py
@@ -16,10 +16,10 @@
import copy
from osc_lib import exceptions
+from osc_lib import utils
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
diff --git a/openstackclient/network/v2/subnet_pool.py b/openstackclient/network/v2/subnet_pool.py
index 17f1e97d..23993300 100644
--- a/openstackclient/network/v2/subnet_pool.py
+++ b/openstackclient/network/v2/subnet_pool.py
@@ -13,9 +13,10 @@
"""Subnet pool action implementations"""
+from osc_lib import utils
+
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
diff --git a/openstackclient/object/client.py b/openstackclient/object/client.py
index 3af6f8a0..cb3ddc28 100644
--- a/openstackclient/object/client.py
+++ b/openstackclient/object/client.py
@@ -15,8 +15,9 @@
"""Object client"""
+from osc_lib import utils
+
from openstackclient.api import object_store_v1
-from openstackclient.common import utils
DEFAULT_API_VERSION = '1'
API_VERSION_OPTION = 'os_object_api_version'
diff --git a/openstackclient/object/v1/account.py b/openstackclient/object/v1/account.py
index 543ce4f3..189f086b 100644
--- a/openstackclient/object/v1/account.py
+++ b/openstackclient/object/v1/account.py
@@ -13,11 +13,11 @@
"""Account v1 action implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
class SetAccount(command.Command):
diff --git a/openstackclient/object/v1/container.py b/openstackclient/object/v1/container.py
index 80b84238..b3c6af74 100644
--- a/openstackclient/object/v1/container.py
+++ b/openstackclient/object/v1/container.py
@@ -16,11 +16,11 @@
"""Container v1 action implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
class CreateContainer(command.Lister):
diff --git a/openstackclient/object/v1/object.py b/openstackclient/object/v1/object.py
index f9a55e9c..9141c1da 100644
--- a/openstackclient/object/v1/object.py
+++ b/openstackclient/object/v1/object.py
@@ -16,11 +16,11 @@
"""Object v1 action implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
class CreateObject(command.Lister):
diff --git a/openstackclient/shell.py b/openstackclient/shell.py
index f2881d00..2697128b 100644
--- a/openstackclient/shell.py
+++ b/openstackclient/shell.py
@@ -27,6 +27,7 @@ from cliff import command
from cliff import complete
from cliff import help
from osc_lib import exceptions as exc
+from osc_lib import utils
from oslo_utils import importutils
from oslo_utils import strutils
@@ -35,7 +36,6 @@ from openstackclient.common import clientmanager
from openstackclient.common import commandmanager
from openstackclient.common import logs
from openstackclient.common import timing
-from openstackclient.common import utils
from os_client_config import config as cloud_config
diff --git a/openstackclient/tests/common/test_utils.py b/openstackclient/tests/common/test_utils.py
deleted file mode 100644
index e521530a..00000000
--- a/openstackclient/tests/common/test_utils.py
+++ /dev/null
@@ -1,401 +0,0 @@
-# Copyright 2012-2013 OpenStack, LLC.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-#
-
-import time
-import uuid
-
-import mock
-
-from osc_lib import exceptions
-
-from openstackclient.common import utils
-from openstackclient.tests import fakes
-from openstackclient.tests import utils as test_utils
-
-PASSWORD = "Pa$$w0rd"
-WASSPORD = "Wa$$p0rd"
-DROWSSAP = "dr0w$$aP"
-
-
-class FakeOddballResource(fakes.FakeResource):
-
- def get(self, attr):
- """get() is needed for utils.find_resource()"""
- if attr == 'id':
- return self.id
- elif attr == 'name':
- return self.name
- else:
- return None
-
-
-class TestUtils(test_utils.TestCase):
-
- def test_get_password_good(self):
- with mock.patch("getpass.getpass", return_value=PASSWORD):
- mock_stdin = mock.Mock()
- mock_stdin.isatty = mock.Mock()
- mock_stdin.isatty.return_value = True
- self.assertEqual(PASSWORD, utils.get_password(mock_stdin))
-
- def test_get_password_bad_once(self):
- answers = [PASSWORD, WASSPORD, DROWSSAP, DROWSSAP]
- with mock.patch("getpass.getpass", side_effect=answers):
- mock_stdin = mock.Mock()
- mock_stdin.isatty = mock.Mock()
- mock_stdin.isatty.return_value = True
- self.assertEqual(DROWSSAP, utils.get_password(mock_stdin))
-
- def test_get_password_no_tty(self):
- mock_stdin = mock.Mock()
- mock_stdin.isatty = mock.Mock()
- mock_stdin.isatty.return_value = False
- self.assertRaises(exceptions.CommandError,
- utils.get_password,
- mock_stdin)
-
- def test_get_password_cntrl_d(self):
- with mock.patch("getpass.getpass", side_effect=EOFError()):
- mock_stdin = mock.Mock()
- mock_stdin.isatty = mock.Mock()
- mock_stdin.isatty.return_value = True
- self.assertRaises(exceptions.CommandError,
- utils.get_password,
- mock_stdin)
-
- def get_test_items(self):
- item1 = {'a': 1, 'b': 2}
- item2 = {'a': 1, 'b': 3}
- item3 = {'a': 2, 'b': 2}
- item4 = {'a': 2, 'b': 1}
- return [item1, item2, item3, item4]
-
- def test_sort_items_with_one_key(self):
- items = self.get_test_items()
- sort_str = 'b'
- expect_items = [items[3], items[0], items[2], items[1]]
- self.assertEqual(expect_items, utils.sort_items(items, sort_str))
-
- def test_sort_items_with_multiple_keys(self):
- items = self.get_test_items()
- sort_str = 'a,b'
- expect_items = [items[0], items[1], items[3], items[2]]
- self.assertEqual(expect_items, utils.sort_items(items, sort_str))
-
- def test_sort_items_all_with_direction(self):
- items = self.get_test_items()
- sort_str = 'a:desc,b:desc'
- expect_items = [items[2], items[3], items[1], items[0]]
- self.assertEqual(expect_items, utils.sort_items(items, sort_str))
-
- def test_sort_items_some_with_direction(self):
- items = self.get_test_items()
- sort_str = 'a,b:desc'
- expect_items = [items[1], items[0], items[2], items[3]]
- self.assertEqual(expect_items, utils.sort_items(items, sort_str))
-
- def test_sort_items_with_object(self):
- item1 = mock.Mock(a=1, b=2)
- item2 = mock.Mock(a=1, b=3)
- item3 = mock.Mock(a=2, b=2)
- item4 = mock.Mock(a=2, b=1)
- items = [item1, item2, item3, item4]
- sort_str = 'b,a'
- expect_items = [item4, item1, item3, item2]
- self.assertEqual(expect_items, utils.sort_items(items, sort_str))
-
- def test_sort_items_with_empty_key(self):
- items = self.get_test_items()
- sort_srt = ''
- self.assertEqual(items, utils.sort_items(items, sort_srt))
- sort_srt = None
- self.assertEqual(items, utils.sort_items(items, sort_srt))
-
- def test_sort_items_with_invalid_key(self):
- items = self.get_test_items()
- sort_str = 'c'
- self.assertRaises(exceptions.CommandError,
- utils.sort_items,
- items, sort_str)
-
- def test_sort_items_with_invalid_direction(self):
- items = self.get_test_items()
- sort_str = 'a:bad_dir'
- self.assertRaises(exceptions.CommandError,
- utils.sort_items,
- items, sort_str)
-
- @mock.patch.object(time, 'sleep')
- def test_wait_for_status_ok(self, mock_sleep):
- # Tests the normal flow that the resource is status=active
- resource = mock.MagicMock(status='ACTIVE')
- status_f = mock.Mock(return_value=resource)
- res_id = str(uuid.uuid4())
- self.assertTrue(utils.wait_for_status(status_f, res_id,))
- mock_sleep.assert_not_called()
-
- @mock.patch.object(time, 'sleep')
- def test_wait_for_status_ok__with_overrides(self, mock_sleep):
- # Tests the normal flow that the resource is status=complete
- resource = mock.MagicMock(my_status='COMPLETE')
- status_f = mock.Mock(return_value=resource)
- res_id = str(uuid.uuid4())
- self.assertTrue(utils.wait_for_status(status_f, res_id,
- status_field='my_status',
- success_status=['complete']))
- mock_sleep.assert_not_called()
-
- @mock.patch.object(time, 'sleep')
- def test_wait_for_status_error(self, mock_sleep):
- # Tests that we fail if the resource is status=error
- resource = mock.MagicMock(status='ERROR')
- status_f = mock.Mock(return_value=resource)
- res_id = str(uuid.uuid4())
- self.assertFalse(utils.wait_for_status(status_f, res_id))
- mock_sleep.assert_not_called()
-
- @mock.patch.object(time, 'sleep')
- def test_wait_for_status_error_with_overrides(self, mock_sleep):
- # Tests that we fail if the resource is my_status=failed
- resource = mock.MagicMock(my_status='FAILED')
- status_f = mock.Mock(return_value=resource)
- res_id = str(uuid.uuid4())
- self.assertFalse(utils.wait_for_status(status_f, res_id,
- status_field='my_status',
- error_status=['failed']))
- mock_sleep.assert_not_called()
-
- @mock.patch.object(time, 'sleep')
- def test_wait_for_delete_ok(self, mock_sleep):
- # Tests the normal flow that the resource is deleted with a 404 coming
- # back on the 2nd iteration of the wait loop.
- resource = mock.MagicMock(status='ACTIVE', progress=None)
- mock_get = mock.Mock(side_effect=[resource,
- exceptions.NotFound(404)])
- manager = mock.MagicMock(get=mock_get)
- res_id = str(uuid.uuid4())
- callback = mock.Mock()
- self.assertTrue(utils.wait_for_delete(manager, res_id,
- callback=callback))
- mock_sleep.assert_called_once_with(5)
- callback.assert_called_once_with(0)
-
- @mock.patch.object(time, 'sleep')
- def test_wait_for_delete_timeout(self, mock_sleep):
- # Tests that we fail if the resource is not deleted before the timeout.
- resource = mock.MagicMock(status='ACTIVE')
- mock_get = mock.Mock(return_value=resource)
- manager = mock.MagicMock(get=mock_get)
- res_id = str(uuid.uuid4())
- self.assertFalse(utils.wait_for_delete(manager, res_id, sleep_time=1,
- timeout=1))
- mock_sleep.assert_called_once_with(1)
-
- @mock.patch.object(time, 'sleep')
- def test_wait_for_delete_error(self, mock_sleep):
- # Tests that we fail if the resource goes to error state while waiting.
- resource = mock.MagicMock(status='ERROR')
- mock_get = mock.Mock(return_value=resource)
- manager = mock.MagicMock(get=mock_get)
- res_id = str(uuid.uuid4())
- self.assertFalse(utils.wait_for_delete(manager, res_id))
- mock_sleep.assert_not_called()
-
- @mock.patch.object(time, 'sleep')
- def test_wait_for_delete_error_with_overrides(self, mock_sleep):
- # Tests that we fail if the resource is my_status=failed
- resource = mock.MagicMock(my_status='FAILED')
- mock_get = mock.Mock(return_value=resource)
- manager = mock.MagicMock(get=mock_get)
- res_id = str(uuid.uuid4())
- self.assertFalse(utils.wait_for_delete(manager, res_id,
- status_field='my_status',
- error_status=['failed']))
- mock_sleep.assert_not_called()
-
- @mock.patch.object(time, 'sleep')
- def test_wait_for_delete_error_with_overrides_exception(self, mock_sleep):
- # Tests that we succeed if the resource is specific exception
- mock_get = mock.Mock(side_effect=Exception)
- manager = mock.MagicMock(get=mock_get)
- res_id = str(uuid.uuid4())
- self.assertTrue(utils.wait_for_delete(manager, res_id,
- exception_name=['Exception']))
- mock_sleep.assert_not_called()
-
- def test_build_kwargs_dict_value_set(self):
- self.assertEqual({'arg_bla': 'bla'},
- utils.build_kwargs_dict('arg_bla', 'bla'))
-
- def test_build_kwargs_dict_value_None(self):
- self.assertEqual({}, utils.build_kwargs_dict('arg_bla', None))
-
- def test_build_kwargs_dict_value_empty_str(self):
- self.assertEqual({}, utils.build_kwargs_dict('arg_bla', ''))
-
-
-class NoUniqueMatch(Exception):
- pass
-
-
-class TestFindResource(test_utils.TestCase):
-
- def setUp(self):
- super(TestFindResource, self).setUp()
- self.name = 'legos'
- self.expected = mock.Mock()
- self.manager = mock.Mock()
- self.manager.resource_class = mock.Mock()
- self.manager.resource_class.__name__ = 'lego'
-
- def test_find_resource_get_int(self):
- self.manager.get = mock.Mock(return_value=self.expected)
- result = utils.find_resource(self.manager, 1)
- self.assertEqual(self.expected, result)
- self.manager.get.assert_called_with(1)
-
- def test_find_resource_get_int_string(self):
- self.manager.get = mock.Mock(return_value=self.expected)
- result = utils.find_resource(self.manager, "2")
- self.assertEqual(self.expected, result)
- self.manager.get.assert_called_with(2)
-
- def test_find_resource_get_uuid(self):
- uuid = '9a0dc2a0-ad0d-11e3-a5e2-0800200c9a66'
- self.manager.get = mock.Mock(return_value=self.expected)
- result = utils.find_resource(self.manager, uuid)
- self.assertEqual(self.expected, result)
- self.manager.get.assert_called_with(uuid)
-
- def test_find_resource_get_whatever(self):
- self.manager.get = mock.Mock(return_value=self.expected)
- result = utils.find_resource(self.manager, 'whatever')
- self.assertEqual(self.expected, result)
- self.manager.get.assert_called_with('whatever')
-
- def test_find_resource_find(self):
- self.manager.get = mock.Mock(side_effect=Exception('Boom!'))
- self.manager.find = mock.Mock(return_value=self.expected)
- result = utils.find_resource(self.manager, self.name)
- self.assertEqual(self.expected, result)
- self.manager.get.assert_called_with(self.name)
- self.manager.find.assert_called_with(name=self.name)
-
- def test_find_resource_find_not_found(self):
- self.manager.get = mock.Mock(side_effect=Exception('Boom!'))
- self.manager.find = mock.Mock(
- side_effect=exceptions.NotFound(404, "2")
- )
- result = self.assertRaises(exceptions.CommandError,
- utils.find_resource,
- self.manager,
- self.name)
- self.assertEqual("No lego with a name or ID of 'legos' exists.",
- str(result))
- self.manager.get.assert_called_with(self.name)
- self.manager.find.assert_called_with(name=self.name)
-
- def test_find_resource_list_forbidden(self):
- self.manager.get = mock.Mock(side_effect=Exception('Boom!'))
- self.manager.find = mock.Mock(side_effect=Exception('Boom!'))
- self.manager.list = mock.Mock(
- side_effect=exceptions.Forbidden(403)
- )
- self.assertRaises(exceptions.Forbidden,
- utils.find_resource,
- self.manager,
- self.name)
- self.manager.list.assert_called_with()
-
- def test_find_resource_find_no_unique(self):
- self.manager.get = mock.Mock(side_effect=Exception('Boom!'))
- self.manager.find = mock.Mock(side_effect=NoUniqueMatch())
- result = self.assertRaises(exceptions.CommandError,
- utils.find_resource,
- self.manager,
- self.name)
- self.assertEqual("More than one lego exists with the name 'legos'.",
- str(result))
- self.manager.get.assert_called_with(self.name)
- self.manager.find.assert_called_with(name=self.name)
-
- def test_find_resource_silly_resource(self):
- # We need a resource with no resource_class for this test, start fresh
- self.manager = mock.Mock()
- self.manager.get = mock.Mock(side_effect=Exception('Boom!'))
- self.manager.find = mock.Mock(
- side_effect=AttributeError(
- "'Controller' object has no attribute 'find'",
- )
- )
- silly_resource = FakeOddballResource(
- None,
- {'id': '12345', 'name': self.name},
- loaded=True,
- )
- self.manager.list = mock.Mock(
- return_value=[silly_resource, ],
- )
- result = utils.find_resource(self.manager, self.name)
- self.assertEqual(silly_resource, result)
- self.manager.get.assert_called_with(self.name)
- self.manager.find.assert_called_with(name=self.name)
-
- def test_find_resource_silly_resource_not_found(self):
- # We need a resource with no resource_class for this test, start fresh
- self.manager = mock.Mock()
- self.manager.get = mock.Mock(side_effect=Exception('Boom!'))
- self.manager.find = mock.Mock(
- side_effect=AttributeError(
- "'Controller' object has no attribute 'find'",
- )
- )
- self.manager.list = mock.Mock(return_value=[])
- result = self.assertRaises(exceptions.CommandError,
- utils.find_resource,
- self.manager,
- self.name)
- self.assertEqual("Could not find resource legos",
- str(result))
- self.manager.get.assert_called_with(self.name)
- self.manager.find.assert_called_with(name=self.name)
-
- def test_format_dict(self):
- expected = "a='b', c='d', e='f'"
- self.assertEqual(expected,
- utils.format_dict({'a': 'b', 'c': 'd', 'e': 'f'}))
- self.assertEqual(expected,
- utils.format_dict({'e': 'f', 'c': 'd', 'a': 'b'}))
-
- def test_format_list(self):
- expected = 'a, b, c'
- self.assertEqual(expected, utils.format_list(['a', 'b', 'c']))
- self.assertEqual(expected, utils.format_list(['c', 'b', 'a']))
-
- def test_format_list_of_dicts(self):
- expected = "a='b', c='d'\ne='f'"
- sorted_data = [{'a': 'b', 'c': 'd'}, {'e': 'f'}]
- unsorted_data = [{'c': 'd', 'a': 'b'}, {'e': 'f'}]
- self.assertEqual(expected, utils.format_list_of_dicts(sorted_data))
- self.assertEqual(expected, utils.format_list_of_dicts(unsorted_data))
- self.assertEqual('', utils.format_list_of_dicts([]))
- self.assertEqual('', utils.format_list_of_dicts([{}]))
-
- def test_format_list_separator(self):
- expected = 'a\nb\nc'
- actual_pre_sorted = utils.format_list(['a', 'b', 'c'], separator='\n')
- actual_unsorted = utils.format_list(['c', 'b', 'a'], separator='\n')
- self.assertEqual(expected, actual_pre_sorted)
- self.assertEqual(expected, actual_unsorted)
diff --git a/openstackclient/tests/compute/v2/test_flavor.py b/openstackclient/tests/compute/v2/test_flavor.py
index 139585c2..8ce7bb27 100644
--- a/openstackclient/tests/compute/v2/test_flavor.py
+++ b/openstackclient/tests/compute/v2/test_flavor.py
@@ -16,8 +16,8 @@
import copy
from osc_lib import exceptions
+from osc_lib import utils
-from openstackclient.common import utils
from openstackclient.compute.v2 import flavor
from openstackclient.tests.compute.v2 import fakes as compute_fakes
from openstackclient.tests import fakes
diff --git a/openstackclient/tests/compute/v2/test_server.py b/openstackclient/tests/compute/v2/test_server.py
index bd736248..e10f43a1 100644
--- a/openstackclient/tests/compute/v2/test_server.py
+++ b/openstackclient/tests/compute/v2/test_server.py
@@ -17,8 +17,8 @@ import mock
from mock import call
from osc_lib import exceptions
+from osc_lib import utils as common_utils
-from openstackclient.common import utils as common_utils
from openstackclient.compute.v2 import server
from openstackclient.tests.compute.v2 import fakes as compute_fakes
from openstackclient.tests.image.v2 import fakes as image_fakes
@@ -1692,7 +1692,7 @@ class TestServerGeneral(TestServer):
(data_1, data_2, networks_format))
self.assertIn(networks_format, (data_1, data_2), msg)
- @mock.patch('openstackclient.common.utils.find_resource')
+ @mock.patch('osc_lib.utils.find_resource')
def test_prep_server_detail(self, find_resource):
# Setup mock method return value. utils.find_resource() will be called
# three times in _prep_server_detail():
diff --git a/openstackclient/tests/compute/v2/test_server_backup.py b/openstackclient/tests/compute/v2/test_server_backup.py
index 3495d1b8..b6802ff0 100644
--- a/openstackclient/tests/compute/v2/test_server_backup.py
+++ b/openstackclient/tests/compute/v2/test_server_backup.py
@@ -14,8 +14,8 @@
import mock
from osc_lib import exceptions
+from osc_lib import utils as common_utils
-from openstackclient.common import utils as common_utils
from openstackclient.compute.v2 import server_backup
from openstackclient.tests.compute.v2 import fakes as compute_fakes
from openstackclient.tests.image.v2 import fakes as image_fakes
diff --git a/openstackclient/tests/compute/v2/test_server_group.py b/openstackclient/tests/compute/v2/test_server_group.py
index 4e0dbe45..bd5f8471 100644
--- a/openstackclient/tests/compute/v2/test_server_group.py
+++ b/openstackclient/tests/compute/v2/test_server_group.py
@@ -16,8 +16,8 @@
import mock
from osc_lib import exceptions
+from osc_lib import utils
-from openstackclient.common import utils
from openstackclient.compute.v2 import server_group
from openstackclient.tests.compute.v2 import fakes as compute_fakes
from openstackclient.tests import utils as tests_utils
diff --git a/openstackclient/tests/identity/v2_0/test_user.py b/openstackclient/tests/identity/v2_0/test_user.py
index 921e215d..caf38a6f 100644
--- a/openstackclient/tests/identity/v2_0/test_user.py
+++ b/openstackclient/tests/identity/v2_0/test_user.py
@@ -152,7 +152,7 @@ class TestUserCreate(TestUser):
# data to be shown.
mocker = mock.Mock()
mocker.return_value = 'abc123'
- with mock.patch("openstackclient.common.utils.get_password", mocker):
+ with mock.patch("osc_lib.utils.get_password", mocker):
columns, data = self.cmd.take_action(parsed_args)
# Set expected values
@@ -638,7 +638,7 @@ class TestUserSet(TestUser):
mocker = mock.Mock()
mocker.return_value = 'abc123'
- with mock.patch("openstackclient.common.utils.get_password", mocker):
+ with mock.patch("osc_lib.utils.get_password", mocker):
result = self.cmd.take_action(parsed_args)
# UserManager.update_password(user, password)
diff --git a/openstackclient/tests/identity/v3/test_project.py b/openstackclient/tests/identity/v3/test_project.py
index 5be4e389..8fcada6e 100644
--- a/openstackclient/tests/identity/v3/test_project.py
+++ b/openstackclient/tests/identity/v3/test_project.py
@@ -202,7 +202,7 @@ class TestProjectCreate(TestProject):
mocker = mock.Mock()
mocker.return_value = None
- with mock.patch("openstackclient.common.utils.find_resource", mocker):
+ with mock.patch("osc_lib.utils.find_resource", mocker):
columns, data = self.cmd.take_action(parsed_args)
# Set expected values
@@ -549,7 +549,7 @@ class TestProjectList(TestProject):
mocker = mock.Mock()
mocker.return_value = None
- with mock.patch("openstackclient.common.utils.find_resource", mocker):
+ with mock.patch("osc_lib.utils.find_resource", mocker):
columns, data = self.cmd.take_action(parsed_args)
self.projects_mock.list.assert_called_with(
diff --git a/openstackclient/tests/identity/v3/test_user.py b/openstackclient/tests/identity/v3/test_user.py
index 5dafa772..85522e57 100644
--- a/openstackclient/tests/identity/v3/test_user.py
+++ b/openstackclient/tests/identity/v3/test_user.py
@@ -185,7 +185,7 @@ class TestUserCreate(TestUser):
# data to be shown.
mocker = mock.Mock()
mocker.return_value = 'abc123'
- with mock.patch("openstackclient.common.utils.get_password", mocker):
+ with mock.patch("osc_lib.utils.get_password", mocker):
columns, data = self.cmd.take_action(parsed_args)
# Set expected values
@@ -841,7 +841,7 @@ class TestUserSet(TestUser):
mocker = mock.Mock()
mocker.return_value = 'abc123'
- with mock.patch("openstackclient.common.utils.get_password", mocker):
+ with mock.patch("osc_lib.utils.get_password", mocker):
result = self.cmd.take_action(parsed_args)
# Set expected values
@@ -1023,7 +1023,7 @@ class TestUserSetPassword(TestUser):
@contextlib.contextmanager
def _mock_get_password(*passwords):
mocker = mock.Mock(side_effect=passwords)
- with mock.patch("openstackclient.common.utils.get_password", mocker):
+ with mock.patch("osc_lib.utils.get_password", mocker):
yield
def test_user_password_change(self):
diff --git a/openstackclient/tests/image/v1/test_image.py b/openstackclient/tests/image/v1/test_image.py
index b0436b9a..99c0b0ee 100644
--- a/openstackclient/tests/image/v1/test_image.py
+++ b/openstackclient/tests/image/v1/test_image.py
@@ -417,7 +417,7 @@ class TestImageList(TestImage):
self.assertEqual(self.columns, columns)
self.assertEqual(self.datalist, tuple(data))
- @mock.patch('openstackclient.common.utils.sort_items')
+ @mock.patch('osc_lib.utils.sort_items')
def test_image_list_sort_option(self, si_mock):
si_mock.side_effect = [
[copy.deepcopy(image_fakes.IMAGE)], [],
diff --git a/openstackclient/tests/image/v2/fakes.py b/openstackclient/tests/image/v2/fakes.py
index 24aaec51..8e22fbb2 100644
--- a/openstackclient/tests/image/v2/fakes.py
+++ b/openstackclient/tests/image/v2/fakes.py
@@ -19,13 +19,12 @@ import random
import uuid
from glanceclient.v2 import schemas
+from osc_lib import utils as common_utils
import warlock
-from openstackclient.common import utils as common_utils
from openstackclient.tests import fakes
-from openstackclient.tests import utils
-
from openstackclient.tests.identity.v3 import fakes as identity_fakes
+from openstackclient.tests import utils
image_id = '0f41529e-7c12-4de8-be2d-181abb825b3c'
image_name = 'graven'
diff --git a/openstackclient/tests/image/v2/test_image.py b/openstackclient/tests/image/v2/test_image.py
index d8693df0..92e0660f 100644
--- a/openstackclient/tests/image/v2/test_image.py
+++ b/openstackclient/tests/image/v2/test_image.py
@@ -20,8 +20,8 @@ import warlock
from glanceclient.v2 import schemas
from osc_lib import exceptions
+from osc_lib import utils as common_utils
-from openstackclient.common import utils as common_utils
from openstackclient.image.v2 import image
from openstackclient.tests import fakes
from openstackclient.tests.identity.v3 import fakes as identity_fakes
@@ -661,7 +661,7 @@ class TestImageList(TestImage):
self.assertEqual(self.columns, columns)
self.assertEqual(self.datalist, tuple(data))
- @mock.patch('openstackclient.common.utils.sort_items')
+ @mock.patch('osc_lib.utils.sort_items')
def test_image_list_sort_option(self, si_mock):
si_mock.return_value = [copy.deepcopy(self._image)]
@@ -698,7 +698,7 @@ class TestImageList(TestImage):
self.assertEqual(self.columns, columns)
self.assertEqual(len(self.datalist), len(tuple(data)))
- @mock.patch('openstackclient.common.utils.find_resource')
+ @mock.patch('osc_lib.utils.find_resource')
def test_image_list_marker_option(self, fr_mock):
# tangchen: Since image_fakes.IMAGE is a dict, it cannot offer a .id
# operation. Will fix this by using FakeImage class instead
diff --git a/openstackclient/tests/network/v2/test_ip_availability.py b/openstackclient/tests/network/v2/test_ip_availability.py
index 04979e77..39e11cd5 100644
--- a/openstackclient/tests/network/v2/test_ip_availability.py
+++ b/openstackclient/tests/network/v2/test_ip_availability.py
@@ -14,7 +14,8 @@
import copy
import mock
-from openstackclient.common import utils as osc_utils
+from osc_lib import utils as common_utils
+
from openstackclient.network.v2 import ip_availability
from openstackclient.tests import fakes
from openstackclient.tests.identity.v3 import fakes as identity_fakes
@@ -140,7 +141,7 @@ class TestShowIPAvailability(TestIPAvailability):
_ip_availability.network_id,
_ip_availability.network_name,
_ip_availability.tenant_id,
- osc_utils.format_list(
+ common_utils.format_list(
_ip_availability.subnet_ip_availability),
_ip_availability.total_ips,
_ip_availability.used_ips,
diff --git a/openstackclient/tests/network/v2/test_network.py b/openstackclient/tests/network/v2/test_network.py
index 581e9278..8fc9dadf 100644
--- a/openstackclient/tests/network/v2/test_network.py
+++ b/openstackclient/tests/network/v2/test_network.py
@@ -16,8 +16,8 @@ import mock
from mock import call
from osc_lib import exceptions
+from osc_lib import utils
-from openstackclient.common import utils
from openstackclient.network.v2 import network
from openstackclient.tests.compute.v2 import fakes as compute_fakes
from openstackclient.tests import fakes
diff --git a/openstackclient/tests/network/v2/test_port.py b/openstackclient/tests/network/v2/test_port.py
index 02c7d4a4..779dca05 100644
--- a/openstackclient/tests/network/v2/test_port.py
+++ b/openstackclient/tests/network/v2/test_port.py
@@ -15,8 +15,8 @@ import mock
from mock import call
from osc_lib import exceptions
+from osc_lib import utils
-from openstackclient.common import utils
from openstackclient.network.v2 import port
from openstackclient.tests.network.v2 import fakes as network_fakes
from openstackclient.tests import utils as tests_utils
diff --git a/openstackclient/tests/network/v2/test_router.py b/openstackclient/tests/network/v2/test_router.py
index b25381ef..16296139 100644
--- a/openstackclient/tests/network/v2/test_router.py
+++ b/openstackclient/tests/network/v2/test_router.py
@@ -13,7 +13,8 @@
import mock
-from openstackclient.common import utils as osc_utils
+from osc_lib import utils as osc_utils
+
from openstackclient.network.v2 import router
from openstackclient.tests.network.v2 import fakes as network_fakes
from openstackclient.tests import utils as tests_utils
diff --git a/openstackclient/tests/network/v2/test_subnet.py b/openstackclient/tests/network/v2/test_subnet.py
index 25684d63..de7e1821 100644
--- a/openstackclient/tests/network/v2/test_subnet.py
+++ b/openstackclient/tests/network/v2/test_subnet.py
@@ -14,7 +14,8 @@
import copy
import mock
-from openstackclient.common import utils
+from osc_lib import utils
+
from openstackclient.network.v2 import subnet as subnet_v2
from openstackclient.tests import fakes
from openstackclient.tests.identity.v3 import fakes as identity_fakes_v3
diff --git a/openstackclient/tests/network/v2/test_subnet_pool.py b/openstackclient/tests/network/v2/test_subnet_pool.py
index f7bb5895..10ef76d8 100644
--- a/openstackclient/tests/network/v2/test_subnet_pool.py
+++ b/openstackclient/tests/network/v2/test_subnet_pool.py
@@ -15,7 +15,8 @@ import argparse
import copy
import mock
-from openstackclient.common import utils
+from osc_lib import utils
+
from openstackclient.network.v2 import subnet_pool
from openstackclient.tests import fakes
from openstackclient.tests.identity.v3 import fakes as identity_fakes_v3
diff --git a/openstackclient/tests/volume/test_find_resource.py b/openstackclient/tests/volume/test_find_resource.py
index d29a955d..227d6ca7 100644
--- a/openstackclient/tests/volume/test_find_resource.py
+++ b/openstackclient/tests/volume/test_find_resource.py
@@ -18,8 +18,8 @@ import mock
from cinderclient.v1 import volume_snapshots
from cinderclient.v1 import volumes
from osc_lib import exceptions
+from osc_lib import utils
-from openstackclient.common import utils
from openstackclient.tests import utils as test_utils
from openstackclient.volume import client # noqa
diff --git a/openstackclient/tests/volume/v1/test_qos_specs.py b/openstackclient/tests/volume/v1/test_qos_specs.py
index 4943f5df..392017c6 100644
--- a/openstackclient/tests/volume/v1/test_qos_specs.py
+++ b/openstackclient/tests/volume/v1/test_qos_specs.py
@@ -15,7 +15,8 @@
import copy
-from openstackclient.common import utils
+from osc_lib import utils
+
from openstackclient.tests import fakes
from openstackclient.tests.volume.v1 import fakes as volume_fakes
from openstackclient.volume.v1 import qos_specs
diff --git a/openstackclient/tests/volume/v2/fakes.py b/openstackclient/tests/volume/v2/fakes.py
index d3ca009e..1cbbf68a 100644
--- a/openstackclient/tests/volume/v2/fakes.py
+++ b/openstackclient/tests/volume/v2/fakes.py
@@ -17,7 +17,8 @@ import mock
import random
import uuid
-from openstackclient.common import utils as common_utils
+from osc_lib import utils as common_utils
+
from openstackclient.tests import fakes
from openstackclient.tests.identity.v3 import fakes as identity_fakes
from openstackclient.tests.image.v2 import fakes as image_fakes
diff --git a/openstackclient/tests/volume/v2/test_qos_specs.py b/openstackclient/tests/volume/v2/test_qos_specs.py
index 741f4e70..11047535 100644
--- a/openstackclient/tests/volume/v2/test_qos_specs.py
+++ b/openstackclient/tests/volume/v2/test_qos_specs.py
@@ -13,9 +13,9 @@
# under the License.
#
-from openstackclient.common import utils
from openstackclient.tests.volume.v2 import fakes as volume_fakes
from openstackclient.volume.v2 import qos_specs
+from osc_lib import utils
class TestQos(volume_fakes.TestVolume):
diff --git a/openstackclient/tests/volume/v2/test_snapshot.py b/openstackclient/tests/volume/v2/test_snapshot.py
index fe6fbb52..ef199cbc 100644
--- a/openstackclient/tests/volume/v2/test_snapshot.py
+++ b/openstackclient/tests/volume/v2/test_snapshot.py
@@ -12,7 +12,8 @@
# under the License.
#
-from openstackclient.common import utils
+from osc_lib import utils
+
from openstackclient.tests.volume.v2 import fakes as volume_fakes
from openstackclient.volume.v2 import snapshot
diff --git a/openstackclient/tests/volume/v2/test_type.py b/openstackclient/tests/volume/v2/test_type.py
index 10c38612..7eea1c3c 100644
--- a/openstackclient/tests/volume/v2/test_type.py
+++ b/openstackclient/tests/volume/v2/test_type.py
@@ -14,7 +14,8 @@
import copy
-from openstackclient.common import utils
+from osc_lib import utils
+
from openstackclient.tests import fakes
from openstackclient.tests.identity.v3 import fakes as identity_fakes
from openstackclient.tests import utils as tests_utils
diff --git a/openstackclient/tests/volume/v2/test_volume.py b/openstackclient/tests/volume/v2/test_volume.py
index fb48d8ac..68158df0 100644
--- a/openstackclient/tests/volume/v2/test_volume.py
+++ b/openstackclient/tests/volume/v2/test_volume.py
@@ -16,7 +16,8 @@ import copy
from mock import call
-from openstackclient.common import utils
+from osc_lib import utils
+
from openstackclient.tests import fakes
from openstackclient.tests.identity.v3 import fakes as identity_fakes
from openstackclient.tests.image.v2 import fakes as image_fakes
diff --git a/openstackclient/volume/client.py b/openstackclient/volume/client.py
index a60f4b0e..cc195460 100644
--- a/openstackclient/volume/client.py
+++ b/openstackclient/volume/client.py
@@ -15,7 +15,8 @@
import logging
-from openstackclient.common import utils
+from osc_lib import utils
+
from openstackclient.i18n import _
LOG = logging.getLogger(__name__)
diff --git a/openstackclient/volume/v1/backup.py b/openstackclient/volume/v1/backup.py
index 607b5211..f70d9b42 100644
--- a/openstackclient/volume/v1/backup.py
+++ b/openstackclient/volume/v1/backup.py
@@ -16,10 +16,11 @@
"""Volume v1 Backup action implementations"""
import copy
+
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/volume/v1/qos_specs.py b/openstackclient/volume/v1/qos_specs.py
index c49477a0..70f68269 100644
--- a/openstackclient/volume/v1/qos_specs.py
+++ b/openstackclient/volume/v1/qos_specs.py
@@ -15,11 +15,11 @@
"""Volume v1 QoS action implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/volume/v1/service.py b/openstackclient/volume/v1/service.py
index 023dda98..c065b526 100644
--- a/openstackclient/volume/v1/service.py
+++ b/openstackclient/volume/v1/service.py
@@ -14,8 +14,9 @@
"""Service action implementations"""
+from osc_lib import utils
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/volume/v1/snapshot.py b/openstackclient/volume/v1/snapshot.py
index 5132d71e..af0b5229 100644
--- a/openstackclient/volume/v1/snapshot.py
+++ b/openstackclient/volume/v1/snapshot.py
@@ -16,11 +16,12 @@
"""Volume v1 Snapshot action implementations"""
import copy
+
+from osc_lib import utils
import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/volume/v1/volume.py b/openstackclient/volume/v1/volume.py
index ffec1803..359d931e 100644
--- a/openstackclient/volume/v1/volume.py
+++ b/openstackclient/volume/v1/volume.py
@@ -16,11 +16,12 @@
"""Volume v1 Volume action implementations"""
import argparse
+
+from osc_lib import utils
import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/volume/v1/volume_transfer_request.py b/openstackclient/volume/v1/volume_transfer_request.py
index 98689e7b..9cffe988 100644
--- a/openstackclient/volume/v1/volume_transfer_request.py
+++ b/openstackclient/volume/v1/volume_transfer_request.py
@@ -14,9 +14,9 @@
"""Volume v2 transfer action implementations"""
+from osc_lib import utils
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/volume/v1/volume_type.py b/openstackclient/volume/v1/volume_type.py
index 4e9b1920..e4d22abb 100644
--- a/openstackclient/volume/v1/volume_type.py
+++ b/openstackclient/volume/v1/volume_type.py
@@ -15,11 +15,11 @@
"""Volume v1 Type action implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/volume/v2/backup.py b/openstackclient/volume/v2/backup.py
index e6fbe78d..371ddafd 100644
--- a/openstackclient/volume/v2/backup.py
+++ b/openstackclient/volume/v2/backup.py
@@ -16,10 +16,10 @@
import copy
+from osc_lib import utils
import six
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/volume/v2/qos_specs.py b/openstackclient/volume/v2/qos_specs.py
index 90e11c77..c4473117 100644
--- a/openstackclient/volume/v2/qos_specs.py
+++ b/openstackclient/volume/v2/qos_specs.py
@@ -15,11 +15,11 @@
"""Volume v2 QoS action implementations"""
+from osc_lib import utils
import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/volume/v2/service.py b/openstackclient/volume/v2/service.py
index 023dda98..c065b526 100644
--- a/openstackclient/volume/v2/service.py
+++ b/openstackclient/volume/v2/service.py
@@ -14,8 +14,9 @@
"""Service action implementations"""
+from osc_lib import utils
+
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/volume/v2/snapshot.py b/openstackclient/volume/v2/snapshot.py
index d9017080..99b7462b 100644
--- a/openstackclient/volume/v2/snapshot.py
+++ b/openstackclient/volume/v2/snapshot.py
@@ -16,11 +16,11 @@
import copy
+from osc_lib import utils
import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py
index 18473da3..c6262d17 100644
--- a/openstackclient/volume/v2/volume.py
+++ b/openstackclient/volume/v2/volume.py
@@ -16,11 +16,11 @@
import copy
+from osc_lib import utils
import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
diff --git a/openstackclient/volume/v2/volume_transfer_request.py b/openstackclient/volume/v2/volume_transfer_request.py
index 98689e7b..9cffe988 100644
--- a/openstackclient/volume/v2/volume_transfer_request.py
+++ b/openstackclient/volume/v2/volume_transfer_request.py
@@ -14,9 +14,9 @@
"""Volume v2 transfer action implementations"""
+from osc_lib import utils
from openstackclient.common import command
-from openstackclient.common import utils
from openstackclient.i18n import _
diff --git a/openstackclient/volume/v2/volume_type.py b/openstackclient/volume/v2/volume_type.py
index e2e1c53e..0896ecff 100644
--- a/openstackclient/volume/v2/volume_type.py
+++ b/openstackclient/volume/v2/volume_type.py
@@ -15,11 +15,11 @@
"""Volume v2 Type action implementations"""
from osc_lib import exceptions
+from osc_lib import utils
import six
from openstackclient.common import command
from openstackclient.common import parseractions
-from openstackclient.common import utils
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common