diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-06-15 00:09:15 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-06-15 00:09:15 +0000 |
| commit | 968d8bb662465c3ae5b09d3dd381f89d6541b6bf (patch) | |
| tree | 9f38a2e812aff08e9558d80b3e94a695de73f20c /openstackclient/volume | |
| parent | 950abf264f9b918a2983f1ddf265aed7a1e7d5c8 (diff) | |
| parent | 0e9862be7af9a88c9c0e6a9ef4e11e48a1192727 (diff) | |
| download | python-openstackclient-968d8bb662465c3ae5b09d3dd381f89d6541b6bf.tar.gz | |
Merge "Standardize logger usage in volume"
Diffstat (limited to 'openstackclient/volume')
| -rw-r--r-- | openstackclient/volume/v1/volume.py | 13 | ||||
| -rw-r--r-- | openstackclient/volume/v2/volume.py | 15 | ||||
| -rw-r--r-- | openstackclient/volume/v2/volume_type.py | 25 |
3 files changed, 31 insertions, 22 deletions
diff --git a/openstackclient/volume/v1/volume.py b/openstackclient/volume/v1/volume.py index 7a3bfb97..e11aa1a7 100644 --- a/openstackclient/volume/v1/volume.py +++ b/openstackclient/volume/v1/volume.py @@ -16,6 +16,7 @@ """Volume v1 Volume action implementations""" import argparse +import logging from osc_lib.cli import parseractions from osc_lib.command import command @@ -25,6 +26,9 @@ import six from openstackclient.i18n import _ +LOG = logging.getLogger(__name__) + + class CreateVolume(command.ShowOne): """Create new volume""" @@ -343,13 +347,12 @@ class SetVolume(command.Command): if parsed_args.size: if volume.status != 'available': - self.app.log.error(_("Volume is in %s state, it must be " - "available before size can be extended") % - volume.status) + LOG.error(_("Volume is in %s state, it must be available " + "before size can be extended"), volume.status) return if parsed_args.size <= volume.size: - self.app.log.error(_("New size must be greater than %s GB") % - volume.size) + LOG.error(_("New size must be greater than %s GB"), + volume.size) return volume_client.volumes.extend(volume.id, parsed_args.size) diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py index b1a3af2e..e54395fa 100644 --- a/openstackclient/volume/v2/volume.py +++ b/openstackclient/volume/v2/volume.py @@ -15,6 +15,7 @@ """Volume V2 Volume action implementations""" import copy +import logging from osc_lib.cli import parseractions from osc_lib.command import command @@ -25,6 +26,9 @@ from openstackclient.i18n import _ from openstackclient.identity import common as identity_common +LOG = logging.getLogger(__name__) + + class CreateVolume(command.ShowOne): """Create new volume""" @@ -361,13 +365,12 @@ class SetVolume(command.Command): if parsed_args.size: if volume.status != 'available': - self.app.log.error(_("Volume is in %s state, it must be " - "available before size can be extended") % - volume.status) + LOG.error(_("Volume is in %s state, it must be available " + "before size can be extended"), volume.status) return if parsed_args.size <= volume.size: - self.app.log.error(_("New size must be greater than %s GB") % - volume.size) + LOG.error(_("New size must be greater than %s GB"), + volume.size) return volume_client.volumes.extend(volume.id, parsed_args.size) @@ -456,4 +459,4 @@ class UnsetVolume(command.Command): volume.id, parsed_args.image_property) if (not parsed_args.image_property and not parsed_args.property): - self.app.log.error(_("No changes requested\n")) + LOG.error(_("No changes requested")) diff --git a/openstackclient/volume/v2/volume_type.py b/openstackclient/volume/v2/volume_type.py index dc6b4f9b..5e9faa1d 100644 --- a/openstackclient/volume/v2/volume_type.py +++ b/openstackclient/volume/v2/volume_type.py @@ -14,6 +14,8 @@ """Volume v2 Type action implementations""" +import logging + from osc_lib.cli import parseractions from osc_lib.command import command from osc_lib import exceptions @@ -24,6 +26,9 @@ from openstackclient.i18n import _ from openstackclient.identity import common as identity_common +LOG = logging.getLogger(__name__) + + class CreateVolumeType(command.ShowOne): """Create new volume type""" @@ -190,16 +195,15 @@ class SetVolumeType(command.Command): **kwargs ) except Exception as e: - self.app.log.error(_("Failed to update volume type name or" - " description: %s") % str(e)) + LOG.error(_("Failed to update volume type name or" + " description: %s"), e) result += 1 if parsed_args.property: try: volume_type.set_keys(parsed_args.property) except Exception as e: - self.app.log.error(_("Failed to set volume type" - " property: %s") % str(e)) + LOG.error(_("Failed to set volume type property: %s"), e) result += 1 if parsed_args.project: @@ -213,13 +217,13 @@ class SetVolumeType(command.Command): volume_client.volume_type_access.add_project_access( volume_type.id, project_info.id) except Exception as e: - self.app.log.error(_("Failed to set volume type access to" - " project: %s") % str(e)) + LOG.error(_("Failed to set volume type access to " + "project: %s"), e) result += 1 if result > 0: raise exceptions.CommandError(_("Command Failed: One or more of" - " the operations failed")) + " the operations failed")) class ShowVolumeType(command.ShowOne): @@ -284,8 +288,7 @@ class UnsetVolumeType(command.Command): try: volume_type.unset_keys(parsed_args.property) except Exception as e: - self.app.log.error(_("Failed to unset volume type property: %s" - ) % str(e)) + LOG.error(_("Failed to unset volume type property: %s"), e) result += 1 if parsed_args.project: @@ -299,8 +302,8 @@ class UnsetVolumeType(command.Command): volume_client.volume_type_access.remove_project_access( volume_type.id, project_info.id) except Exception as e: - self.app.log.error(_("Failed to remove volume type access from" - " project: %s") % str(e)) + LOG.error(_("Failed to remove volume type access from " + "project: %s"), e) result += 1 if result > 0: |
