summaryrefslogtreecommitdiff
path: root/openstackclient/volume/v2/volume.py
diff options
context:
space:
mode:
authorAkihiro Motoki <motoki@da.jp.nec.com>2016-01-10 21:54:53 +0900
committerAkihiro Motoki <motoki@da.jp.nec.com>2016-02-02 09:58:32 +0900
commit258c1102cc6b93a860bcd7cc083d4e14ae0025ce (patch)
tree6b963e16d6bd946c066a7163f6f36e7becba9b3b /openstackclient/volume/v2/volume.py
parente9ff42eee73de147339c42bca90f777a8f40f5c1 (diff)
downloadpython-openstackclient-258c1102cc6b93a860bcd7cc083d4e14ae0025ce.tar.gz
log take_action parameters in a single place
Previously each command logs take_action parameters explicitly by using @utils.log_method decorator or log.debug(). Some commands have no logging. This commit calls a logger in the base class and drops all logging definition from individual commands. Closes-Bug: #1532294 Change-Id: I43cd0290a4353c68c075bade9571c940733da1be
Diffstat (limited to 'openstackclient/volume/v2/volume.py')
-rw-r--r--openstackclient/volume/v2/volume.py30
1 files changed, 4 insertions, 26 deletions
diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py
index c636cf2f..436ec689 100644
--- a/openstackclient/volume/v2/volume.py
+++ b/openstackclient/volume/v2/volume.py
@@ -15,23 +15,18 @@
"""Volume V2 Volume action implementations"""
import copy
-import logging
-from cliff import command
-from cliff import lister
-from cliff import show
import six
+from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
from openstackclient.identity import common as identity_common
-class CreateVolume(show.ShowOne):
+class CreateVolume(command.ShowOne):
"""Create new volume"""
- log = logging.getLogger(__name__ + ".CreateVolume")
-
def get_parser(self, prog_name):
parser = super(CreateVolume, self).get_parser(prog_name)
parser.add_argument(
@@ -96,8 +91,6 @@ class CreateVolume(show.ShowOne):
return parser
def take_action(self, parsed_args):
- self.log.debug("take_action: (%s)", parsed_args)
-
identity_client = self.app.client_manager.identity
volume_client = self.app.client_manager.volume
image_client = self.app.client_manager.image
@@ -159,8 +152,6 @@ class CreateVolume(show.ShowOne):
class DeleteVolume(command.Command):
"""Delete volume(s)"""
- log = logging.getLogger(__name__ + ".DeleteVolume")
-
def get_parser(self, prog_name):
parser = super(DeleteVolume, self).get_parser(prog_name)
parser.add_argument(
@@ -180,7 +171,6 @@ class DeleteVolume(command.Command):
return parser
def take_action(self, parsed_args):
- self.log.debug("take_action: (%s)", parsed_args)
volume_client = self.app.client_manager.volume
for volume in parsed_args.volumes:
volume_obj = utils.find_resource(
@@ -191,11 +181,9 @@ class DeleteVolume(command.Command):
volume_client.volumes.delete(volume_obj.id)
-class ListVolume(lister.Lister):
+class ListVolume(command.Lister):
"""List volumes"""
- log = logging.getLogger(__name__ + '.ListVolume')
-
def get_parser(self, prog_name):
parser = super(ListVolume, self).get_parser(prog_name)
parser.add_argument(
@@ -234,7 +222,6 @@ class ListVolume(lister.Lister):
)
return parser
- @utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
@@ -328,8 +315,6 @@ class ListVolume(lister.Lister):
class SetVolume(command.Command):
"""Set volume properties"""
- log = logging.getLogger(__name__ + '.SetVolume')
-
def get_parser(self, prog_name):
parser = super(SetVolume, self).get_parser(prog_name)
parser.add_argument(
@@ -362,7 +347,6 @@ class SetVolume(command.Command):
)
return parser
- @utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume = utils.find_resource(volume_client.volumes, parsed_args.volume)
@@ -394,11 +378,9 @@ class SetVolume(command.Command):
self.app.log.error("No changes requested\n")
-class ShowVolume(show.ShowOne):
+class ShowVolume(command.ShowOne):
"""Display volume details"""
- log = logging.getLogger(__name__ + '.ShowVolume')
-
def get_parser(self, prog_name):
parser = super(ShowVolume, self).get_parser(prog_name)
parser.add_argument(
@@ -408,7 +390,6 @@ class ShowVolume(show.ShowOne):
)
return parser
- @utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume = utils.find_resource(volume_client.volumes, parsed_args.volume)
@@ -421,8 +402,6 @@ class ShowVolume(show.ShowOne):
class UnsetVolume(command.Command):
"""Unset volume properties"""
- log = logging.getLogger(__name__ + '.UnsetVolume')
-
def get_parser(self, prog_name):
parser = super(UnsetVolume, self).get_parser(prog_name)
parser.add_argument(
@@ -441,7 +420,6 @@ class UnsetVolume(command.Command):
)
return parser
- @utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume = utils.find_resource(