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
This commit is contained in:
openstackclient
common
compute
v2
identity
v2_0
v3
image
network
object
volume
@ -15,21 +15,16 @@
|
||||
|
||||
"""Hypervisor action implementations"""
|
||||
|
||||
import logging
|
||||
import re
|
||||
import six
|
||||
|
||||
from cliff import lister
|
||||
from cliff import show
|
||||
|
||||
from openstackclient.common import command
|
||||
from openstackclient.common import utils
|
||||
|
||||
|
||||
class ListHypervisor(lister.Lister):
|
||||
class ListHypervisor(command.Lister):
|
||||
"""List hypervisors"""
|
||||
|
||||
log = logging.getLogger(__name__ + ".ListHypervisor")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ListHypervisor, self).get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
@ -40,7 +35,6 @@ class ListHypervisor(lister.Lister):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)", parsed_args)
|
||||
compute_client = self.app.client_manager.compute
|
||||
columns = (
|
||||
"ID",
|
||||
@ -58,11 +52,9 @@ class ListHypervisor(lister.Lister):
|
||||
) for s in data))
|
||||
|
||||
|
||||
class ShowHypervisor(show.ShowOne):
|
||||
class ShowHypervisor(command.ShowOne):
|
||||
"""Display hypervisor details"""
|
||||
|
||||
log = logging.getLogger(__name__ + ".ShowHypervisor")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowHypervisor, self).get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
@ -72,7 +64,6 @@ class ShowHypervisor(show.ShowOne):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)", parsed_args)
|
||||
compute_client = self.app.client_manager.compute
|
||||
hypervisor = utils.find_resource(compute_client.hypervisors,
|
||||
parsed_args.hypervisor)._info.copy()
|
||||
|
Reference in New Issue
Block a user