diff options
| author | Monty Taylor <mordred@inaugust.com> | 2020-07-06 12:10:19 -0500 |
|---|---|---|
| committer | Stephen Finucane <sfinucan@redhat.com> | 2020-10-12 17:29:57 +0100 |
| commit | 9385113d40f3d9dd77f2d7dfa5ebb71d92635548 (patch) | |
| tree | 647570a138036aa7d1fd30b84bfdd50dc9e6d20b /openstackclient/compute/v2 | |
| parent | a48c05b90a376ce33e2f0a2d321b8c851a6ef0b0 (diff) | |
| download | python-openstackclient-9385113d40f3d9dd77f2d7dfa5ebb71d92635548.tar.gz | |
Remove oslo.utils
Oslo things are really server-side oriented and are heavy-weight
for client things. Remove oslo.utils and just use iso8601 and
importlib directly. It's not actually a bad library, but pulling
it and its other deps in just for a couple of wrapper methods
is a bit much here.
oslo.i18n, fwiw, is lightweight and helpful.
Change-Id: I463993170c03a1d98c47ab6a3c19131b7fca1099
Diffstat (limited to 'openstackclient/compute/v2')
| -rw-r--r-- | openstackclient/compute/v2/server.py | 10 | ||||
| -rw-r--r-- | openstackclient/compute/v2/server_backup.py | 5 | ||||
| -rw-r--r-- | openstackclient/compute/v2/server_image.py | 4 |
3 files changed, 10 insertions, 9 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index e5a7a328..2ede3af6 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -21,6 +21,7 @@ import io import logging import os +import iso8601 from novaclient import api_versions from novaclient.v2 import servers from openstack import exceptions as sdk_exceptions @@ -29,7 +30,6 @@ from osc_lib.cli import parseractions from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils -from oslo_utils import timeutils from openstackclient.i18n import _ from openstackclient.identity import common as identity_common @@ -1404,8 +1404,8 @@ class ListServer(command.Lister): raise exceptions.CommandError(msg) try: - timeutils.parse_isotime(search_opts['changes-before']) - except ValueError: + iso8601.parse_date(search_opts['changes-before']) + except (TypeError, iso8601.ParseError): raise exceptions.CommandError( _('Invalid changes-before value: %s') % search_opts['changes-before'] @@ -1413,8 +1413,8 @@ class ListServer(command.Lister): if search_opts['changes-since']: try: - timeutils.parse_isotime(search_opts['changes-since']) - except ValueError: + iso8601.parse_date(search_opts['changes-since']) + except (TypeError, iso8601.ParseError): raise exceptions.CommandError( _('Invalid changes-since value: %s') % search_opts['changes-since'] diff --git a/openstackclient/compute/v2/server_backup.py b/openstackclient/compute/v2/server_backup.py index a5d43fc6..b1b821b2 100644 --- a/openstackclient/compute/v2/server_backup.py +++ b/openstackclient/compute/v2/server_backup.py @@ -15,10 +15,11 @@ """Compute v2 Server action implementations""" +import importlib + from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils -from oslo_utils import importutils from openstackclient.i18n import _ @@ -119,7 +120,7 @@ class CreateServerBackup(command.ShowOne): info['properties'] = utils.format_dict(info.get('properties', {})) else: # Get the right image module to format the output - image_module = importutils.import_module( + image_module = importlib.import_module( self.IMAGE_API_VERSIONS[ self.app.client_manager._api_version['image'] ] diff --git a/openstackclient/compute/v2/server_image.py b/openstackclient/compute/v2/server_image.py index fea87af8..c12bc2b3 100644 --- a/openstackclient/compute/v2/server_image.py +++ b/openstackclient/compute/v2/server_image.py @@ -15,12 +15,12 @@ """Compute v2 Server action implementations""" +import importlib import logging from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils -from oslo_utils import importutils from openstackclient.i18n import _ @@ -99,7 +99,7 @@ class CreateServerImage(command.ShowOne): info['properties'] = utils.format_dict(info.get('properties', {})) else: # Get the right image module to format the output - image_module = importutils.import_module( + image_module = importlib.import_module( self.IMAGE_API_VERSIONS[ self.app.client_manager._api_version['image'] ] |
