Skip to content

Commit 3cc81dd

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Remove oslo.utils"
2 parents 44f842b + 9385113 commit 3cc81dd

6 files changed

Lines changed: 19 additions & 17 deletions

File tree

openstackclient/compute/v2/server.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import logging
2222
import os
2323

24+
import iso8601
2425
from novaclient import api_versions
2526
from novaclient.v2 import servers
2627
from openstack import exceptions as sdk_exceptions
@@ -29,7 +30,6 @@
2930
from osc_lib.command import command
3031
from osc_lib import exceptions
3132
from osc_lib import utils
32-
from oslo_utils import timeutils
3333

3434
from openstackclient.i18n import _
3535
from openstackclient.identity import common as identity_common
@@ -1455,17 +1455,17 @@ def take_action(self, parsed_args):
14551455
raise exceptions.CommandError(msg)
14561456

14571457
try:
1458-
timeutils.parse_isotime(search_opts['changes-before'])
1459-
except ValueError:
1458+
iso8601.parse_date(search_opts['changes-before'])
1459+
except (TypeError, iso8601.ParseError):
14601460
raise exceptions.CommandError(
14611461
_('Invalid changes-before value: %s') %
14621462
search_opts['changes-before']
14631463
)
14641464

14651465
if search_opts['changes-since']:
14661466
try:
1467-
timeutils.parse_isotime(search_opts['changes-since'])
1468-
except ValueError:
1467+
iso8601.parse_date(search_opts['changes-since'])
1468+
except (TypeError, iso8601.ParseError):
14691469
raise exceptions.CommandError(
14701470
_('Invalid changes-since value: %s') %
14711471
search_opts['changes-since']

openstackclient/compute/v2/server_backup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515

1616
"""Compute v2 Server action implementations"""
1717

18+
import importlib
19+
1820
from osc_lib.command import command
1921
from osc_lib import exceptions
2022
from osc_lib import utils
21-
from oslo_utils import importutils
2223

2324
from openstackclient.i18n import _
2425

@@ -119,7 +120,7 @@ def _show_progress(progress):
119120
info['properties'] = utils.format_dict(info.get('properties', {}))
120121
else:
121122
# Get the right image module to format the output
122-
image_module = importutils.import_module(
123+
image_module = importlib.import_module(
123124
self.IMAGE_API_VERSIONS[
124125
self.app.client_manager._api_version['image']
125126
]

openstackclient/compute/v2/server_image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
"""Compute v2 Server action implementations"""
1717

18+
import importlib
1819
import logging
1920

2021
from osc_lib.command import command
2122
from osc_lib import exceptions
2223
from osc_lib import utils
23-
from oslo_utils import importutils
2424

2525
from openstackclient.i18n import _
2626

@@ -99,7 +99,7 @@ def _show_progress(progress):
9999
info['properties'] = utils.format_dict(info.get('properties', {}))
100100
else:
101101
# Get the right image module to format the output
102-
image_module = importutils.import_module(
102+
image_module = importlib.import_module(
103103
self.IMAGE_API_VERSIONS[
104104
self.app.client_manager._api_version['image']
105105
]

openstackclient/tests/unit/compute/v2/test_server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
from unittest import mock
2020
from unittest.mock import call
2121

22+
import iso8601
2223
from novaclient import api_versions
2324
from openstack import exceptions as sdk_exceptions
2425
from osc_lib import exceptions
2526
from osc_lib import utils as common_utils
26-
from oslo_utils import timeutils
2727

2828
from openstackclient.compute.v2 import server
2929
from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes
@@ -3086,7 +3086,7 @@ def test_server_list_with_changes_since(self):
30863086
self.assertEqual(self.columns, columns)
30873087
self.assertEqual(tuple(self.data), tuple(data))
30883088

3089-
@mock.patch.object(timeutils, 'parse_isotime', side_effect=ValueError)
3089+
@mock.patch.object(iso8601, 'parse_date', side_effect=iso8601.ParseError)
30903090
def test_server_list_with_invalid_changes_since(self, mock_parse_isotime):
30913091

30923092
arglist = [
@@ -3129,7 +3129,7 @@ def test_server_list_v266_with_changes_before(self):
31293129
self.assertEqual(self.columns, columns)
31303130
self.assertEqual(tuple(self.data), tuple(data))
31313131

3132-
@mock.patch.object(timeutils, 'parse_isotime', side_effect=ValueError)
3132+
@mock.patch.object(iso8601, 'parse_date', side_effect=iso8601.ParseError)
31333133
def test_server_list_v266_with_invalid_changes_before(
31343134
self, mock_parse_isotime):
31353135
self.app.client_manager.compute.api_version = (

openstackclient/tests/unit/test_shell.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
# under the License.
1414
#
1515

16+
import importlib
1617
import os
1718
import sys
1819
from unittest import mock
1920

2021
from osc_lib.tests import utils as osc_lib_test_utils
21-
from oslo_utils import importutils
2222
import wrapt
2323

2424
from openstackclient import shell
@@ -151,12 +151,13 @@ def setUp(self):
151151
super(TestShell, self).setUp()
152152
# TODO(dtroyer): remove this once the shell_class_patch patch is
153153
# released in osc-lib
154-
self.shell_class = importutils.import_class(self.shell_class_name)
154+
mod_str, _sep, class_str = self.shell_class_name.rpartition('.')
155+
self.shell_class = getattr(importlib.import_module(mod_str), class_str)
155156

156157
def _assert_admin_token_auth(self, cmd_options, default_args):
157158
with mock.patch(
158-
self.shell_class_name + ".initialize_app",
159-
self.app,
159+
self.shell_class_name + ".initialize_app",
160+
self.app,
160161
):
161162
_shell = osc_lib_test_utils.make_shell(
162163
shell_class=self.shell_class,

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
pbr!=2.1.0,>=2.0.0 # Apache-2.0
55

66
cliff!=2.9.0,>=2.8.0 # Apache-2.0
7+
iso8601>=0.1.11 # MIT
78
openstacksdk>=0.48.0 # Apache-2.0
89
osc-lib>=2.0.0 # Apache-2.0
910
oslo.i18n>=3.15.3 # Apache-2.0
10-
oslo.utils>=3.33.0 # Apache-2.0
1111
python-keystoneclient>=3.22.0 # Apache-2.0
1212
python-novaclient>=15.1.0 # Apache-2.0
1313
python-cinderclient>=3.3.0 # Apache-2.0

0 commit comments

Comments
 (0)