From 258c1102cc6b93a860bcd7cc083d4e14ae0025ce Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Sun, 10 Jan 2016 21:54:53 +0900 Subject: [PATCH] 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 --- openstackclient/common/availability_zone.py | 8 +--- openstackclient/common/command.py | 5 +- openstackclient/common/configuration.py | 10 +--- openstackclient/common/extension.py | 10 +--- openstackclient/common/limits.py | 9 +--- openstackclient/common/module.py | 14 ++---- openstackclient/common/quota.py | 13 +----- openstackclient/common/timing.py | 10 +--- openstackclient/compute/v2/agent.py | 24 ++-------- openstackclient/compute/v2/aggregate.py | 43 +++-------------- openstackclient/compute/v2/console.py | 13 +----- openstackclient/compute/v2/fixedip.py | 11 +---- openstackclient/compute/v2/flavor.py | 6 --- openstackclient/compute/v2/floatingip.py | 25 ++-------- openstackclient/compute/v2/floatingippool.py | 10 +--- openstackclient/compute/v2/host.py | 15 ++---- openstackclient/compute/v2/hypervisor.py | 15 ++---- .../compute/v2/hypervisor_stats.py | 8 +--- openstackclient/compute/v2/keypair.py | 24 ++-------- openstackclient/compute/v2/security_group.py | 46 +++---------------- openstackclient/compute/v2/server.py | 32 ------------- openstackclient/compute/v2/service.py | 17 +------ openstackclient/compute/v2/usage.py | 15 ++---- openstackclient/identity/v2_0/catalog.py | 15 ++---- openstackclient/identity/v2_0/ec2creds.py | 24 ++-------- openstackclient/identity/v2_0/endpoint.py | 24 ++-------- openstackclient/identity/v2_0/project.py | 29 ++---------- openstackclient/identity/v2_0/role.py | 36 +++------------ openstackclient/identity/v2_0/service.py | 24 ++-------- openstackclient/identity/v2_0/token.py | 14 +----- openstackclient/identity/v2_0/user.py | 26 ++--------- openstackclient/identity/v3/catalog.py | 15 ++---- openstackclient/identity/v3/consumer.py | 27 ++--------- openstackclient/identity/v3/credential.py | 27 ++--------- openstackclient/identity/v3/domain.py | 26 ++--------- openstackclient/identity/v3/ec2creds.py | 24 ++-------- openstackclient/identity/v3/endpoint.py | 27 ++--------- .../identity/v3/federation_protocol.py | 24 ++-------- openstackclient/identity/v3/group.py | 35 ++------------ .../identity/v3/identity_provider.py | 27 ++--------- openstackclient/identity/v3/mapping.py | 25 ++-------- openstackclient/identity/v3/policy.py | 27 ++--------- openstackclient/identity/v3/project.py | 26 ++--------- openstackclient/identity/v3/region.py | 27 ++--------- openstackclient/identity/v3/role.py | 32 ++----------- .../identity/v3/role_assignment.py | 11 +---- openstackclient/identity/v3/service.py | 27 ++--------- .../identity/v3/service_provider.py | 27 ++--------- openstackclient/identity/v3/token.py | 25 ++-------- openstackclient/identity/v3/trust.py | 24 ++-------- openstackclient/identity/v3/unscoped_saml.py | 15 ++---- openstackclient/identity/v3/user.py | 29 ++---------- openstackclient/image/v1/image.py | 34 ++------------ openstackclient/image/v2/image.py | 41 ++--------------- openstackclient/network/v2/network.py | 28 ++--------- openstackclient/network/v2/port.py | 5 -- openstackclient/network/v2/router.py | 27 ++--------- openstackclient/network/v2/subnet.py | 6 --- openstackclient/object/v1/account.py | 16 +------ openstackclient/object/v1/container.py | 34 ++------------ openstackclient/object/v1/object.py | 34 ++------------ openstackclient/volume/v1/backup.py | 27 ++--------- openstackclient/volume/v1/qos_specs.py | 36 ++------------- openstackclient/volume/v1/snapshot.py | 30 ++---------- openstackclient/volume/v1/volume.py | 30 ++---------- openstackclient/volume/v1/volume_type.py | 30 ++---------- openstackclient/volume/v2/backup.py | 28 ++--------- openstackclient/volume/v2/qos_specs.py | 36 ++------------- openstackclient/volume/v2/snapshot.py | 29 ++---------- openstackclient/volume/v2/volume.py | 30 ++---------- openstackclient/volume/v2/volume_type.py | 30 ++---------- 71 files changed, 242 insertions(+), 1391 deletions(-) diff --git a/openstackclient/common/availability_zone.py b/openstackclient/common/availability_zone.py index e72732e722..fa5aee4726 100644 --- a/openstackclient/common/availability_zone.py +++ b/openstackclient/common/availability_zone.py @@ -14,12 +14,11 @@ """Availability Zone action implementations""" import copy -import logging -from cliff import lister from novaclient import exceptions as nova_exceptions import six +from openstackclient.common import command from openstackclient.common import utils from openstackclient.i18n import _ # noqa @@ -70,11 +69,9 @@ def _xform_volume_availability_zone(az): return result -class ListAvailabilityZone(lister.Lister): +class ListAvailabilityZone(command.Lister): """List availability zones and their status""" - log = logging.getLogger(__name__ + '.ListAvailabilityZone') - def get_parser(self, prog_name): parser = super(ListAvailabilityZone, self).get_parser(prog_name) parser.add_argument( @@ -125,7 +122,6 @@ class ListAvailabilityZone(lister.Lister): result += _xform_volume_availability_zone(zone) return result - @utils.log_method(log) def take_action(self, parsed_args): if parsed_args.long: diff --git a/openstackclient/common/command.py b/openstackclient/common/command.py index b8d9fc6f1b..13b0bcc2c4 100644 --- a/openstackclient/common/command.py +++ b/openstackclient/common/command.py @@ -31,7 +31,10 @@ class CommandMeta(abc.ABCMeta): @six.add_metaclass(CommandMeta) class Command(command.Command): - pass + + def run(self, parsed_args): + self.log.debug('run(%s)', parsed_args) + return super(Command, self).run(parsed_args) class Lister(Command, lister.Lister): diff --git a/openstackclient/common/configuration.py b/openstackclient/common/configuration.py index ac2792dd43..a70e4d1436 100644 --- a/openstackclient/common/configuration.py +++ b/openstackclient/common/configuration.py @@ -13,21 +13,16 @@ """Configuration action implementations""" -import logging - -from cliff import show import six -from openstackclient.common import utils +from openstackclient.common import command REDACTED = "" -class ShowConfiguration(show.ShowOne): +class ShowConfiguration(command.ShowOne): """Display configuration details""" - log = logging.getLogger(__name__ + '.ShowConfiguration') - def get_parser(self, prog_name): parser = super(ShowConfiguration, self).get_parser(prog_name) mask_group = parser.add_mutually_exclusive_group() @@ -46,7 +41,6 @@ class ShowConfiguration(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): info = self.app.client_manager.get_configuration() diff --git a/openstackclient/common/extension.py b/openstackclient/common/extension.py index d1ae208de7..8b556b4cb2 100644 --- a/openstackclient/common/extension.py +++ b/openstackclient/common/extension.py @@ -16,18 +16,14 @@ """Extension action implementations""" import itertools -import logging - -from cliff import lister +from openstackclient.common import command from openstackclient.common import utils -class ListExtension(lister.Lister): +class ListExtension(command.Lister): """List API extensions""" - log = logging.getLogger(__name__ + '.ListExtension') - def get_parser(self, prog_name): parser = super(ListExtension, self).get_parser(prog_name) parser.add_argument( @@ -58,8 +54,6 @@ class ListExtension(lister.Lister): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) - if parsed_args.long: columns = ('Name', 'Namespace', 'Description', 'Alias', 'Updated', 'Links') diff --git a/openstackclient/common/limits.py b/openstackclient/common/limits.py index 577036702d..bd546c01ee 100644 --- a/openstackclient/common/limits.py +++ b/openstackclient/common/limits.py @@ -16,19 +16,15 @@ """Limits Action Implementation""" import itertools -import logging - -from cliff import lister +from openstackclient.common import command from openstackclient.common import utils from openstackclient.identity import common as identity_common -class ShowLimits(lister.Lister): +class ShowLimits(command.Lister): """Show compute and block storage limits""" - log = logging.getLogger(__name__ + '.ShowLimits') - def get_parser(self, prog_name): parser = super(ShowLimits, self).get_parser(prog_name) type_group = parser.add_mutually_exclusive_group(required=True) @@ -64,7 +60,6 @@ class ShowLimits(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute diff --git a/openstackclient/common/module.py b/openstackclient/common/module.py index f0ed23b2b1..a3dea5da50 100644 --- a/openstackclient/common/module.py +++ b/openstackclient/common/module.py @@ -15,23 +15,17 @@ """Module action implementation""" -import logging import six import sys -from cliff import lister -from cliff import show - -from openstackclient.common import utils +from openstackclient.common import command -class ListCommand(lister.Lister): +class ListCommand(command.Lister): """List recognized commands by group""" auth_required = False - log = logging.getLogger(__name__ + '.ListCommand') - @utils.log_method(log) def take_action(self, parsed_args): cm = self.app.command_manager groups = cm.get_command_groups() @@ -40,11 +34,10 @@ class ListCommand(lister.Lister): return (columns, ((c, cm.get_command_names(group=c)) for c in groups)) -class ListModule(show.ShowOne): +class ListModule(command.ShowOne): """List module versions""" auth_required = False - log = logging.getLogger(__name__ + '.ListModule') def get_parser(self, prog_name): parser = super(ListModule, self).get_parser(prog_name) @@ -56,7 +49,6 @@ class ListModule(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): data = {} diff --git a/openstackclient/common/quota.py b/openstackclient/common/quota.py index 8a9b910f2f..480abbd943 100644 --- a/openstackclient/common/quota.py +++ b/openstackclient/common/quota.py @@ -16,13 +16,10 @@ """Quota action implementations""" import itertools -import logging import six import sys -from cliff import command -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils @@ -60,8 +57,6 @@ NETWORK_QUOTAS = { class SetQuota(command.Command): """Set quotas for project or class""" - log = logging.getLogger(__name__ + '.SetQuota') - def get_parser(self, prog_name): parser = super(SetQuota, self).get_parser(prog_name) parser.add_argument( @@ -92,7 +87,6 @@ class SetQuota(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -143,11 +137,9 @@ class SetQuota(command.Command): **volume_kwargs) -class ShowQuota(show.ShowOne): +class ShowQuota(command.ShowOne): """Show quotas for project or class""" - log = logging.getLogger(__name__ + '.ShowQuota') - def get_parser(self, prog_name): parser = super(ShowQuota, self).get_parser(prog_name) parser.add_argument( @@ -203,7 +195,6 @@ class ShowQuota(show.ShowOne): else: return {} - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute diff --git a/openstackclient/common/timing.py b/openstackclient/common/timing.py index d13c86e73c..5f62875947 100644 --- a/openstackclient/common/timing.py +++ b/openstackclient/common/timing.py @@ -13,19 +13,13 @@ """Timing Implementation""" -import logging - -from cliff import lister +from openstackclient.common import command -class Timing(lister.Lister): +class Timing(command.Lister): """Show timing data""" - log = logging.getLogger(__name__ + '.Timing') - def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) - column_headers = ( 'URL', 'Seconds', diff --git a/openstackclient/compute/v2/agent.py b/openstackclient/compute/v2/agent.py index 75c67f3115..59d7dc66e3 100644 --- a/openstackclient/compute/v2/agent.py +++ b/openstackclient/compute/v2/agent.py @@ -15,21 +15,15 @@ """Agent action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils -class CreateAgent(show.ShowOne): +class CreateAgent(command.ShowOne): """Create compute agent command""" - log = logging.getLogger(__name__ + ".CreateAgent") - def get_parser(self, prog_name): parser = super(CreateAgent, self).get_parser(prog_name) parser.add_argument( @@ -60,7 +54,6 @@ class CreateAgent(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 args = ( parsed_args.os, @@ -77,8 +70,6 @@ class CreateAgent(show.ShowOne): class DeleteAgent(command.Command): """Delete compute agent command""" - log = logging.getLogger(__name__ + ".DeleteAgent") - def get_parser(self, prog_name): parser = super(DeleteAgent, self).get_parser(prog_name) parser.add_argument( @@ -88,16 +79,13 @@ class DeleteAgent(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute compute_client.agents.delete(parsed_args.id) -class ListAgent(lister.Lister): +class ListAgent(command.Lister): """List compute agent command""" - log = logging.getLogger(__name__ + ".ListAgent") - def get_parser(self, prog_name): parser = super(ListAgent, self).get_parser(prog_name) parser.add_argument( @@ -107,7 +95,6 @@ class ListAgent(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 = ( "Agent ID", @@ -125,11 +112,9 @@ class ListAgent(lister.Lister): ) for s in data)) -class SetAgent(show.ShowOne): +class SetAgent(command.ShowOne): """Set compute agent command""" - log = logging.getLogger(__name__ + ".SetAgent") - def get_parser(self, prog_name): parser = super(SetAgent, self).get_parser(prog_name) parser.add_argument( @@ -151,7 +136,6 @@ class SetAgent(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 args = ( parsed_args.id, diff --git a/openstackclient/compute/v2/aggregate.py b/openstackclient/compute/v2/aggregate.py index 97ad127cda..5f297257dd 100644 --- a/openstackclient/compute/v2/aggregate.py +++ b/openstackclient/compute/v2/aggregate.py @@ -16,22 +16,16 @@ """Compute v2 Aggregate action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils -class AddAggregateHost(show.ShowOne): +class AddAggregateHost(command.ShowOne): """Add host to aggregate""" - log = logging.getLogger(__name__ + '.AddAggregateHost') - def get_parser(self, prog_name): parser = super(AddAggregateHost, self).get_parser(prog_name) parser.add_argument( @@ -47,8 +41,6 @@ class AddAggregateHost(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 aggregate = utils.find_resource( @@ -62,11 +54,9 @@ class AddAggregateHost(show.ShowOne): return zip(*sorted(six.iteritems(info))) -class CreateAggregate(show.ShowOne): +class CreateAggregate(command.ShowOne): """Create a new aggregate""" - log = logging.getLogger(__name__ + ".CreateAggregate") - def get_parser(self, prog_name): parser = super(CreateAggregate, self).get_parser(prog_name) parser.add_argument( @@ -89,8 +79,6 @@ class CreateAggregate(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 info = {} @@ -112,8 +100,6 @@ class CreateAggregate(show.ShowOne): class DeleteAggregate(command.Command): """Delete an existing aggregate""" - log = logging.getLogger(__name__ + '.DeleteAggregate') - def get_parser(self, prog_name): parser = super(DeleteAggregate, self).get_parser(prog_name) parser.add_argument( @@ -123,7 +109,6 @@ class DeleteAggregate(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -134,11 +119,9 @@ class DeleteAggregate(command.Command): compute_client.aggregates.delete(data.id) -class ListAggregate(lister.Lister): +class ListAggregate(command.Lister): """List all aggregates""" - log = logging.getLogger(__name__ + ".ListAggregate") - def get_parser(self, prog_name): parser = super(ListAggregate, self).get_parser(prog_name) parser.add_argument( @@ -149,8 +132,6 @@ class ListAggregate(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 data = compute_client.aggregates.list() @@ -186,11 +167,9 @@ class ListAggregate(lister.Lister): ) for s in data)) -class RemoveAggregateHost(show.ShowOne): +class RemoveAggregateHost(command.ShowOne): """Remove host from aggregate""" - log = logging.getLogger(__name__ + '.RemoveAggregateHost') - def get_parser(self, prog_name): parser = super(RemoveAggregateHost, self).get_parser(prog_name) parser.add_argument( @@ -206,8 +185,6 @@ class RemoveAggregateHost(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 aggregate = utils.find_resource( @@ -224,11 +201,9 @@ class RemoveAggregateHost(show.ShowOne): return zip(*sorted(six.iteritems(info))) -class SetAggregate(show.ShowOne): +class SetAggregate(command.ShowOne): """Set aggregate properties""" - log = logging.getLogger(__name__ + '.SetAggregate') - def get_parser(self, prog_name): parser = super(SetAggregate, self).get_parser(prog_name) parser.add_argument( @@ -255,7 +230,6 @@ class SetAggregate(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -288,11 +262,9 @@ class SetAggregate(show.ShowOne): return ({}, {}) -class ShowAggregate(show.ShowOne): +class ShowAggregate(command.ShowOne): """Display aggregate details""" - log = logging.getLogger(__name__ + '.ShowAggregate') - def get_parser(self, prog_name): parser = super(ShowAggregate, self).get_parser(prog_name) parser.add_argument( @@ -302,7 +274,6 @@ class ShowAggregate(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute diff --git a/openstackclient/compute/v2/console.py b/openstackclient/compute/v2/console.py index f086478622..6c0ec31a56 100644 --- a/openstackclient/compute/v2/console.py +++ b/openstackclient/compute/v2/console.py @@ -15,13 +15,10 @@ """Compute v2 Console action implementations""" -import logging import six import sys -from cliff import command -from cliff import show - +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils @@ -29,8 +26,6 @@ from openstackclient.common import utils class ShowConsoleLog(command.Command): """Show server's console output""" - log = logging.getLogger(__name__ + '.ShowConsoleLog') - def get_parser(self, prog_name): parser = super(ShowConsoleLog, self).get_parser(prog_name) parser.add_argument( @@ -49,7 +44,6 @@ class ShowConsoleLog(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -67,11 +61,9 @@ class ShowConsoleLog(command.Command): sys.stdout.write(data) -class ShowConsoleURL(show.ShowOne): +class ShowConsoleURL(command.ShowOne): """Show server's remote console URL""" - log = logging.getLogger(__name__ + '.ShowConsoleURL') - def get_parser(self, prog_name): parser = super(ShowConsoleURL, self).get_parser(prog_name) parser.add_argument( @@ -104,7 +96,6 @@ class ShowConsoleURL(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute server = utils.find_resource( diff --git a/openstackclient/compute/v2/fixedip.py b/openstackclient/compute/v2/fixedip.py index 1ab8a18c49..daac97d1be 100644 --- a/openstackclient/compute/v2/fixedip.py +++ b/openstackclient/compute/v2/fixedip.py @@ -15,18 +15,13 @@ """Fixed IP action implementations""" -import logging - -from cliff import command - +from openstackclient.common import command from openstackclient.common import utils class AddFixedIP(command.Command): """Add fixed IP address to server""" - log = logging.getLogger(__name__ + ".AddFixedIP") - def get_parser(self, prog_name): parser = super(AddFixedIP, self).get_parser(prog_name) parser.add_argument( @@ -42,7 +37,6 @@ class AddFixedIP(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute network = utils.find_resource( @@ -57,8 +51,6 @@ class AddFixedIP(command.Command): class RemoveFixedIP(command.Command): """Remove fixed IP address from server""" - log = logging.getLogger(__name__ + ".RemoveFixedIP") - def get_parser(self, prog_name): parser = super(RemoveFixedIP, self).get_parser(prog_name) parser.add_argument( @@ -74,7 +66,6 @@ class RemoveFixedIP(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute server = utils.find_resource( diff --git a/openstackclient/compute/v2/flavor.py b/openstackclient/compute/v2/flavor.py index 1af5fe7002..093592cd82 100644 --- a/openstackclient/compute/v2/flavor.py +++ b/openstackclient/compute/v2/flavor.py @@ -98,7 +98,6 @@ class CreateFlavor(command.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute args = ( @@ -132,7 +131,6 @@ class DeleteFlavor(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute flavor = utils.find_resource(compute_client.flavors, parsed_args.flavor) @@ -182,7 +180,6 @@ class ListFlavor(command.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", @@ -234,7 +231,6 @@ class ShowFlavor(command.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute resource_flavor = utils.find_resource(compute_client.flavors, parsed_args.flavor) @@ -266,7 +262,6 @@ class SetFlavor(command.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute resource_flavor = compute_client.flavors.find(name=parsed_args.flavor) @@ -299,7 +294,6 @@ class UnsetFlavor(command.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute resource_flavor = compute_client.flavors.find(name=parsed_args.flavor) diff --git a/openstackclient/compute/v2/floatingip.py b/openstackclient/compute/v2/floatingip.py index 6f2e360cf8..29ecbc9057 100644 --- a/openstackclient/compute/v2/floatingip.py +++ b/openstackclient/compute/v2/floatingip.py @@ -15,21 +15,15 @@ """Floating IP action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils class AddFloatingIP(command.Command): """Add floating IP address to server""" - log = logging.getLogger(__name__ + ".AddFloatingIP") - def get_parser(self, prog_name): parser = super(AddFloatingIP, self).get_parser(prog_name) parser.add_argument( @@ -45,7 +39,6 @@ class AddFloatingIP(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute server = utils.find_resource( @@ -54,11 +47,9 @@ class AddFloatingIP(command.Command): server.add_floating_ip(parsed_args.ip_address) -class CreateFloatingIP(show.ShowOne): +class CreateFloatingIP(command.ShowOne): """Create new floating IP address""" - log = logging.getLogger(__name__ + '.CreateFloatingIP') - def get_parser(self, prog_name): parser = super(CreateFloatingIP, self).get_parser(prog_name) parser.add_argument( @@ -68,7 +59,6 @@ class CreateFloatingIP(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute floating_ip = compute_client.floating_ips.create(parsed_args.pool) @@ -81,8 +71,6 @@ class CreateFloatingIP(show.ShowOne): class DeleteFloatingIP(command.Command): """Delete a floating IP address""" - log = logging.getLogger(__name__ + '.DeleteFloatingIP') - def get_parser(self, prog_name): parser = super(DeleteFloatingIP, self).get_parser(prog_name) parser.add_argument( @@ -92,7 +80,6 @@ class DeleteFloatingIP(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -104,12 +91,9 @@ class DeleteFloatingIP(command.Command): compute_client.floating_ips.delete(floating_ip) -class ListFloatingIP(lister.Lister): +class ListFloatingIP(command.Lister): """List floating IP addresses""" - log = logging.getLogger(__name__ + '.ListFloatingIP') - - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -127,8 +111,6 @@ class ListFloatingIP(lister.Lister): class RemoveFloatingIP(command.Command): """Remove floating IP address from server""" - log = logging.getLogger(__name__ + ".RemoveFloatingIP") - def get_parser(self, prog_name): parser = super(RemoveFloatingIP, self).get_parser(prog_name) parser.add_argument( @@ -144,7 +126,6 @@ class RemoveFloatingIP(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute server = utils.find_resource( diff --git a/openstackclient/compute/v2/floatingippool.py b/openstackclient/compute/v2/floatingippool.py index 39a2d8fed4..997e03247a 100644 --- a/openstackclient/compute/v2/floatingippool.py +++ b/openstackclient/compute/v2/floatingippool.py @@ -15,19 +15,13 @@ """Floating IP Pool action implementations""" -import logging - -from cliff import lister - +from openstackclient.common import command from openstackclient.common import utils -class ListFloatingIPPool(lister.Lister): +class ListFloatingIPPool(command.Lister): """List pools of floating IP addresses""" - log = logging.getLogger(__name__ + '.ListFloatingIPPool') - - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute diff --git a/openstackclient/compute/v2/host.py b/openstackclient/compute/v2/host.py index 4f7273883f..f2257d1219 100644 --- a/openstackclient/compute/v2/host.py +++ b/openstackclient/compute/v2/host.py @@ -15,18 +15,13 @@ """Host action implementations""" -import logging - -from cliff import lister - +from openstackclient.common import command from openstackclient.common import utils -class ListHost(lister.Lister): +class ListHost(command.Lister): """List host command""" - log = logging.getLogger(__name__ + ".ListHost") - def get_parser(self, prog_name): parser = super(ListHost, self).get_parser(prog_name) parser.add_argument( @@ -36,7 +31,6 @@ class ListHost(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 = ( "Host Name", @@ -50,11 +44,9 @@ class ListHost(lister.Lister): ) for s in data)) -class ShowHost(lister.Lister): +class ShowHost(command.Lister): """Show host command""" - log = logging.getLogger(__name__ + ".ShowHost") - def get_parser(self, prog_name): parser = super(ShowHost, self).get_parser(prog_name) parser.add_argument( @@ -64,7 +56,6 @@ class ShowHost(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 = ( "Host", diff --git a/openstackclient/compute/v2/hypervisor.py b/openstackclient/compute/v2/hypervisor.py index f33beb0892..f5288a35a5 100644 --- a/openstackclient/compute/v2/hypervisor.py +++ b/openstackclient/compute/v2/hypervisor.py @@ -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() diff --git a/openstackclient/compute/v2/hypervisor_stats.py b/openstackclient/compute/v2/hypervisor_stats.py index 43ba9fc8ed..290f54185b 100644 --- a/openstackclient/compute/v2/hypervisor_stats.py +++ b/openstackclient/compute/v2/hypervisor_stats.py @@ -14,19 +14,15 @@ """Hypervisor Stats action implementations""" -import logging import six -from cliff import show +from openstackclient.common import command -class ShowHypervisorStats(show.ShowOne): +class ShowHypervisorStats(command.ShowOne): """Display hypervisor stats details""" - log = logging.getLogger(__name__ + ".ShowHypervisorStats") - def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute hypervisor_stats = compute_client.hypervisors.statistics().to_dict() diff --git a/openstackclient/compute/v2/keypair.py b/openstackclient/compute/v2/keypair.py index 965629858a..71c9d6747b 100644 --- a/openstackclient/compute/v2/keypair.py +++ b/openstackclient/compute/v2/keypair.py @@ -15,24 +15,18 @@ """Keypair action implementations""" -import logging import os import six import sys -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import exceptions from openstackclient.common import utils -class CreateKeypair(show.ShowOne): +class CreateKeypair(command.ShowOne): """Create new public key""" - log = logging.getLogger(__name__ + '.CreateKeypair') - def get_parser(self, prog_name): parser = super(CreateKeypair, self).get_parser(prog_name) parser.add_argument( @@ -47,7 +41,6 @@ class CreateKeypair(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -82,8 +75,6 @@ class CreateKeypair(show.ShowOne): class DeleteKeypair(command.Command): """Delete public key""" - log = logging.getLogger(__name__ + '.DeleteKeypair') - def get_parser(self, prog_name): parser = super(DeleteKeypair, self).get_parser(prog_name) parser.add_argument( @@ -93,19 +84,15 @@ class DeleteKeypair(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute compute_client.keypairs.delete(parsed_args.name) -class ListKeypair(lister.Lister): +class ListKeypair(command.Lister): """List public key fingerprints""" - log = logging.getLogger(__name__ + ".ListKeypair") - def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute columns = ( "Name", @@ -119,11 +106,9 @@ class ListKeypair(lister.Lister): ) for s in data)) -class ShowKeypair(show.ShowOne): +class ShowKeypair(command.ShowOne): """Display public key details""" - log = logging.getLogger(__name__ + '.ShowKeypair') - def get_parser(self, prog_name): parser = super(ShowKeypair, self).get_parser(prog_name) parser.add_argument( @@ -139,7 +124,6 @@ class ShowKeypair(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute keypair = utils.find_resource(compute_client.keypairs, diff --git a/openstackclient/compute/v2/security_group.py b/openstackclient/compute/v2/security_group.py index 6395e102b9..b975a50533 100644 --- a/openstackclient/compute/v2/security_group.py +++ b/openstackclient/compute/v2/security_group.py @@ -16,13 +16,8 @@ """Compute v2 Security Group action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - from keystoneauth1 import exceptions as ks_exc try: @@ -30,6 +25,7 @@ try: except ImportError: from novaclient.v1_1 import security_group_rules +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils @@ -79,11 +75,9 @@ def _xform_and_trim_security_group_rule(sgroup): return info -class CreateSecurityGroup(show.ShowOne): +class CreateSecurityGroup(command.ShowOne): """Create a new security group""" - log = logging.getLogger(__name__ + ".CreateSecurityGroup") - def get_parser(self, prog_name): parser = super(CreateSecurityGroup, self).get_parser(prog_name) parser.add_argument( @@ -99,8 +93,6 @@ class CreateSecurityGroup(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 description = parsed_args.description or parsed_args.name @@ -115,11 +107,9 @@ class CreateSecurityGroup(show.ShowOne): return zip(*sorted(six.iteritems(info))) -class CreateSecurityGroupRule(show.ShowOne): +class CreateSecurityGroupRule(command.ShowOne): """Create a new security group rule""" - log = logging.getLogger(__name__ + ".CreateSecurityGroupRule") - def get_parser(self, prog_name): parser = super(CreateSecurityGroupRule, self).get_parser(prog_name) parser.add_argument( @@ -157,8 +147,6 @@ class CreateSecurityGroupRule(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 group = utils.find_resource( compute_client.security_groups, @@ -184,8 +172,6 @@ class CreateSecurityGroupRule(show.ShowOne): class DeleteSecurityGroup(command.Command): """Delete a security group""" - log = logging.getLogger(__name__ + '.DeleteSecurityGroup') - def get_parser(self, prog_name): parser = super(DeleteSecurityGroup, self).get_parser(prog_name) parser.add_argument( @@ -195,7 +181,6 @@ class DeleteSecurityGroup(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -209,8 +194,6 @@ class DeleteSecurityGroup(command.Command): class DeleteSecurityGroupRule(command.Command): """Delete a security group rule""" - log = logging.getLogger(__name__ + '.DeleteSecurityGroupRule') - def get_parser(self, prog_name): parser = super(DeleteSecurityGroupRule, self).get_parser(prog_name) parser.add_argument( @@ -220,18 +203,15 @@ class DeleteSecurityGroupRule(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute compute_client.security_group_rules.delete(parsed_args.rule) -class ListSecurityGroup(lister.Lister): +class ListSecurityGroup(command.Lister): """List security groups""" - log = logging.getLogger(__name__ + ".ListSecurityGroup") - def get_parser(self, prog_name): parser = super(ListSecurityGroup, self).get_parser(prog_name) parser.add_argument( @@ -250,8 +230,6 @@ class ListSecurityGroup(lister.Lister): except KeyError: return project_id - self.log.debug("take_action(%s)", parsed_args) - compute_client = self.app.client_manager.compute columns = ( "ID", @@ -283,11 +261,9 @@ class ListSecurityGroup(lister.Lister): ) for s in data)) -class ListSecurityGroupRule(lister.Lister): +class ListSecurityGroupRule(command.Lister): """List security group rules""" - log = logging.getLogger(__name__ + ".ListSecurityGroupRule") - def get_parser(self, prog_name): parser = super(ListSecurityGroupRule, self).get_parser(prog_name) parser.add_argument( @@ -299,8 +275,6 @@ class ListSecurityGroupRule(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 = column_headers = ( "ID", @@ -337,11 +311,9 @@ class ListSecurityGroupRule(lister.Lister): ) for s in rules)) -class SetSecurityGroup(show.ShowOne): +class SetSecurityGroup(command.ShowOne): """Set security group properties""" - log = logging.getLogger(__name__ + '.SetSecurityGroup') - def get_parser(self, prog_name): parser = super(SetSecurityGroup, self).get_parser(prog_name) parser.add_argument( @@ -361,7 +333,6 @@ class SetSecurityGroup(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -388,11 +359,9 @@ class SetSecurityGroup(show.ShowOne): return ({}, {}) -class ShowSecurityGroup(show.ShowOne): +class ShowSecurityGroup(command.ShowOne): """Display security group details""" - log = logging.getLogger(__name__ + '.ShowSecurityGroup') - def get_parser(self, prog_name): parser = super(ShowSecurityGroup, self).get_parser(prog_name) parser.add_argument( @@ -402,7 +371,6 @@ class ShowSecurityGroup(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): compute_client = self.app.client_manager.compute diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index b4db621600..dd7bc470ba 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -185,8 +185,6 @@ class AddServerSecurityGroup(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - compute_client = self.app.client_manager.compute server = utils.find_resource( @@ -224,8 +222,6 @@ class AddServerVolume(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - compute_client = self.app.client_manager.compute volume_client = self.app.client_manager.volume @@ -370,7 +366,6 @@ class CreateServer(command.ShowOne): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute volume_client = self.app.client_manager.volume @@ -569,7 +564,6 @@ class CreateServerImage(command.ShowOne): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute image_client = self.app.client_manager.image @@ -626,7 +620,6 @@ class DeleteServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute for server in parsed_args.server: @@ -741,7 +734,6 @@ class ListServer(command.Lister): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute identity_client = self.app.client_manager.identity @@ -872,7 +864,6 @@ class LockServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -944,7 +935,6 @@ class MigrateServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -987,7 +977,6 @@ class PauseServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute for server in parsed_args.server: @@ -1031,7 +1020,6 @@ class RebootServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute server = utils.find_resource( @@ -1078,7 +1066,6 @@ class RebuildServer(command.ShowOne): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -1123,8 +1110,6 @@ class RemoveServerSecurityGroup(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - compute_client = self.app.client_manager.compute server = utils.find_resource( @@ -1157,8 +1142,6 @@ class RemoveServerVolume(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - compute_client = self.app.client_manager.compute volume_client = self.app.client_manager.volume @@ -1189,7 +1172,6 @@ class RescueServer(command.ShowOne): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -1233,7 +1215,6 @@ class ResizeServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -1277,7 +1258,6 @@ class ResumeServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -1317,7 +1297,6 @@ class SetServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -1358,7 +1337,6 @@ class ShelveServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute for server in parsed_args.server: @@ -1386,7 +1364,6 @@ class ShowServer(command.ShowOne): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute server = utils.find_resource(compute_client.servers, @@ -1507,7 +1484,6 @@ class SshServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -1561,7 +1537,6 @@ class StartServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute for server in parsed_args.server: @@ -1584,7 +1559,6 @@ class StopServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute for server in parsed_args.server: @@ -1607,7 +1581,6 @@ class SuspendServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -1631,7 +1604,6 @@ class UnlockServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -1655,7 +1627,6 @@ class UnpauseServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -1678,7 +1649,6 @@ class UnrescueServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute @@ -1708,7 +1678,6 @@ class UnsetServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute server = utils.find_resource( @@ -1736,7 +1705,6 @@ class UnshelveServer(command.Command): ) return parser - @utils.log_method() def take_action(self, parsed_args): compute_client = self.app.client_manager.compute for server in parsed_args.server: diff --git a/openstackclient/compute/v2/service.py b/openstackclient/compute/v2/service.py index af3e940a36..3c06272490 100644 --- a/openstackclient/compute/v2/service.py +++ b/openstackclient/compute/v2/service.py @@ -15,19 +15,13 @@ """Service action implementations""" -import logging - -from cliff import command -from cliff import lister - +from openstackclient.common import command from openstackclient.common import utils class DeleteService(command.Command): """Delete service command""" - log = logging.getLogger(__name__ + ".DeleteService") - def get_parser(self, prog_name): parser = super(DeleteService, self).get_parser(prog_name) parser.add_argument( @@ -37,17 +31,14 @@ class DeleteService(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute compute_client.services.delete(parsed_args.service) -class ListService(lister.Lister): +class ListService(command.Lister): """List service command""" - log = logging.getLogger(__name__ + ".ListService") - def get_parser(self, prog_name): parser = super(ListService, self).get_parser(prog_name) parser.add_argument( @@ -61,7 +52,6 @@ class ListService(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", @@ -83,8 +73,6 @@ class ListService(lister.Lister): class SetService(command.Command): """Set service command""" - log = logging.getLogger(__name__ + ".SetService") - def get_parser(self, prog_name): parser = super(SetService, self).get_parser(prog_name) parser.add_argument( @@ -110,7 +98,6 @@ class SetService(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) compute_client = self.app.client_manager.compute if parsed_args.enabled: diff --git a/openstackclient/compute/v2/usage.py b/openstackclient/compute/v2/usage.py index 4e7cf10064..baa501706a 100644 --- a/openstackclient/compute/v2/usage.py +++ b/openstackclient/compute/v2/usage.py @@ -16,21 +16,17 @@ """Usage action implementations""" import datetime -import logging import sys -from cliff import lister -from cliff import show import six +from openstackclient.common import command from openstackclient.common import utils -class ListUsage(lister.Lister): +class ListUsage(command.Lister): """List resource usage per project""" - log = logging.getLogger(__name__ + ".ListUsage") - def get_parser(self, prog_name): parser = super(ListUsage, self).get_parser(prog_name) parser.add_argument( @@ -49,7 +45,6 @@ class ListUsage(lister.Lister): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) def _format_project(project): if not project: @@ -118,11 +113,9 @@ class ListUsage(lister.Lister): ) for s in usage_list)) -class ShowUsage(show.ShowOne): +class ShowUsage(command.ShowOne): """Show resource usage for a single project""" - log = logging.getLogger(__name__ + ".ShowUsage") - def get_parser(self, prog_name): parser = super(ShowUsage, self).get_parser(prog_name) parser.add_argument( @@ -147,8 +140,6 @@ class ShowUsage(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 compute_client = self.app.client_manager.compute dateformat = "%Y-%m-%d" diff --git a/openstackclient/identity/v2_0/catalog.py b/openstackclient/identity/v2_0/catalog.py index 9bc2755aa2..c927943f85 100644 --- a/openstackclient/identity/v2_0/catalog.py +++ b/openstackclient/identity/v2_0/catalog.py @@ -13,12 +13,9 @@ """Identity v2 Service Catalog action implementations""" -import logging import six -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils from openstackclient.i18n import _ # noqa @@ -37,12 +34,9 @@ def _format_endpoints(eps=None): return ret -class ListCatalog(lister.Lister): +class ListCatalog(command.Lister): """List services in the service catalog""" - log = logging.getLogger(__name__ + '.ListCatalog') - - @utils.log_method(log) def take_action(self, parsed_args): # This is ugly because if auth hasn't happened yet we need @@ -62,11 +56,9 @@ class ListCatalog(lister.Lister): ) for s in data)) -class ShowCatalog(show.ShowOne): +class ShowCatalog(command.ShowOne): """Display service catalog details""" - log = logging.getLogger(__name__ + '.ShowCatalog') - def get_parser(self, prog_name): parser = super(ShowCatalog, self).get_parser(prog_name) parser.add_argument( @@ -76,7 +68,6 @@ class ShowCatalog(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): # This is ugly because if auth hasn't happened yet we need diff --git a/openstackclient/identity/v2_0/ec2creds.py b/openstackclient/identity/v2_0/ec2creds.py index a7730ce252..a16b3d9eff 100644 --- a/openstackclient/identity/v2_0/ec2creds.py +++ b/openstackclient/identity/v2_0/ec2creds.py @@ -16,22 +16,16 @@ """Identity v2 EC2 Credentials action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils from openstackclient.i18n import _ # noqa -class CreateEC2Creds(show.ShowOne): +class CreateEC2Creds(command.ShowOne): """Create EC2 credentials""" - log = logging.getLogger(__name__ + ".CreateEC2Creds") - def get_parser(self, prog_name): parser = super(CreateEC2Creds, self).get_parser(prog_name) parser.add_argument( @@ -52,7 +46,6 @@ class CreateEC2Creds(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -89,8 +82,6 @@ class CreateEC2Creds(show.ShowOne): class DeleteEC2Creds(command.Command): """Delete EC2 credentials""" - log = logging.getLogger(__name__ + '.DeleteEC2Creds') - def get_parser(self, prog_name): parser = super(DeleteEC2Creds, self).get_parser(prog_name) parser.add_argument( @@ -105,7 +96,6 @@ class DeleteEC2Creds(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -121,11 +111,9 @@ class DeleteEC2Creds(command.Command): identity_client.ec2.delete(user, parsed_args.access_key) -class ListEC2Creds(lister.Lister): +class ListEC2Creds(command.Lister): """List EC2 credentials""" - log = logging.getLogger(__name__ + '.ListEC2Creds') - def get_parser(self, prog_name): parser = super(ListEC2Creds, self).get_parser(prog_name) parser.add_argument( @@ -135,7 +123,6 @@ class ListEC2Creds(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -159,11 +146,9 @@ class ListEC2Creds(lister.Lister): ) for s in data)) -class ShowEC2Creds(show.ShowOne): +class ShowEC2Creds(command.ShowOne): """Display EC2 credentials details""" - log = logging.getLogger(__name__ + '.ShowEC2Creds') - def get_parser(self, prog_name): parser = super(ShowEC2Creds, self).get_parser(prog_name) parser.add_argument( @@ -178,7 +163,6 @@ class ShowEC2Creds(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity diff --git a/openstackclient/identity/v2_0/endpoint.py b/openstackclient/identity/v2_0/endpoint.py index 1744cc72ac..08c09565dd 100644 --- a/openstackclient/identity/v2_0/endpoint.py +++ b/openstackclient/identity/v2_0/endpoint.py @@ -15,23 +15,17 @@ """Endpoint action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils from openstackclient.i18n import _ # noqa from openstackclient.identity import common -class CreateEndpoint(show.ShowOne): +class CreateEndpoint(command.ShowOne): """Create new endpoint""" - log = logging.getLogger(__name__ + '.CreateEndpoint') - def get_parser(self, prog_name): parser = super(CreateEndpoint, self).get_parser(prog_name) parser.add_argument( @@ -62,7 +56,6 @@ class CreateEndpoint(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity service = common.find_service(identity_client, parsed_args.service) @@ -83,8 +76,6 @@ class CreateEndpoint(show.ShowOne): class DeleteEndpoint(command.Command): """Delete endpoint""" - log = logging.getLogger(__name__ + '.DeleteEndpoint') - def get_parser(self, prog_name): parser = super(DeleteEndpoint, self).get_parser(prog_name) parser.add_argument( @@ -93,18 +84,15 @@ class DeleteEndpoint(command.Command): help=_('Endpoint ID to delete')) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity identity_client.endpoints.delete(parsed_args.endpoint) return -class ListEndpoint(lister.Lister): +class ListEndpoint(command.Lister): """List endpoints""" - log = logging.getLogger(__name__ + '.ListEndpoint') - def get_parser(self, prog_name): parser = super(ListEndpoint, self).get_parser(prog_name) parser.add_argument( @@ -115,7 +103,6 @@ class ListEndpoint(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity if parsed_args.long: @@ -136,11 +123,9 @@ class ListEndpoint(lister.Lister): ) for s in data)) -class ShowEndpoint(show.ShowOne): +class ShowEndpoint(command.ShowOne): """Display endpoint details""" - log = logging.getLogger(__name__ + '.ShowEndpoint') - def get_parser(self, prog_name): parser = super(ShowEndpoint, self).get_parser(prog_name) parser.add_argument( @@ -150,7 +135,6 @@ class ShowEndpoint(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity data = identity_client.endpoints.list() diff --git a/openstackclient/identity/v2_0/project.py b/openstackclient/identity/v2_0/project.py index 4330c79ca0..9e26c308b4 100644 --- a/openstackclient/identity/v2_0/project.py +++ b/openstackclient/identity/v2_0/project.py @@ -15,24 +15,19 @@ """Identity v2 Project action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show from keystoneauth1 import exceptions as ks_exc +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils from openstackclient.i18n import _ # noqa -class CreateProject(show.ShowOne): +class CreateProject(command.ShowOne): """Create new project""" - log = logging.getLogger(__name__ + '.CreateProject') - def get_parser(self, prog_name): parser = super(CreateProject, self).get_parser(prog_name) parser.add_argument( @@ -70,7 +65,6 @@ class CreateProject(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -106,8 +100,6 @@ class CreateProject(show.ShowOne): class DeleteProject(command.Command): """Delete project(s)""" - log = logging.getLogger(__name__ + '.DeleteProject') - def get_parser(self, prog_name): parser = super(DeleteProject, self).get_parser(prog_name) parser.add_argument( @@ -118,7 +110,6 @@ class DeleteProject(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -131,11 +122,9 @@ class DeleteProject(command.Command): return -class ListProject(lister.Lister): +class ListProject(command.Lister): """List projects""" - log = logging.getLogger(__name__ + '.ListProject') - def get_parser(self, prog_name): parser = super(ListProject, self).get_parser(prog_name) parser.add_argument( @@ -146,7 +135,6 @@ class ListProject(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): if parsed_args.long: columns = ('ID', 'Name', 'Description', 'Enabled') @@ -163,8 +151,6 @@ class ListProject(lister.Lister): class SetProject(command.Command): """Set project properties""" - log = logging.getLogger(__name__ + '.SetProject') - def get_parser(self, prog_name): parser = super(SetProject, self).get_parser(prog_name) parser.add_argument( @@ -202,7 +188,6 @@ class SetProject(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -240,11 +225,9 @@ class SetProject(command.Command): return -class ShowProject(show.ShowOne): +class ShowProject(command.ShowOne): """Display project details""" - log = logging.getLogger(__name__ + '.ShowProject') - def get_parser(self, prog_name): parser = super(ShowProject, self).get_parser(prog_name) parser.add_argument( @@ -253,7 +236,6 @@ class ShowProject(show.ShowOne): help=_('Project to display (name or ID)')) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -303,8 +285,6 @@ class ShowProject(show.ShowOne): class UnsetProject(command.Command): """Unset project properties""" - log = logging.getLogger(__name__ + '.UnsetProject') - def get_parser(self, prog_name): parser = super(UnsetProject, self).get_parser(prog_name) parser.add_argument( @@ -323,7 +303,6 @@ class UnsetProject(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity project = utils.find_resource( diff --git a/openstackclient/identity/v2_0/role.py b/openstackclient/identity/v2_0/role.py index cab6b4a540..892ce006e5 100644 --- a/openstackclient/identity/v2_0/role.py +++ b/openstackclient/identity/v2_0/role.py @@ -15,24 +15,19 @@ """Identity v2 Role action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show from keystoneauth1 import exceptions as ks_exc +from openstackclient.common import command from openstackclient.common import exceptions from openstackclient.common import utils from openstackclient.i18n import _ # noqa -class AddRole(show.ShowOne): +class AddRole(command.ShowOne): """Add role to project:user""" - log = logging.getLogger(__name__ + '.AddRole') - def get_parser(self, prog_name): parser = super(AddRole, self).get_parser(prog_name) parser.add_argument( @@ -54,7 +49,6 @@ class AddRole(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity role = utils.find_resource(identity_client.roles, parsed_args.role) @@ -74,11 +68,9 @@ class AddRole(show.ShowOne): return zip(*sorted(six.iteritems(info))) -class CreateRole(show.ShowOne): +class CreateRole(command.ShowOne): """Create new role""" - log = logging.getLogger(__name__ + '.CreateRole') - def get_parser(self, prog_name): parser = super(CreateRole, self).get_parser(prog_name) parser.add_argument( @@ -93,7 +85,6 @@ class CreateRole(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity try: @@ -116,8 +107,6 @@ class CreateRole(show.ShowOne): class DeleteRole(command.Command): """Delete role(s)""" - log = logging.getLogger(__name__ + '.DeleteRole') - def get_parser(self, prog_name): parser = super(DeleteRole, self).get_parser(prog_name) parser.add_argument( @@ -128,7 +117,6 @@ class DeleteRole(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -141,11 +129,9 @@ class DeleteRole(command.Command): return -class ListRole(lister.Lister): +class ListRole(command.Lister): """List roles""" - log = logging.getLogger(__name__ + '.ListRole') - def get_parser(self, prog_name): parser = super(ListRole, self).get_parser(prog_name) parser.add_argument( @@ -160,7 +146,6 @@ class ListRole(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity auth_ref = self.app.client_manager.auth_ref @@ -222,11 +207,9 @@ class ListRole(lister.Lister): ) for s in data)) -class ListUserRole(lister.Lister): +class ListUserRole(command.Lister): """List user-role assignments""" - log = logging.getLogger(__name__ + '.ListUserRole') - def get_parser(self, prog_name): parser = super(ListUserRole, self).get_parser(prog_name) parser.add_argument( @@ -242,7 +225,6 @@ class ListUserRole(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity auth_ref = self.app.client_manager.auth_ref @@ -293,8 +275,6 @@ class ListUserRole(lister.Lister): class RemoveRole(command.Command): """Remove role from project : user""" - log = logging.getLogger(__name__ + '.RemoveRole') - def get_parser(self, prog_name): parser = super(RemoveRole, self).get_parser(prog_name) parser.add_argument( @@ -316,7 +296,6 @@ class RemoveRole(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity role = utils.find_resource(identity_client.roles, parsed_args.role) @@ -331,11 +310,9 @@ class RemoveRole(command.Command): project.id) -class ShowRole(show.ShowOne): +class ShowRole(command.ShowOne): """Display role details""" - log = logging.getLogger(__name__ + '.ShowRole') - def get_parser(self, prog_name): parser = super(ShowRole, self).get_parser(prog_name) parser.add_argument( @@ -345,7 +322,6 @@ class ShowRole(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity role = utils.find_resource(identity_client.roles, parsed_args.role) diff --git a/openstackclient/identity/v2_0/service.py b/openstackclient/identity/v2_0/service.py index c9d4844126..3af85d7db0 100644 --- a/openstackclient/identity/v2_0/service.py +++ b/openstackclient/identity/v2_0/service.py @@ -16,24 +16,18 @@ """Service action implementations""" import argparse -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import exceptions from openstackclient.common import utils from openstackclient.i18n import _ # noqa from openstackclient.identity import common -class CreateService(show.ShowOne): +class CreateService(command.ShowOne): """Create new service""" - log = logging.getLogger(__name__ + '.CreateService') - def get_parser(self, prog_name): parser = super(CreateService, self).get_parser(prog_name) parser.add_argument( @@ -59,7 +53,6 @@ class CreateService(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -95,8 +88,6 @@ class CreateService(show.ShowOne): class DeleteService(command.Command): """Delete service""" - log = logging.getLogger(__name__ + '.DeleteService') - def get_parser(self, prog_name): parser = super(DeleteService, self).get_parser(prog_name) parser.add_argument( @@ -106,7 +97,6 @@ class DeleteService(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity service = common.find_service(identity_client, parsed_args.service) @@ -114,11 +104,9 @@ class DeleteService(command.Command): return -class ListService(lister.Lister): +class ListService(command.Lister): """List services""" - log = logging.getLogger(__name__ + '.ListService') - def get_parser(self, prog_name): parser = super(ListService, self).get_parser(prog_name) parser.add_argument( @@ -129,7 +117,6 @@ class ListService(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): if parsed_args.long: @@ -143,11 +130,9 @@ class ListService(lister.Lister): ) -class ShowService(show.ShowOne): +class ShowService(command.ShowOne): """Display service details""" - log = logging.getLogger(__name__ + '.ShowService') - def get_parser(self, prog_name): parser = super(ShowService, self).get_parser(prog_name) parser.add_argument( @@ -163,7 +148,6 @@ class ShowService(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity auth_ref = self.app.client_manager.auth_ref diff --git a/openstackclient/identity/v2_0/token.py b/openstackclient/identity/v2_0/token.py index 5fed58e591..db38fae8e3 100644 --- a/openstackclient/identity/v2_0/token.py +++ b/openstackclient/identity/v2_0/token.py @@ -15,26 +15,19 @@ """Identity v2 Token action implementations""" -import logging import six -from cliff import command -from cliff import show - -from openstackclient.common import utils +from openstackclient.common import command from openstackclient.i18n import _ # noqa -class IssueToken(show.ShowOne): +class IssueToken(command.ShowOne): """Issue new token""" - log = logging.getLogger(__name__ + '.IssueToken') - def get_parser(self, prog_name): parser = super(IssueToken, self).get_parser(prog_name) return parser - @utils.log_method(log) def take_action(self, parsed_args): token = self.app.client_manager.auth_ref.service_catalog.get_token() @@ -45,8 +38,6 @@ class IssueToken(show.ShowOne): class RevokeToken(command.Command): """Revoke existing token""" - log = logging.getLogger(__name__ + '.RevokeToken') - def get_parser(self, prog_name): parser = super(RevokeToken, self).get_parser(prog_name) parser.add_argument( @@ -57,7 +48,6 @@ class RevokeToken(command.Command): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) identity_client = self.app.client_manager.identity identity_client.tokens.delete(parsed_args.token) diff --git a/openstackclient/identity/v2_0/user.py b/openstackclient/identity/v2_0/user.py index e2b285bd9d..3d848737e5 100644 --- a/openstackclient/identity/v2_0/user.py +++ b/openstackclient/identity/v2_0/user.py @@ -15,23 +15,18 @@ """Identity v2.0 User action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show from keystoneauth1 import exceptions as ks_exc +from openstackclient.common import command from openstackclient.common import utils from openstackclient.i18n import _ # noqa -class CreateUser(show.ShowOne): +class CreateUser(command.ShowOne): """Create new user""" - log = logging.getLogger(__name__ + '.CreateUser') - def get_parser(self, prog_name): parser = super(CreateUser, self).get_parser(prog_name) parser.add_argument( @@ -78,7 +73,6 @@ class CreateUser(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -130,8 +124,6 @@ class CreateUser(show.ShowOne): class DeleteUser(command.Command): """Delete user(s)""" - log = logging.getLogger(__name__ + '.DeleteUser') - def get_parser(self, prog_name): parser = super(DeleteUser, self).get_parser(prog_name) parser.add_argument( @@ -142,7 +134,6 @@ class DeleteUser(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -155,11 +146,9 @@ class DeleteUser(command.Command): return -class ListUser(lister.Lister): +class ListUser(command.Lister): """List users""" - log = logging.getLogger(__name__ + '.ListUser') - def get_parser(self, prog_name): parser = super(ListUser, self).get_parser(prog_name) parser.add_argument( @@ -174,7 +163,6 @@ class ListUser(lister.Lister): help=_('List additional fields in output')) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -248,8 +236,6 @@ class ListUser(lister.Lister): class SetUser(command.Command): """Set user properties""" - log = logging.getLogger(__name__ + '.SetUser') - def get_parser(self, prog_name): parser = super(SetUser, self).get_parser(prog_name) parser.add_argument( @@ -296,7 +282,6 @@ class SetUser(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -348,11 +333,9 @@ class SetUser(command.Command): return -class ShowUser(show.ShowOne): +class ShowUser(command.ShowOne): """Display user details""" - log = logging.getLogger(__name__ + '.ShowUser') - def get_parser(self, prog_name): parser = super(ShowUser, self).get_parser(prog_name) parser.add_argument( @@ -362,7 +345,6 @@ class ShowUser(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity diff --git a/openstackclient/identity/v3/catalog.py b/openstackclient/identity/v3/catalog.py index 76f7da51b3..795f5d5c6d 100644 --- a/openstackclient/identity/v3/catalog.py +++ b/openstackclient/identity/v3/catalog.py @@ -13,12 +13,9 @@ """Identity v3 Service Catalog action implementations""" -import logging - -from cliff import lister -from cliff import show import six +from openstackclient.common import command from openstackclient.common import utils from openstackclient.i18n import _ # noqa @@ -34,12 +31,9 @@ def _format_endpoints(eps=None): return ret -class ListCatalog(lister.Lister): +class ListCatalog(command.Lister): """List services in the service catalog""" - log = logging.getLogger(__name__ + '.ListCatalog') - - @utils.log_method(log) def take_action(self, parsed_args): # This is ugly because if auth hasn't happened yet we need @@ -59,11 +53,9 @@ class ListCatalog(lister.Lister): ) for s in data)) -class ShowCatalog(show.ShowOne): +class ShowCatalog(command.ShowOne): """Display service catalog details""" - log = logging.getLogger(__name__ + '.ShowCatalog') - def get_parser(self, prog_name): parser = super(ShowCatalog, self).get_parser(prog_name) parser.add_argument( @@ -73,7 +65,6 @@ class ShowCatalog(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): # This is ugly because if auth hasn't happened yet we need diff --git a/openstackclient/identity/v3/consumer.py b/openstackclient/identity/v3/consumer.py index 0a6ade67f8..729839882a 100644 --- a/openstackclient/identity/v3/consumer.py +++ b/openstackclient/identity/v3/consumer.py @@ -15,22 +15,16 @@ """Identity v3 Consumer action implementations""" -import logging import six import sys -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils -class CreateConsumer(show.ShowOne): +class CreateConsumer(command.ShowOne): """Create new consumer""" - log = logging.getLogger(__name__ + '.CreateConsumer') - def get_parser(self, prog_name): parser = super(CreateConsumer, self).get_parser(prog_name) parser.add_argument( @@ -40,7 +34,6 @@ class CreateConsumer(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity consumer = identity_client.oauth1.consumers.create( @@ -53,8 +46,6 @@ class CreateConsumer(show.ShowOne): class DeleteConsumer(command.Command): """Delete consumer""" - log = logging.getLogger(__name__ + '.DeleteConsumer') - def get_parser(self, prog_name): parser = super(DeleteConsumer, self).get_parser(prog_name) parser.add_argument( @@ -64,7 +55,6 @@ class DeleteConsumer(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity consumer = utils.find_resource( @@ -73,12 +63,9 @@ class DeleteConsumer(command.Command): return -class ListConsumer(lister.Lister): +class ListConsumer(command.Lister): """List consumers""" - log = logging.getLogger(__name__ + '.ListConsumer') - - @utils.log_method(log) def take_action(self, parsed_args): columns = ('ID', 'Description') data = self.app.client_manager.identity.oauth1.consumers.list() @@ -92,8 +79,6 @@ class ListConsumer(lister.Lister): class SetConsumer(command.Command): """Set consumer properties""" - log = logging.getLogger(__name__ + '.SetConsumer') - def get_parser(self, prog_name): parser = super(SetConsumer, self).get_parser(prog_name) parser.add_argument( @@ -108,7 +93,6 @@ class SetConsumer(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity consumer = utils.find_resource( @@ -126,11 +110,9 @@ class SetConsumer(command.Command): return -class ShowConsumer(show.ShowOne): +class ShowConsumer(command.ShowOne): """Display consumer details""" - log = logging.getLogger(__name__ + '.ShowConsumer') - def get_parser(self, prog_name): parser = super(ShowConsumer, self).get_parser(prog_name) parser.add_argument( @@ -140,7 +122,6 @@ class ShowConsumer(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity consumer = utils.find_resource( diff --git a/openstackclient/identity/v3/credential.py b/openstackclient/identity/v3/credential.py index f22092d4db..6208b32004 100644 --- a/openstackclient/identity/v3/credential.py +++ b/openstackclient/identity/v3/credential.py @@ -15,21 +15,15 @@ """Identity v3 Credential action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils -class CreateCredential(show.ShowOne): +class CreateCredential(command.ShowOne): """Create credential command""" - log = logging.getLogger(__name__ + '.CreateCredential') - def get_parser(self, prog_name): parser = super(CreateCredential, self).get_parser(prog_name) parser.add_argument( @@ -56,7 +50,6 @@ class CreateCredential(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity user_id = utils.find_resource(identity_client.users, @@ -79,8 +72,6 @@ class CreateCredential(show.ShowOne): class DeleteCredential(command.Command): """Delete credential command""" - log = logging.getLogger(__name__ + '.DeleteCredential') - def get_parser(self, prog_name): parser = super(DeleteCredential, self).get_parser(prog_name) parser.add_argument( @@ -90,19 +81,15 @@ class DeleteCredential(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity identity_client.credentials.delete(parsed_args.credential) return -class ListCredential(lister.Lister): +class ListCredential(command.Lister): """List credential command""" - log = logging.getLogger(__name__ + '.ListCredential') - - @utils.log_method(log) def take_action(self, parsed_args): columns = ('ID', 'Type', 'User ID', 'Blob', 'Project ID') column_headers = ('ID', 'Type', 'User ID', 'Data', 'Project ID') @@ -117,8 +104,6 @@ class ListCredential(lister.Lister): class SetCredential(command.Command): """Set credential command""" - log = logging.getLogger(__name__ + '.SetCredential') - def get_parser(self, prog_name): parser = super(SetCredential, self).get_parser(prog_name) parser.add_argument( @@ -152,7 +137,6 @@ class SetCredential(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -174,11 +158,9 @@ class SetCredential(command.Command): return -class ShowCredential(show.ShowOne): +class ShowCredential(command.ShowOne): """Show credential command""" - log = logging.getLogger(__name__ + '.ShowCredential') - def get_parser(self, prog_name): parser = super(ShowCredential, self).get_parser(prog_name) parser.add_argument( @@ -188,7 +170,6 @@ class ShowCredential(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity credential = utils.find_resource(identity_client.credentials, diff --git a/openstackclient/identity/v3/domain.py b/openstackclient/identity/v3/domain.py index 8278a300ef..cec967b897 100644 --- a/openstackclient/identity/v3/domain.py +++ b/openstackclient/identity/v3/domain.py @@ -15,24 +15,19 @@ """Identity v3 Domain action implementations""" -import logging import six import sys -from cliff import command -from cliff import lister -from cliff import show from keystoneauth1 import exceptions as ks_exc +from openstackclient.common import command from openstackclient.common import utils from openstackclient.i18n import _ # noqa -class CreateDomain(show.ShowOne): +class CreateDomain(command.ShowOne): """Create new domain""" - log = logging.getLogger(__name__ + '.CreateDomain') - def get_parser(self, prog_name): parser = super(CreateDomain, self).get_parser(prog_name) parser.add_argument( @@ -63,7 +58,6 @@ class CreateDomain(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -92,8 +86,6 @@ class CreateDomain(show.ShowOne): class DeleteDomain(command.Command): """Delete domain""" - log = logging.getLogger(__name__ + '.DeleteDomain') - def get_parser(self, prog_name): parser = super(DeleteDomain, self).get_parser(prog_name) parser.add_argument( @@ -103,7 +95,6 @@ class DeleteDomain(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity domain = utils.find_resource(identity_client.domains, @@ -112,12 +103,9 @@ class DeleteDomain(command.Command): return -class ListDomain(lister.Lister): +class ListDomain(command.Lister): """List domains""" - log = logging.getLogger(__name__ + '.ListDomain') - - @utils.log_method(log) def take_action(self, parsed_args): columns = ('ID', 'Name', 'Enabled', 'Description') data = self.app.client_manager.identity.domains.list() @@ -131,8 +119,6 @@ class ListDomain(lister.Lister): class SetDomain(command.Command): """Set domain properties""" - log = logging.getLogger(__name__ + '.SetDomain') - def get_parser(self, prog_name): parser = super(SetDomain, self).get_parser(prog_name) parser.add_argument( @@ -163,7 +149,6 @@ class SetDomain(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity domain = utils.find_resource(identity_client.domains, @@ -186,11 +171,9 @@ class SetDomain(command.Command): return -class ShowDomain(show.ShowOne): +class ShowDomain(command.ShowOne): """Display domain details""" - log = logging.getLogger(__name__ + '.ShowDomain') - def get_parser(self, prog_name): parser = super(ShowDomain, self).get_parser(prog_name) parser.add_argument( @@ -200,7 +183,6 @@ class ShowDomain(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity domain = utils.find_resource(identity_client.domains, diff --git a/openstackclient/identity/v3/ec2creds.py b/openstackclient/identity/v3/ec2creds.py index a12ee25e2b..777c0430e7 100644 --- a/openstackclient/identity/v3/ec2creds.py +++ b/openstackclient/identity/v3/ec2creds.py @@ -12,13 +12,9 @@ """Identity v3 EC2 Credentials action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils from openstackclient.i18n import _ # noqa from openstackclient.identity import common @@ -52,11 +48,9 @@ def _determine_ec2_user(parsed_args, client_manager): return user -class CreateEC2Creds(show.ShowOne): +class CreateEC2Creds(command.ShowOne): """Create EC2 credentials""" - log = logging.getLogger(__name__ + ".CreateEC2Creds") - def get_parser(self, prog_name): parser = super(CreateEC2Creds, self).get_parser(prog_name) parser.add_argument( @@ -79,7 +73,6 @@ class CreateEC2Creds(show.ShowOne): common.add_project_domain_option_to_parser(parser) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity client_manager = self.app.client_manager @@ -119,8 +112,6 @@ class CreateEC2Creds(show.ShowOne): class DeleteEC2Creds(command.Command): """Delete EC2 credentials""" - log = logging.getLogger(__name__ + '.DeleteEC2Creds') - def get_parser(self, prog_name): parser = super(DeleteEC2Creds, self).get_parser(prog_name) parser.add_argument( @@ -136,18 +127,15 @@ class DeleteEC2Creds(command.Command): common.add_user_domain_option_to_parser(parser) return parser - @utils.log_method(log) def take_action(self, parsed_args): client_manager = self.app.client_manager user = _determine_ec2_user(parsed_args, client_manager) client_manager.identity.ec2.delete(user, parsed_args.access_key) -class ListEC2Creds(lister.Lister): +class ListEC2Creds(command.Lister): """List EC2 credentials""" - log = logging.getLogger(__name__ + '.ListEC2Creds') - def get_parser(self, prog_name): parser = super(ListEC2Creds, self).get_parser(prog_name) parser.add_argument( @@ -158,7 +146,6 @@ class ListEC2Creds(lister.Lister): common.add_user_domain_option_to_parser(parser) return parser - @utils.log_method(log) def take_action(self, parsed_args): client_manager = self.app.client_manager user = _determine_ec2_user(parsed_args, client_manager) @@ -174,11 +161,9 @@ class ListEC2Creds(lister.Lister): ) for s in data)) -class ShowEC2Creds(show.ShowOne): +class ShowEC2Creds(command.ShowOne): """Display EC2 credentials details""" - log = logging.getLogger(__name__ + '.ShowEC2Creds') - def get_parser(self, prog_name): parser = super(ShowEC2Creds, self).get_parser(prog_name) parser.add_argument( @@ -194,7 +179,6 @@ class ShowEC2Creds(show.ShowOne): common.add_user_domain_option_to_parser(parser) return parser - @utils.log_method(log) def take_action(self, parsed_args): client_manager = self.app.client_manager user = _determine_ec2_user(parsed_args, client_manager) diff --git a/openstackclient/identity/v3/endpoint.py b/openstackclient/identity/v3/endpoint.py index 3d1c6f5416..1eff3b3b14 100644 --- a/openstackclient/identity/v3/endpoint.py +++ b/openstackclient/identity/v3/endpoint.py @@ -15,14 +15,10 @@ """Identity v3 Endpoint action implementations""" -import logging import six import sys -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils from openstackclient.identity import common @@ -34,11 +30,9 @@ def get_service_name(service): return '' -class CreateEndpoint(show.ShowOne): +class CreateEndpoint(command.ShowOne): """Create new endpoint""" - log = logging.getLogger(__name__ + '.CreateEndpoint') - def get_parser(self, prog_name): parser = super(CreateEndpoint, self).get_parser(prog_name) parser.add_argument( @@ -78,7 +72,6 @@ class CreateEndpoint(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity service = common.find_service(identity_client, parsed_args.service) @@ -102,8 +95,6 @@ class CreateEndpoint(show.ShowOne): class DeleteEndpoint(command.Command): """Delete endpoint""" - log = logging.getLogger(__name__ + '.DeleteEndpoint') - def get_parser(self, prog_name): parser = super(DeleteEndpoint, self).get_parser(prog_name) parser.add_argument( @@ -113,7 +104,6 @@ class DeleteEndpoint(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity endpoint_id = utils.find_resource(identity_client.endpoints, @@ -122,11 +112,9 @@ class DeleteEndpoint(command.Command): return -class ListEndpoint(lister.Lister): +class ListEndpoint(command.Lister): """List endpoints""" - log = logging.getLogger(__name__ + '.ListEndpoint') - def get_parser(self, prog_name): parser = super(ListEndpoint, self).get_parser(prog_name) parser.add_argument( @@ -147,7 +135,6 @@ class ListEndpoint(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity columns = ('ID', 'Region', 'Service Name', 'Service Type', @@ -176,8 +163,6 @@ class ListEndpoint(lister.Lister): class SetEndpoint(command.Command): """Set endpoint properties""" - log = logging.getLogger(__name__ + '.SetEndpoint') - def get_parser(self, prog_name): parser = super(SetEndpoint, self).get_parser(prog_name) parser.add_argument( @@ -221,7 +206,6 @@ class SetEndpoint(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity endpoint = utils.find_resource(identity_client.endpoints, @@ -256,11 +240,9 @@ class SetEndpoint(command.Command): return -class ShowEndpoint(show.ShowOne): +class ShowEndpoint(command.ShowOne): """Display endpoint details""" - log = logging.getLogger(__name__ + '.ShowEndpoint') - def get_parser(self, prog_name): parser = super(ShowEndpoint, self).get_parser(prog_name) parser.add_argument( @@ -270,7 +252,6 @@ class ShowEndpoint(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity endpoint = utils.find_resource(identity_client.endpoints, diff --git a/openstackclient/identity/v3/federation_protocol.py b/openstackclient/identity/v3/federation_protocol.py index 20877fcd4d..2d7ab15dfa 100644 --- a/openstackclient/identity/v3/federation_protocol.py +++ b/openstackclient/identity/v3/federation_protocol.py @@ -14,21 +14,15 @@ """Identity v3 Protocols actions implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils -class CreateProtocol(show.ShowOne): +class CreateProtocol(command.ShowOne): """Create new federation protocol""" - log = logging.getLogger(__name__ + 'CreateProtocol') - def get_parser(self, prog_name): parser = super(CreateProtocol, self).get_parser(prog_name) parser.add_argument( @@ -50,7 +44,6 @@ class CreateProtocol(show.ShowOne): return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity protocol = identity_client.federation.protocols.create( @@ -71,8 +64,6 @@ class CreateProtocol(show.ShowOne): class DeleteProtocol(command.Command): """Delete federation protocol""" - log = logging.getLogger(__name__ + '.DeleteProtocol') - def get_parser(self, prog_name): parser = super(DeleteProtocol, self).get_parser(prog_name) parser.add_argument( @@ -88,7 +79,6 @@ class DeleteProtocol(command.Command): return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity identity_client.federation.protocols.delete( @@ -96,11 +86,9 @@ class DeleteProtocol(command.Command): return -class ListProtocols(lister.Lister): +class ListProtocols(command.Lister): """List federation protocols""" - log = logging.getLogger(__name__ + '.ListProtocols') - def get_parser(self, prog_name): parser = super(ListProtocols, self).get_parser(prog_name) parser.add_argument( @@ -126,8 +114,6 @@ class ListProtocols(lister.Lister): class SetProtocol(command.Command): """Set federation protocol properties""" - log = logging.getLogger(__name__ + '.SetProtocol') - def get_parser(self, prog_name): parser = super(SetProtocol, self).get_parser(prog_name) parser.add_argument( @@ -166,11 +152,9 @@ class SetProtocol(command.Command): return zip(*sorted(six.iteritems(info))) -class ShowProtocol(show.ShowOne): +class ShowProtocol(command.ShowOne): """Display federation protocol details""" - log = logging.getLogger(__name__ + '.ShowProtocol') - def get_parser(self, prog_name): parser = super(ShowProtocol, self).get_parser(prog_name) parser.add_argument( diff --git a/openstackclient/identity/v3/group.py b/openstackclient/identity/v3/group.py index d503a6b869..b3d893ced6 100644 --- a/openstackclient/identity/v3/group.py +++ b/openstackclient/identity/v3/group.py @@ -15,15 +15,12 @@ """Group action implementations""" -import logging import six import sys -from cliff import command -from cliff import lister -from cliff import show from keystoneauth1 import exceptions as ks_exc +from openstackclient.common import command from openstackclient.common import utils from openstackclient.i18n import _ # noqa from openstackclient.identity import common @@ -32,8 +29,6 @@ from openstackclient.identity import common class AddUserToGroup(command.Command): """Add user to group""" - log = logging.getLogger(__name__ + '.AddUserToGroup') - def get_parser(self, prog_name): parser = super(AddUserToGroup, self).get_parser(prog_name) parser.add_argument( @@ -50,7 +45,6 @@ class AddUserToGroup(command.Command): common.add_user_domain_option_to_parser(parser) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -74,8 +68,6 @@ class AddUserToGroup(command.Command): class CheckUserInGroup(command.Command): """Check user membership in group""" - log = logging.getLogger(__name__ + '.CheckUserInGroup') - def get_parser(self, prog_name): parser = super(CheckUserInGroup, self).get_parser(prog_name) parser.add_argument( @@ -92,7 +84,6 @@ class CheckUserInGroup(command.Command): common.add_user_domain_option_to_parser(parser) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -113,11 +104,9 @@ class CheckUserInGroup(command.Command): (parsed_args.user, parsed_args.group)) -class CreateGroup(show.ShowOne): +class CreateGroup(command.ShowOne): """Create new group""" - log = logging.getLogger(__name__ + '.CreateGroup') - def get_parser(self, prog_name): parser = super(CreateGroup, self).get_parser(prog_name) parser.add_argument( @@ -142,7 +131,6 @@ class CreateGroup(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -172,8 +160,6 @@ class CreateGroup(show.ShowOne): class DeleteGroup(command.Command): """Delete group(s)""" - log = logging.getLogger(__name__ + '.DeleteGroup') - def get_parser(self, prog_name): parser = super(DeleteGroup, self).get_parser(prog_name) parser.add_argument( @@ -188,7 +174,6 @@ class DeleteGroup(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -200,11 +185,9 @@ class DeleteGroup(command.Command): return -class ListGroup(lister.Lister): +class ListGroup(command.Lister): """List groups""" - log = logging.getLogger(__name__ + '.ListGroup') - def get_parser(self, prog_name): parser = super(ListGroup, self).get_parser(prog_name) parser.add_argument( @@ -226,7 +209,6 @@ class ListGroup(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -266,8 +248,6 @@ class ListGroup(lister.Lister): class RemoveUserFromGroup(command.Command): """Remove user from group""" - log = logging.getLogger(__name__ + '.RemoveUserFromGroup') - def get_parser(self, prog_name): parser = super(RemoveUserFromGroup, self).get_parser(prog_name) parser.add_argument( @@ -284,7 +264,6 @@ class RemoveUserFromGroup(command.Command): common.add_user_domain_option_to_parser(parser) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -308,8 +287,6 @@ class RemoveUserFromGroup(command.Command): class SetGroup(command.Command): """Set group properties""" - log = logging.getLogger(__name__ + '.SetGroup') - def get_parser(self, prog_name): parser = super(SetGroup, self).get_parser(prog_name) parser.add_argument( @@ -331,7 +308,6 @@ class SetGroup(command.Command): help='New group description') return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity group = common.find_group(identity_client, parsed_args.group, @@ -349,11 +325,9 @@ class SetGroup(command.Command): return -class ShowGroup(show.ShowOne): +class ShowGroup(command.ShowOne): """Display group details""" - log = logging.getLogger(__name__ + '.ShowGroup') - def get_parser(self, prog_name): parser = super(ShowGroup, self).get_parser(prog_name) parser.add_argument( @@ -368,7 +342,6 @@ class ShowGroup(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity diff --git a/openstackclient/identity/v3/identity_provider.py b/openstackclient/identity/v3/identity_provider.py index 4e086b681b..0ff8acb9a1 100644 --- a/openstackclient/identity/v3/identity_provider.py +++ b/openstackclient/identity/v3/identity_provider.py @@ -13,21 +13,15 @@ """Identity v3 IdentityProvider action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils -class CreateIdentityProvider(show.ShowOne): +class CreateIdentityProvider(command.ShowOne): """Create new identity provider""" - log = logging.getLogger(__name__ + '.CreateIdentityProvider') - def get_parser(self, prog_name): parser = super(CreateIdentityProvider, self).get_parser(prog_name) parser.add_argument( @@ -70,7 +64,6 @@ class CreateIdentityProvider(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity if parsed_args.remote_id_file: @@ -96,8 +89,6 @@ class CreateIdentityProvider(show.ShowOne): class DeleteIdentityProvider(command.Command): """Delete identity provider""" - log = logging.getLogger(__name__ + '.DeleteIdentityProvider') - def get_parser(self, prog_name): parser = super(DeleteIdentityProvider, self).get_parser(prog_name) parser.add_argument( @@ -107,7 +98,6 @@ class DeleteIdentityProvider(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity identity_client.federation.identity_providers.delete( @@ -115,12 +105,9 @@ class DeleteIdentityProvider(command.Command): return -class ListIdentityProvider(lister.Lister): +class ListIdentityProvider(command.Lister): """List identity providers""" - log = logging.getLogger(__name__ + '.ListIdentityProvider') - - @utils.log_method(log) def take_action(self, parsed_args): columns = ('ID', 'Enabled', 'Description') identity_client = self.app.client_manager.identity @@ -135,8 +122,6 @@ class ListIdentityProvider(lister.Lister): class SetIdentityProvider(command.Command): """Set identity provider properties""" - log = logging.getLogger(__name__ + '.SetIdentityProvider') - def get_parser(self, prog_name): parser = super(SetIdentityProvider, self).get_parser(prog_name) parser.add_argument( @@ -176,7 +161,6 @@ class SetIdentityProvider(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): federation_client = self.app.client_manager.identity.federation @@ -215,11 +199,9 @@ class SetIdentityProvider(command.Command): return zip(*sorted(six.iteritems(identity_provider._info))) -class ShowIdentityProvider(show.ShowOne): +class ShowIdentityProvider(command.ShowOne): """Display identity provider details""" - log = logging.getLogger(__name__ + '.ShowIdentityProvider') - def get_parser(self, prog_name): parser = super(ShowIdentityProvider, self).get_parser(prog_name) parser.add_argument( @@ -229,7 +211,6 @@ class ShowIdentityProvider(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity idp = utils.find_resource( diff --git a/openstackclient/identity/v3/mapping.py b/openstackclient/identity/v3/mapping.py index c79331ec7d..422d66bcbd 100644 --- a/openstackclient/identity/v3/mapping.py +++ b/openstackclient/identity/v3/mapping.py @@ -16,13 +16,10 @@ """Identity v3 federation mapping action implementations""" import json -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 exceptions from openstackclient.common import utils @@ -79,11 +76,9 @@ class _RulesReader(object): return rules -class CreateMapping(show.ShowOne, _RulesReader): +class CreateMapping(command.ShowOne, _RulesReader): """Create new mapping""" - log = logging.getLogger(__name__ + '.CreateMapping') - def get_parser(self, prog_name): parser = super(CreateMapping, self).get_parser(prog_name) parser.add_argument( @@ -99,7 +94,6 @@ class CreateMapping(show.ShowOne, _RulesReader): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) identity_client = self.app.client_manager.identity rules = self._read_rules(parsed_args.rules) @@ -114,8 +108,6 @@ class CreateMapping(show.ShowOne, _RulesReader): class DeleteMapping(command.Command): """Delete mapping""" - log = logging.getLogger(__name__ + '.DeleteMapping') - def get_parser(self, prog_name): parser = super(DeleteMapping, self).get_parser(prog_name) parser.add_argument( @@ -126,19 +118,16 @@ class DeleteMapping(command.Command): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) identity_client = self.app.client_manager.identity identity_client.federation.mappings.delete(parsed_args.mapping) return -class ListMapping(lister.Lister): +class ListMapping(command.Lister): """List mappings""" - log = logging.getLogger(__name__ + '.ListMapping') def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) # NOTE(marek-denis): Since rules can be long and tedious I have decided # to only list ids of the mappings. If somebody wants to check the # rules, (s)he should show specific ones. @@ -152,8 +141,6 @@ class ListMapping(lister.Lister): class SetMapping(command.Command, _RulesReader): """Set mapping properties""" - log = logging.getLogger(__name__ + '.SetMapping') - def get_parser(self, prog_name): parser = super(SetMapping, self).get_parser(prog_name) parser.add_argument( @@ -169,7 +156,6 @@ class SetMapping(command.Command, _RulesReader): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) identity_client = self.app.client_manager.identity if not parsed_args.rules: @@ -186,11 +172,9 @@ class SetMapping(command.Command, _RulesReader): return zip(*sorted(six.iteritems(mapping._info))) -class ShowMapping(show.ShowOne): +class ShowMapping(command.ShowOne): """Display mapping details""" - log = logging.getLogger(__name__ + '.ShowMapping') - def get_parser(self, prog_name): parser = super(ShowMapping, self).get_parser(prog_name) parser.add_argument( @@ -201,7 +185,6 @@ class ShowMapping(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 mapping = identity_client.federation.mappings.get(parsed_args.mapping) diff --git a/openstackclient/identity/v3/policy.py b/openstackclient/identity/v3/policy.py index 9da94863f4..503df37404 100644 --- a/openstackclient/identity/v3/policy.py +++ b/openstackclient/identity/v3/policy.py @@ -15,22 +15,16 @@ """Identity v3 Policy action implementations""" -import logging import six import sys -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils -class CreatePolicy(show.ShowOne): +class CreatePolicy(command.ShowOne): """Create new policy""" - log = logging.getLogger(__name__ + '.CreatePolicy') - def get_parser(self, prog_name): parser = super(CreatePolicy, self).get_parser(prog_name) parser.add_argument( @@ -47,7 +41,6 @@ class CreatePolicy(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): blob = utils.read_blob_file_contents(parsed_args.rules) @@ -64,8 +57,6 @@ class CreatePolicy(show.ShowOne): class DeletePolicy(command.Command): """Delete policy""" - log = logging.getLogger(__name__ + '.DeletePolicy') - def get_parser(self, prog_name): parser = super(DeletePolicy, self).get_parser(prog_name) parser.add_argument( @@ -75,18 +66,15 @@ class DeletePolicy(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity identity_client.policies.delete(parsed_args.policy) return -class ListPolicy(lister.Lister): +class ListPolicy(command.Lister): """List policies""" - log = logging.getLogger(__name__ + '.ListPolicy') - def get_parser(self, prog_name): parser = super(ListPolicy, self).get_parser(prog_name) parser.add_argument( @@ -97,7 +85,6 @@ class ListPolicy(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): if parsed_args.long: columns = ('ID', 'Type', 'Blob') @@ -116,8 +103,6 @@ class ListPolicy(lister.Lister): class SetPolicy(command.Command): """Set policy properties""" - log = logging.getLogger(__name__ + '.SetPolicy') - def get_parser(self, prog_name): parser = super(SetPolicy, self).get_parser(prog_name) parser.add_argument( @@ -137,7 +122,6 @@ class SetPolicy(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity blob = None @@ -158,11 +142,9 @@ class SetPolicy(command.Command): return -class ShowPolicy(show.ShowOne): +class ShowPolicy(command.ShowOne): """Display policy details""" - log = logging.getLogger(__name__ + '.ShowPolicy') - def get_parser(self, prog_name): parser = super(ShowPolicy, self).get_parser(prog_name) parser.add_argument( @@ -172,7 +154,6 @@ class ShowPolicy(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity policy = utils.find_resource(identity_client.policies, diff --git a/openstackclient/identity/v3/project.py b/openstackclient/identity/v3/project.py index 22745aa409..61db861441 100644 --- a/openstackclient/identity/v3/project.py +++ b/openstackclient/identity/v3/project.py @@ -15,25 +15,20 @@ """Project action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show from keystoneauth1 import exceptions as ks_exc +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils from openstackclient.i18n import _ # noqa from openstackclient.identity import common -class CreateProject(show.ShowOne): +class CreateProject(command.ShowOne): """Create new project""" - log = logging.getLogger(__name__ + '.CreateProject') - def get_parser(self, prog_name): parser = super(CreateProject, self).get_parser(prog_name) parser.add_argument( @@ -81,7 +76,6 @@ class CreateProject(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -129,8 +123,6 @@ class CreateProject(show.ShowOne): class DeleteProject(command.Command): """Delete project(s)""" - log = logging.getLogger(__name__ + '.DeleteProject') - def get_parser(self, prog_name): parser = super(DeleteProject, self).get_parser(prog_name) parser.add_argument( @@ -146,7 +138,6 @@ class DeleteProject(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -165,11 +156,9 @@ class DeleteProject(command.Command): return -class ListProject(lister.Lister): +class ListProject(command.Lister): """List projects""" - log = logging.getLogger(__name__ + '.ListProject') - def get_parser(self, prog_name): parser = super(ListProject, self).get_parser(prog_name) parser.add_argument( @@ -190,7 +179,6 @@ class ListProject(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity if parsed_args.long: @@ -227,8 +215,6 @@ class ListProject(lister.Lister): class SetProject(command.Command): """Set project properties""" - log = logging.getLogger(__name__ + '.SetProject') - def get_parser(self, prog_name): parser = super(SetProject, self).get_parser(prog_name) parser.add_argument( @@ -271,7 +257,6 @@ class SetProject(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -302,11 +287,9 @@ class SetProject(command.Command): return -class ShowProject(show.ShowOne): +class ShowProject(command.ShowOne): """Display project details""" - log = logging.getLogger(__name__ + '.ShowProject') - def get_parser(self, prog_name): parser = super(ShowProject, self).get_parser(prog_name) parser.add_argument( @@ -333,7 +316,6 @@ class ShowProject(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity diff --git a/openstackclient/identity/v3/region.py b/openstackclient/identity/v3/region.py index 1ff0b8c069..1e15fd203c 100644 --- a/openstackclient/identity/v3/region.py +++ b/openstackclient/identity/v3/region.py @@ -13,22 +13,16 @@ """Identity v3 Region action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils from openstackclient.i18n import _ # noqa -class CreateRegion(show.ShowOne): +class CreateRegion(command.ShowOne): """Create new region""" - log = logging.getLogger(__name__ + '.CreateRegion') - def get_parser(self, prog_name): parser = super(CreateRegion, self).get_parser(prog_name) # NOTE(stevemar): The API supports an optional region ID, but that @@ -50,7 +44,6 @@ class CreateRegion(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -69,8 +62,6 @@ class CreateRegion(show.ShowOne): class DeleteRegion(command.Command): """Delete region""" - log = logging.getLogger(__name__ + '.DeleteRegion') - def get_parser(self, prog_name): parser = super(DeleteRegion, self).get_parser(prog_name) parser.add_argument( @@ -80,7 +71,6 @@ class DeleteRegion(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -88,11 +78,9 @@ class DeleteRegion(command.Command): return -class ListRegion(lister.Lister): +class ListRegion(command.Lister): """List regions""" - log = logging.getLogger(__name__ + '.ListRegion') - def get_parser(self, prog_name): parser = super(ListRegion, self).get_parser(prog_name) parser.add_argument( @@ -102,7 +90,6 @@ class ListRegion(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -124,8 +111,6 @@ class ListRegion(lister.Lister): class SetRegion(command.Command): """Set region properties""" - log = logging.getLogger(__name__ + '.SetRegion') - def get_parser(self, prog_name): parser = super(SetRegion, self).get_parser(prog_name) parser.add_argument( @@ -145,7 +130,6 @@ class SetRegion(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -162,11 +146,9 @@ class SetRegion(command.Command): return -class ShowRegion(show.ShowOne): +class ShowRegion(command.ShowOne): """Display region details""" - log = logging.getLogger(__name__ + '.ShowRegion') - def get_parser(self, prog_name): parser = super(ShowRegion, self).get_parser(prog_name) parser.add_argument( @@ -176,7 +158,6 @@ class ShowRegion(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity diff --git a/openstackclient/identity/v3/role.py b/openstackclient/identity/v3/role.py index 66f189649b..4cced61170 100644 --- a/openstackclient/identity/v3/role.py +++ b/openstackclient/identity/v3/role.py @@ -15,15 +15,12 @@ """Identity v3 Role action implementations""" -import logging import six import sys -from cliff import command -from cliff import lister -from cliff import show from keystoneauth1 import exceptions as ks_exc +from openstackclient.common import command from openstackclient.common import utils from openstackclient.i18n import _ # noqa from openstackclient.identity import common @@ -110,8 +107,6 @@ def _process_identity_and_resource_options(parsed_args, class AddRole(command.Command): """Adds a role to a user or group on a domain or project""" - log = logging.getLogger(__name__ + '.AddRole') - def get_parser(self, prog_name): parser = super(AddRole, self).get_parser(prog_name) parser.add_argument( @@ -122,7 +117,6 @@ class AddRole(command.Command): _add_identity_and_resource_options_to_parser(parser) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -147,11 +141,9 @@ class AddRole(command.Command): return -class CreateRole(show.ShowOne): +class CreateRole(command.ShowOne): """Create new role""" - log = logging.getLogger(__name__ + '.CreateRole') - def get_parser(self, prog_name): parser = super(CreateRole, self).get_parser(prog_name) parser.add_argument( @@ -166,7 +158,6 @@ class CreateRole(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -187,8 +178,6 @@ class CreateRole(show.ShowOne): class DeleteRole(command.Command): """Delete role(s)""" - log = logging.getLogger(__name__ + '.DeleteRole') - def get_parser(self, prog_name): parser = super(DeleteRole, self).get_parser(prog_name) parser.add_argument( @@ -199,7 +188,6 @@ class DeleteRole(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -212,18 +200,15 @@ class DeleteRole(command.Command): return -class ListRole(lister.Lister): +class ListRole(command.Lister): """List roles""" - log = logging.getLogger(__name__ + '.ListRole') - def get_parser(self, prog_name): parser = super(ListRole, self).get_parser(prog_name) _add_identity_and_resource_options_to_parser(parser) return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) identity_client = self.app.client_manager.identity if parsed_args.user: @@ -318,8 +303,6 @@ class ListRole(lister.Lister): class RemoveRole(command.Command): """Remove role from domain/project : user/group""" - log = logging.getLogger(__name__ + '.RemoveRole') - def get_parser(self, prog_name): parser = super(RemoveRole, self).get_parser(prog_name) parser.add_argument( @@ -330,7 +313,6 @@ class RemoveRole(command.Command): _add_identity_and_resource_options_to_parser(parser) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -357,8 +339,6 @@ class RemoveRole(command.Command): class SetRole(command.Command): """Set role properties""" - log = logging.getLogger(__name__ + '.SetRole') - def get_parser(self, prog_name): parser = super(SetRole, self).get_parser(prog_name) parser.add_argument( @@ -373,7 +353,6 @@ class SetRole(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -389,11 +368,9 @@ class SetRole(command.Command): return -class ShowRole(show.ShowOne): +class ShowRole(command.ShowOne): """Display role details""" - log = logging.getLogger(__name__ + '.ShowRole') - def get_parser(self, prog_name): parser = super(ShowRole, self).get_parser(prog_name) parser.add_argument( @@ -403,7 +380,6 @@ class ShowRole(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity diff --git a/openstackclient/identity/v3/role_assignment.py b/openstackclient/identity/v3/role_assignment.py index 169c6cb970..d766be686e 100644 --- a/openstackclient/identity/v3/role_assignment.py +++ b/openstackclient/identity/v3/role_assignment.py @@ -13,19 +13,14 @@ """Identity v3 Assignment action implementations """ -import logging - -from cliff import lister - +from openstackclient.common import command from openstackclient.common import utils from openstackclient.identity import common -class ListRoleAssignment(lister.Lister): +class ListRoleAssignment(command.Lister): """List role assignments""" - log = logging.getLogger(__name__ + '.ListRoleAssignment') - def get_parser(self, prog_name): parser = super(ListRoleAssignment, self).get_parser(prog_name) parser.add_argument( @@ -72,7 +67,6 @@ class ListRoleAssignment(lister.Lister): assignment.project, assignment.domain, assignment.inherited) def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) identity_client = self.app.client_manager.identity role = None @@ -114,7 +108,6 @@ class ListRoleAssignment(lister.Lister): ) effective = True if parsed_args.effective else False - self.log.debug('take_action(%s)' % parsed_args) columns = ('Role', 'User', 'Group', 'Project', 'Domain', 'Inherited') inherited_to = 'projects' if parsed_args.inherited else None diff --git a/openstackclient/identity/v3/service.py b/openstackclient/identity/v3/service.py index 85081aa764..42117c8de9 100644 --- a/openstackclient/identity/v3/service.py +++ b/openstackclient/identity/v3/service.py @@ -15,22 +15,16 @@ """Identity v3 Service action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils from openstackclient.identity import common -class CreateService(show.ShowOne): +class CreateService(command.ShowOne): """Create new service""" - log = logging.getLogger(__name__ + '.CreateService') - def get_parser(self, prog_name): parser = super(CreateService, self).get_parser(prog_name) parser.add_argument( @@ -61,7 +55,6 @@ class CreateService(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -83,8 +76,6 @@ class CreateService(show.ShowOne): class DeleteService(command.Command): """Delete service""" - log = logging.getLogger(__name__ + '.DeleteService') - def get_parser(self, prog_name): parser = super(DeleteService, self).get_parser(prog_name) parser.add_argument( @@ -94,7 +85,6 @@ class DeleteService(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -104,11 +94,9 @@ class DeleteService(command.Command): return -class ListService(lister.Lister): +class ListService(command.Lister): """List services""" - log = logging.getLogger(__name__ + '.ListService') - def get_parser(self, prog_name): parser = super(ListService, self).get_parser(prog_name) parser.add_argument( @@ -119,7 +107,6 @@ class ListService(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): if parsed_args.long: @@ -136,8 +123,6 @@ class ListService(lister.Lister): class SetService(command.Command): """Set service properties""" - log = logging.getLogger(__name__ + '.SetService') - def get_parser(self, prog_name): parser = super(SetService, self).get_parser(prog_name) parser.add_argument( @@ -173,7 +158,6 @@ class SetService(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -205,11 +189,9 @@ class SetService(command.Command): return -class ShowService(show.ShowOne): +class ShowService(command.ShowOne): """Display service details""" - log = logging.getLogger(__name__ + '.ShowService') - def get_parser(self, prog_name): parser = super(ShowService, self).get_parser(prog_name) parser.add_argument( @@ -219,7 +201,6 @@ class ShowService(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity diff --git a/openstackclient/identity/v3/service_provider.py b/openstackclient/identity/v3/service_provider.py index 838ad4a29e..6016928c11 100644 --- a/openstackclient/identity/v3/service_provider.py +++ b/openstackclient/identity/v3/service_provider.py @@ -13,22 +13,16 @@ """Service Provider action implementations""" -import logging import six import sys -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils -class CreateServiceProvider(show.ShowOne): +class CreateServiceProvider(command.ShowOne): """Create new service provider""" - log = logging.getLogger(__name__ + '.CreateServiceProvider') - def get_parser(self, prog_name): parser = super(CreateServiceProvider, self).get_parser(prog_name) parser.add_argument( @@ -73,7 +67,6 @@ class CreateServiceProvider(show.ShowOne): return parser - @utils.log_method(log) def take_action(self, parsed_args): service_client = self.app.client_manager.identity sp = service_client.federation.service_providers.create( @@ -90,8 +83,6 @@ class CreateServiceProvider(show.ShowOne): class DeleteServiceProvider(command.Command): """Delete service provider""" - log = logging.getLogger(__name__ + '.DeleteServiceProvider') - def get_parser(self, prog_name): parser = super(DeleteServiceProvider, self).get_parser(prog_name) parser.add_argument( @@ -101,7 +92,6 @@ class DeleteServiceProvider(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): service_client = self.app.client_manager.identity service_client.federation.service_providers.delete( @@ -109,12 +99,9 @@ class DeleteServiceProvider(command.Command): return -class ListServiceProvider(lister.Lister): +class ListServiceProvider(command.Lister): """List service providers""" - log = logging.getLogger(__name__ + '.ListServiceProvider') - - @utils.log_method(log) def take_action(self, parsed_args): service_client = self.app.client_manager.identity data = service_client.federation.service_providers.list() @@ -130,8 +117,6 @@ class ListServiceProvider(lister.Lister): class SetServiceProvider(command.Command): """Set service provider properties""" - log = logging.getLogger(__name__ + '.SetServiceProvider') - def get_parser(self, prog_name): parser = super(SetServiceProvider, self).get_parser(prog_name) parser.add_argument( @@ -168,7 +153,6 @@ class SetServiceProvider(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): federation_client = self.app.client_manager.identity.federation @@ -193,11 +177,9 @@ class SetServiceProvider(command.Command): return zip(*sorted(six.iteritems(service_provider._info))) -class ShowServiceProvider(show.ShowOne): +class ShowServiceProvider(command.ShowOne): """Display service provider details""" - log = logging.getLogger(__name__ + '.ShowServiceProvider') - def get_parser(self, prog_name): parser = super(ShowServiceProvider, self).get_parser(prog_name) parser.add_argument( @@ -207,7 +189,6 @@ class ShowServiceProvider(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): service_client = self.app.client_manager.identity service_provider = utils.find_resource( diff --git a/openstackclient/identity/v3/token.py b/openstackclient/identity/v3/token.py index cd3dc798fd..588c5218ff 100644 --- a/openstackclient/identity/v3/token.py +++ b/openstackclient/identity/v3/token.py @@ -15,20 +15,16 @@ """Identity v3 Token action implementations""" -import logging import six -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils from openstackclient.identity import common -class AuthorizeRequestToken(show.ShowOne): +class AuthorizeRequestToken(command.ShowOne): """Authorize a request token""" - log = logging.getLogger(__name__ + '.AuthorizeRequestToken') - def get_parser(self, prog_name): parser = super(AuthorizeRequestToken, self).get_parser(prog_name) parser.add_argument( @@ -49,7 +45,6 @@ class AuthorizeRequestToken(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 # NOTE(stevemar): We want a list of role ids @@ -68,11 +63,9 @@ class AuthorizeRequestToken(show.ShowOne): return zip(*sorted(six.iteritems(verifier_pin._info))) -class CreateAccessToken(show.ShowOne): +class CreateAccessToken(command.ShowOne): """Create an access token""" - log = logging.getLogger(__name__ + '.CreateAccessToken') - def get_parser(self, prog_name): parser = super(CreateAccessToken, self).get_parser(prog_name) parser.add_argument( @@ -108,7 +101,6 @@ class CreateAccessToken(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) token_client = self.app.client_manager.identity.oauth1.access_tokens access_token = token_client.create( parsed_args.consumer_key, parsed_args.consumer_secret, @@ -117,11 +109,9 @@ class CreateAccessToken(show.ShowOne): return zip(*sorted(six.iteritems(access_token._info))) -class CreateRequestToken(show.ShowOne): +class CreateRequestToken(command.ShowOne): """Create a request token""" - log = logging.getLogger(__name__ + '.CreateRequestToken') - def get_parser(self, prog_name): parser = super(CreateRequestToken, self).get_parser(prog_name) parser.add_argument( @@ -151,8 +141,6 @@ class CreateRequestToken(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 if parsed_args.domain: @@ -173,16 +161,13 @@ class CreateRequestToken(show.ShowOne): return zip(*sorted(six.iteritems(request_token._info))) -class IssueToken(show.ShowOne): +class IssueToken(command.ShowOne): """Issue new token""" - log = logging.getLogger(__name__ + '.IssueToken') - def get_parser(self, prog_name): parser = super(IssueToken, self).get_parser(prog_name) return parser - @utils.log_method(log) def take_action(self, parsed_args): token = self.app.client_manager.auth_ref.service_catalog.get_token() if 'tenant_id' in token: diff --git a/openstackclient/identity/v3/trust.py b/openstackclient/identity/v3/trust.py index 2c3cf53775..26fb8338fe 100644 --- a/openstackclient/identity/v3/trust.py +++ b/openstackclient/identity/v3/trust.py @@ -14,22 +14,16 @@ """Identity v3 Trust action implementations""" import datetime -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils from openstackclient.identity import common -class CreateTrust(show.ShowOne): +class CreateTrust(command.ShowOne): """Create new trust""" - log = logging.getLogger(__name__ + '.CreateTrust') - def get_parser(self, prog_name): parser = super(CreateTrust, self).get_parser(prog_name) parser.add_argument( @@ -85,7 +79,6 @@ class CreateTrust(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 # NOTE(stevemar): Find the two users, project and roles that @@ -138,8 +131,6 @@ class CreateTrust(show.ShowOne): class DeleteTrust(command.Command): """Delete trust(s)""" - log = logging.getLogger(__name__ + '.DeleteTrust') - def get_parser(self, prog_name): parser = super(DeleteTrust, self).get_parser(prog_name) parser.add_argument( @@ -151,20 +142,16 @@ class DeleteTrust(command.Command): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) identity_client = self.app.client_manager.identity for t in parsed_args.trust: trust_obj = utils.find_resource(identity_client.trusts, t) identity_client.trusts.delete(trust_obj.id) -class ListTrust(lister.Lister): +class ListTrust(command.Lister): """List trusts""" - log = logging.getLogger(__name__ + '.ListTrust') - def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) columns = ('ID', 'Expires At', 'Impersonation', 'Project ID', 'Trustee User ID', 'Trustor User ID') data = self.app.client_manager.identity.trusts.list() @@ -175,11 +162,9 @@ class ListTrust(lister.Lister): ) for s in data)) -class ShowTrust(show.ShowOne): +class ShowTrust(command.ShowOne): """Display trust details""" - log = logging.getLogger(__name__ + '.ShowTrust') - def get_parser(self, prog_name): parser = super(ShowTrust, self).get_parser(prog_name) parser.add_argument( @@ -190,7 +175,6 @@ class ShowTrust(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 trust = utils.find_resource(identity_client.trusts, parsed_args.trust) diff --git a/openstackclient/identity/v3/unscoped_saml.py b/openstackclient/identity/v3/unscoped_saml.py index e659e75e82..a42637ddc3 100644 --- a/openstackclient/identity/v3/unscoped_saml.py +++ b/openstackclient/identity/v3/unscoped_saml.py @@ -17,10 +17,7 @@ The first step of federated auth is to fetch an unscoped token. From there, the user can list domains and projects they are allowed to access, and request a scoped token.""" -import logging - -from cliff import lister - +from openstackclient.common import command from openstackclient.common import exceptions from openstackclient.common import utils @@ -43,13 +40,10 @@ def auth_with_unscoped_saml(func): return _decorated -class ListAccessibleDomains(lister.Lister): +class ListAccessibleDomains(command.Lister): """List accessible domains""" - log = logging.getLogger(__name__ + '.ListAccessibleDomains') - @auth_with_unscoped_saml - @utils.log_method(log) def take_action(self, parsed_args): columns = ('ID', 'Enabled', 'Name', 'Description') identity_client = self.app.client_manager.identity @@ -61,13 +55,10 @@ class ListAccessibleDomains(lister.Lister): ) for s in data)) -class ListAccessibleProjects(lister.Lister): +class ListAccessibleProjects(command.Lister): """List accessible projects""" - log = logging.getLogger(__name__ + '.ListAccessibleProjects') - @auth_with_unscoped_saml - @utils.log_method(log) def take_action(self, parsed_args): columns = ('ID', 'Domain ID', 'Enabled', 'Name') identity_client = self.app.client_manager.identity diff --git a/openstackclient/identity/v3/user.py b/openstackclient/identity/v3/user.py index 43a116cb36..c694c6aeb6 100644 --- a/openstackclient/identity/v3/user.py +++ b/openstackclient/identity/v3/user.py @@ -16,24 +16,19 @@ """Identity v3 User action implementations""" import copy -import logging import six -from cliff import command -from cliff import lister -from cliff import show from keystoneauth1 import exceptions as ks_exc +from openstackclient.common import command from openstackclient.common import utils from openstackclient.i18n import _ # noqa from openstackclient.identity import common -class CreateUser(show.ShowOne): +class CreateUser(command.ShowOne): """Create new user""" - log = logging.getLogger(__name__ + '.CreateUser') - def get_parser(self, prog_name): parser = super(CreateUser, self).get_parser(prog_name) parser.add_argument( @@ -91,7 +86,6 @@ class CreateUser(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -138,8 +132,6 @@ class CreateUser(show.ShowOne): class DeleteUser(command.Command): """Delete user(s)""" - log = logging.getLogger(__name__ + '.DeleteUser') - def get_parser(self, prog_name): parser = super(DeleteUser, self).get_parser(prog_name) parser.add_argument( @@ -155,7 +147,6 @@ class DeleteUser(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -174,11 +165,9 @@ class DeleteUser(command.Command): return -class ListUser(lister.Lister): +class ListUser(command.Lister): """List users""" - log = logging.getLogger(__name__ + '.ListUser') - def get_parser(self, prog_name): parser = super(ListUser, self).get_parser(prog_name) parser.add_argument( @@ -205,7 +194,6 @@ class ListUser(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -280,8 +268,6 @@ class ListUser(lister.Lister): class SetUser(command.Command): """Set user properties""" - log = logging.getLogger(__name__ + '.SetUser') - def get_parser(self, prog_name): parser = super(SetUser, self).get_parser(prog_name) parser.add_argument( @@ -334,7 +320,6 @@ class SetUser(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -383,8 +368,6 @@ class SetUser(command.Command): class SetPasswordUser(command.Command): """Change current user password""" - log = logging.getLogger(__name__ + '.SetPasswordUser') - def get_parser(self, prog_name): parser = super(SetPasswordUser, self).get_parser(prog_name) parser.add_argument( @@ -399,7 +382,6 @@ class SetPasswordUser(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -436,11 +418,9 @@ class SetPasswordUser(command.Command): identity_client.users.update_password(current_password, password) -class ShowUser(show.ShowOne): +class ShowUser(command.ShowOne): """Display user details""" - log = logging.getLogger(__name__ + '.ShowUser') - def get_parser(self, prog_name): parser = super(ShowUser, self).get_parser(prog_name) parser.add_argument( @@ -455,7 +435,6 @@ class ShowUser(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py index c18f3fc79d..9cc5facd43 100644 --- a/openstackclient/image/v1/image.py +++ b/openstackclient/image/v1/image.py @@ -17,7 +17,6 @@ import argparse import io -import logging import os import six import sys @@ -27,12 +26,9 @@ if os.name == "nt": else: msvcrt = None -from cliff import command -from cliff import lister -from cliff import show - from glanceclient.common import utils as gc_utils from openstackclient.api import utils as api_utils +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils from openstackclient.i18n import _ # noqa @@ -57,11 +53,9 @@ def _format_visibility(data): return 'private' -class CreateImage(show.ShowOne): +class CreateImage(command.ShowOne): """Create/upload an image""" - log = logging.getLogger(__name__ + ".CreateImage") - def get_parser(self, prog_name): parser = super(CreateImage, self).get_parser(prog_name) parser.add_argument( @@ -191,7 +185,6 @@ class CreateImage(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) image_client = self.app.client_manager.image if getattr(parsed_args, 'owner', None) is not None: @@ -283,8 +276,6 @@ class CreateImage(show.ShowOne): class DeleteImage(command.Command): """Delete image(s)""" - log = logging.getLogger(__name__ + ".DeleteImage") - def get_parser(self, prog_name): parser = super(DeleteImage, self).get_parser(prog_name) parser.add_argument( @@ -296,8 +287,6 @@ class DeleteImage(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - image_client = self.app.client_manager.image for image in parsed_args.images: image_obj = utils.find_resource( @@ -307,11 +296,9 @@ class DeleteImage(command.Command): image_client.images.delete(image_obj.id) -class ListImage(lister.Lister): +class ListImage(command.Lister): """List available images""" - log = logging.getLogger(__name__ + ".ListImage") - def get_parser(self, prog_name): parser = super(ListImage, self).get_parser(prog_name) public_group = parser.add_mutually_exclusive_group() @@ -367,8 +354,6 @@ class ListImage(lister.Lister): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - image_client = self.app.client_manager.image kwargs = {} @@ -452,8 +437,6 @@ class ListImage(lister.Lister): class SaveImage(command.Command): """Save an image locally""" - log = logging.getLogger(__name__ + ".SaveImage") - def get_parser(self, prog_name): parser = super(SaveImage, self).get_parser(prog_name) parser.add_argument( @@ -469,8 +452,6 @@ class SaveImage(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - image_client = self.app.client_manager.image image = utils.find_resource( image_client.images, @@ -484,8 +465,6 @@ class SaveImage(command.Command): class SetImage(command.Command): """Set image properties""" - log = logging.getLogger(__name__ + ".SetImage") - def get_parser(self, prog_name): parser = super(SetImage, self).get_parser(prog_name) parser.add_argument( @@ -624,7 +603,6 @@ class SetImage(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) image_client = self.app.client_manager.image if getattr(parsed_args, 'owner', None) is not None: @@ -723,11 +701,9 @@ class SetImage(command.Command): kwargs['data'].close() -class ShowImage(show.ShowOne): +class ShowImage(command.ShowOne): """Display image details""" - log = logging.getLogger(__name__ + ".ShowImage") - def get_parser(self, prog_name): parser = super(ShowImage, self).get_parser(prog_name) parser.add_argument( @@ -738,8 +714,6 @@ class ShowImage(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - image_client = self.app.client_manager.image image = utils.find_resource( image_client.images, diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py index 123599ede0..39a5319593 100644 --- a/openstackclient/image/v2/image.py +++ b/openstackclient/image/v2/image.py @@ -16,15 +16,12 @@ """Image V2 Action Implementations""" import argparse -import logging import six -from cliff import command -from cliff import lister -from cliff import show from glanceclient.common import utils as gc_utils from openstackclient.api import utils as api_utils +from openstackclient.common import command from openstackclient.common import exceptions from openstackclient.common import parseractions from openstackclient.common import utils @@ -67,11 +64,9 @@ def _format_image(image): return info -class AddProjectToImage(show.ShowOne): +class AddProjectToImage(command.ShowOne): """Associate project with image""" - log = logging.getLogger(__name__ + ".AddProjectToImage") - def get_parser(self, prog_name): parser = super(AddProjectToImage, self).get_parser(prog_name) parser.add_argument( @@ -88,8 +83,6 @@ class AddProjectToImage(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - image_client = self.app.client_manager.image identity_client = self.app.client_manager.identity @@ -109,10 +102,9 @@ class AddProjectToImage(show.ShowOne): return zip(*sorted(six.iteritems(image_member))) -class CreateImage(show.ShowOne): +class CreateImage(command.ShowOne): """Create/upload an image""" - log = logging.getLogger(__name__ + ".CreateImage") deadopts = ('size', 'location', 'copy-from', 'checksum', 'store') def get_parser(self, prog_name): @@ -241,7 +233,6 @@ class CreateImage(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 image_client = self.app.client_manager.image @@ -366,8 +357,6 @@ class CreateImage(show.ShowOne): class DeleteImage(command.Command): """Delete image(s)""" - log = logging.getLogger(__name__ + ".DeleteImage") - def get_parser(self, prog_name): parser = super(DeleteImage, self).get_parser(prog_name) parser.add_argument( @@ -379,8 +368,6 @@ class DeleteImage(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - image_client = self.app.client_manager.image for image in parsed_args.images: image_obj = utils.find_resource( @@ -390,11 +377,9 @@ class DeleteImage(command.Command): image_client.images.delete(image_obj.id) -class ListImage(lister.Lister): +class ListImage(command.Lister): """List available images""" - log = logging.getLogger(__name__ + ".ListImage") - def get_parser(self, prog_name): parser = super(ListImage, self).get_parser(prog_name) public_group = parser.add_mutually_exclusive_group() @@ -449,8 +434,6 @@ class ListImage(lister.Lister): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - image_client = self.app.client_manager.image kwargs = {} @@ -529,8 +512,6 @@ class ListImage(lister.Lister): class RemoveProjectImage(command.Command): """Disassociate project with image""" - log = logging.getLogger(__name__ + ".RemoveProjectImage") - def get_parser(self, prog_name): parser = super(RemoveProjectImage, self).get_parser(prog_name) parser.add_argument( @@ -547,8 +528,6 @@ class RemoveProjectImage(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - image_client = self.app.client_manager.image identity_client = self.app.client_manager.identity @@ -566,8 +545,6 @@ class RemoveProjectImage(command.Command): class SaveImage(command.Command): """Save an image locally""" - log = logging.getLogger(__name__ + ".SaveImage") - def get_parser(self, prog_name): parser = super(SaveImage, self).get_parser(prog_name) parser.add_argument( @@ -583,8 +560,6 @@ class SaveImage(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - image_client = self.app.client_manager.image image = utils.find_resource( image_client.images, @@ -598,7 +573,6 @@ class SaveImage(command.Command): class SetImage(command.Command): """Set image properties""" - log = logging.getLogger(__name__ + ".SetImage") deadopts = ('visibility',) def get_parser(self, prog_name): @@ -758,7 +732,6 @@ class SetImage(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) identity_client = self.app.client_manager.identity image_client = self.app.client_manager.image @@ -848,11 +821,9 @@ class SetImage(command.Command): raise e -class ShowImage(show.ShowOne): +class ShowImage(command.ShowOne): """Display image details""" - log = logging.getLogger(__name__ + ".ShowImage") - def get_parser(self, prog_name): parser = super(ShowImage, self).get_parser(prog_name) parser.add_argument( @@ -863,8 +834,6 @@ class ShowImage(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - image_client = self.app.client_manager.image image = utils.find_resource( image_client.images, diff --git a/openstackclient/network/v2/network.py b/openstackclient/network/v2/network.py index 7d9324f085..fc94fd8277 100644 --- a/openstackclient/network/v2/network.py +++ b/openstackclient/network/v2/network.py @@ -13,12 +13,7 @@ """Network action implementations""" -import logging - -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import exceptions from openstackclient.common import utils from openstackclient.identity import common as identity_common @@ -52,11 +47,9 @@ def _get_columns(item): return tuple(sorted(columns)) -class CreateNetwork(show.ShowOne): +class CreateNetwork(command.ShowOne): """Create new network""" - log = logging.getLogger(__name__ + '.CreateNetwork') - def get_parser(self, prog_name): parser = super(CreateNetwork, self).get_parser(prog_name) parser.add_argument( @@ -111,7 +104,6 @@ class CreateNetwork(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) client = self.app.client_manager.network body = self.get_body(parsed_args) obj = client.create_network(**body) @@ -142,8 +134,6 @@ class CreateNetwork(show.ShowOne): class DeleteNetwork(command.Command): """Delete network(s)""" - log = logging.getLogger(__name__ + '.DeleteNetwork') - def get_parser(self, prog_name): parser = super(DeleteNetwork, self).get_parser(prog_name) parser.add_argument( @@ -155,18 +145,15 @@ class DeleteNetwork(command.Command): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) client = self.app.client_manager.network for network in parsed_args.network: obj = client.find_network(network) client.delete_network(obj) -class ListNetwork(lister.Lister): +class ListNetwork(command.Lister): """List networks""" - log = logging.getLogger(__name__ + '.ListNetwork') - def get_parser(self, prog_name): parser = super(ListNetwork, self).get_parser(prog_name) parser.add_argument( @@ -184,7 +171,6 @@ class ListNetwork(lister.Lister): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) client = self.app.client_manager.network if parsed_args.long: @@ -239,8 +225,6 @@ class ListNetwork(lister.Lister): class SetNetwork(command.Command): """Set network properties""" - log = logging.getLogger(__name__ + '.SetNetwork') - def get_parser(self, prog_name): parser = super(SetNetwork, self).get_parser(prog_name) parser.add_argument( @@ -284,7 +268,6 @@ class SetNetwork(command.Command): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) client = self.app.client_manager.network obj = client.find_network(parsed_args.identifier, ignore_missing=False) @@ -302,11 +285,9 @@ class SetNetwork(command.Command): client.update_network(obj) -class ShowNetwork(show.ShowOne): +class ShowNetwork(command.ShowOne): """Show network details""" - log = logging.getLogger(__name__ + '.ShowNetwork') - def get_parser(self, prog_name): parser = super(ShowNetwork, self).get_parser(prog_name) parser.add_argument( @@ -317,7 +298,6 @@ class ShowNetwork(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) client = self.app.client_manager.network obj = client.find_network(parsed_args.identifier, ignore_missing=False) columns = _get_columns(obj) diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py index ad906a287a..b91ac58899 100644 --- a/openstackclient/network/v2/port.py +++ b/openstackclient/network/v2/port.py @@ -13,16 +13,12 @@ """Port action implementations""" -import logging - from cliff import command class DeletePort(command.Command): """Delete port(s)""" - log = logging.getLogger(__name__ + '.DeletePort') - def get_parser(self, prog_name): parser = super(DeletePort, self).get_parser(prog_name) parser.add_argument( @@ -34,7 +30,6 @@ class DeletePort(command.Command): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) client = self.app.client_manager.network for port in parsed_args.port: diff --git a/openstackclient/network/v2/router.py b/openstackclient/network/v2/router.py index 09e0fe4c84..6c8acb6315 100644 --- a/openstackclient/network/v2/router.py +++ b/openstackclient/network/v2/router.py @@ -14,12 +14,8 @@ """Router action implementations""" import json -import logging - -from cliff import command -from cliff import lister -from cliff import show +from openstackclient.common import command from openstackclient.common import exceptions from openstackclient.common import utils from openstackclient.identity import common as identity_common @@ -67,11 +63,9 @@ def _get_attrs(client_manager, parsed_args): return attrs -class CreateRouter(show.ShowOne): +class CreateRouter(command.ShowOne): """Create a new router""" - log = logging.getLogger(__name__ + '.CreateRouter') - def get_parser(self, prog_name): parser = super(CreateRouter, self).get_parser(prog_name) parser.add_argument( @@ -109,7 +103,6 @@ class CreateRouter(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) client = self.app.client_manager.network attrs = _get_attrs(self.app.client_manager, parsed_args) @@ -128,8 +121,6 @@ class CreateRouter(show.ShowOne): class DeleteRouter(command.Command): """Delete router(s)""" - log = logging.getLogger(__name__ + '.DeleteRouter') - def get_parser(self, prog_name): parser = super(DeleteRouter, self).get_parser(prog_name) parser.add_argument( @@ -141,18 +132,15 @@ class DeleteRouter(command.Command): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) client = self.app.client_manager.network for router in parsed_args.router: obj = client.find_router(router) client.delete_router(obj) -class ListRouter(lister.Lister): +class ListRouter(command.Lister): """List routers""" - log = logging.getLogger(__name__ + '.ListRouter') - def get_parser(self, prog_name): parser = super(ListRouter, self).get_parser(prog_name) parser.add_argument( @@ -164,7 +152,6 @@ class ListRouter(lister.Lister): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) client = self.app.client_manager.network columns = ( @@ -206,8 +193,6 @@ class ListRouter(lister.Lister): class SetRouter(command.Command): """Set router properties""" - log = logging.getLogger(__name__ + '.SetRouter') - def get_parser(self, prog_name): parser = super(SetRouter, self).get_parser(prog_name) parser.add_argument( @@ -262,7 +247,6 @@ class SetRouter(command.Command): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) client = self.app.client_manager.network obj = client.find_router(parsed_args.router, ignore_missing=False) @@ -274,11 +258,9 @@ class SetRouter(command.Command): client.update_router(obj, **attrs) -class ShowRouter(show.ShowOne): +class ShowRouter(command.ShowOne): """Display router details""" - log = logging.getLogger(__name__ + '.ShowRouter') - def get_parser(self, prog_name): parser = super(ShowRouter, self).get_parser(prog_name) parser.add_argument( @@ -289,7 +271,6 @@ class ShowRouter(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) client = self.app.client_manager.network obj = client.find_router(parsed_args.router, ignore_missing=False) columns = sorted(obj.keys()) diff --git a/openstackclient/network/v2/subnet.py b/openstackclient/network/v2/subnet.py index 627471252a..467b6507b8 100644 --- a/openstackclient/network/v2/subnet.py +++ b/openstackclient/network/v2/subnet.py @@ -13,8 +13,6 @@ """Subnet action implementations""" -import logging - from cliff import lister from openstackclient.common import utils @@ -36,8 +34,6 @@ _formatters = { class ListSubnet(lister.Lister): """List subnets""" - log = logging.getLogger(__name__ + '.ListSubnet') - def get_parser(self, prog_name): parser = super(ListSubnet, self).get_parser(prog_name) parser.add_argument( @@ -49,8 +45,6 @@ class ListSubnet(lister.Lister): return parser def take_action(self, parsed_args): - self.log.debug('take_action(%s)' % parsed_args) - data = self.app.client_manager.network.subnets() headers = ('ID', 'Name', 'Network', 'Subnet') diff --git a/openstackclient/object/v1/account.py b/openstackclient/object/v1/account.py index aa94ff5c2c..543ce4f3a0 100644 --- a/openstackclient/object/v1/account.py +++ b/openstackclient/object/v1/account.py @@ -13,12 +13,9 @@ """Account v1 action implementations""" -import logging - -from cliff import command -from cliff import show import six +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils @@ -26,8 +23,6 @@ from openstackclient.common import utils class SetAccount(command.Command): """Set account properties""" - log = logging.getLogger(__name__ + '.SetAccount') - def get_parser(self, prog_name): parser = super(SetAccount, self).get_parser(prog_name) parser.add_argument( @@ -40,19 +35,15 @@ class SetAccount(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): self.app.client_manager.object_store.account_set( properties=parsed_args.property, ) -class ShowAccount(show.ShowOne): +class ShowAccount(command.ShowOne): """Display account details""" - log = logging.getLogger(__name__ + '.ShowAccount') - - @utils.log_method(log) def take_action(self, parsed_args): data = self.app.client_manager.object_store.account_show() if 'properties' in data: @@ -63,8 +54,6 @@ class ShowAccount(show.ShowOne): class UnsetAccount(command.Command): """Unset account properties""" - log = logging.getLogger(__name__ + '.UnsetAccount') - def get_parser(self, prog_name): parser = super(UnsetAccount, self).get_parser(prog_name) parser.add_argument( @@ -78,7 +67,6 @@ class UnsetAccount(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): self.app.client_manager.object_store.account_unset( properties=parsed_args.property, diff --git a/openstackclient/object/v1/container.py b/openstackclient/object/v1/container.py index 8c8844e2b9..e70afd9d0e 100644 --- a/openstackclient/object/v1/container.py +++ b/openstackclient/object/v1/container.py @@ -16,22 +16,16 @@ """Container v1 action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils -class CreateContainer(lister.Lister): +class CreateContainer(command.Lister): """Create new container""" - log = logging.getLogger(__name__ + '.CreateContainer') - def get_parser(self, prog_name): parser = super(CreateContainer, self).get_parser(prog_name) parser.add_argument( @@ -42,7 +36,6 @@ class CreateContainer(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): results = [] @@ -63,8 +56,6 @@ class CreateContainer(lister.Lister): class DeleteContainer(command.Command): """Delete container""" - log = logging.getLogger(__name__ + '.DeleteContainer') - def get_parser(self, prog_name): parser = super(DeleteContainer, self).get_parser(prog_name) parser.add_argument( @@ -75,7 +66,6 @@ class DeleteContainer(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): for container in parsed_args.containers: @@ -84,11 +74,9 @@ class DeleteContainer(command.Command): ) -class ListContainer(lister.Lister): +class ListContainer(command.Lister): """List containers""" - log = logging.getLogger(__name__ + '.ListContainer') - def get_parser(self, prog_name): parser = super(ListContainer, self).get_parser(prog_name) parser.add_argument( @@ -126,7 +114,6 @@ class ListContainer(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): if parsed_args.long: @@ -160,8 +147,6 @@ class ListContainer(lister.Lister): class SaveContainer(command.Command): """Save container contents locally""" - log = logging.getLogger(__name__ + ".SaveContainer") - def get_parser(self, prog_name): parser = super(SaveContainer, self).get_parser(prog_name) parser.add_argument( @@ -172,8 +157,6 @@ class SaveContainer(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - self.app.client_manager.object_store.container_save( container=parsed_args.container, ) @@ -182,8 +165,6 @@ class SaveContainer(command.Command): class SetContainer(command.Command): """Set container properties""" - log = logging.getLogger(__name__ + '.SetContainer') - def get_parser(self, prog_name): parser = super(SetContainer, self).get_parser(prog_name) parser.add_argument( @@ -201,7 +182,6 @@ class SetContainer(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): self.app.client_manager.object_store.container_set( parsed_args.container, @@ -209,11 +189,9 @@ class SetContainer(command.Command): ) -class ShowContainer(show.ShowOne): +class ShowContainer(command.ShowOne): """Display container details""" - log = logging.getLogger(__name__ + '.ShowContainer') - def get_parser(self, prog_name): parser = super(ShowContainer, self).get_parser(prog_name) parser.add_argument( @@ -223,7 +201,6 @@ class ShowContainer(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): data = self.app.client_manager.object_store.container_show( @@ -238,8 +215,6 @@ class ShowContainer(show.ShowOne): class UnsetContainer(command.Command): """Unset container properties""" - log = logging.getLogger(__name__ + '.UnsetContainer') - def get_parser(self, prog_name): parser = super(UnsetContainer, self).get_parser(prog_name) parser.add_argument( @@ -258,7 +233,6 @@ class UnsetContainer(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): self.app.client_manager.object_store.container_unset( parsed_args.container, diff --git a/openstackclient/object/v1/object.py b/openstackclient/object/v1/object.py index 4bd06124d6..f9a55e9c96 100644 --- a/openstackclient/object/v1/object.py +++ b/openstackclient/object/v1/object.py @@ -16,22 +16,16 @@ """Object v1 action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils -class CreateObject(lister.Lister): +class CreateObject(command.Lister): """Upload object to container""" - log = logging.getLogger(__name__ + '.CreateObject') - def get_parser(self, prog_name): parser = super(CreateObject, self).get_parser(prog_name) parser.add_argument( @@ -47,7 +41,6 @@ class CreateObject(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): results = [] @@ -69,8 +62,6 @@ class CreateObject(lister.Lister): class DeleteObject(command.Command): """Delete object from container""" - log = logging.getLogger(__name__ + '.DeleteObject') - def get_parser(self, prog_name): parser = super(DeleteObject, self).get_parser(prog_name) parser.add_argument( @@ -86,7 +77,6 @@ class DeleteObject(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): for obj in parsed_args.objects: @@ -96,11 +86,9 @@ class DeleteObject(command.Command): ) -class ListObject(lister.Lister): +class ListObject(command.Lister): """List objects""" - log = logging.getLogger(__name__ + '.ListObject') - def get_parser(self, prog_name): parser = super(ListObject, self).get_parser(prog_name) parser.add_argument( @@ -148,7 +136,6 @@ class ListObject(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): if parsed_args.long: @@ -191,8 +178,6 @@ class ListObject(lister.Lister): class SaveObject(command.Command): """Save object locally""" - log = logging.getLogger(__name__ + ".SaveObject") - def get_parser(self, prog_name): parser = super(SaveObject, self).get_parser(prog_name) parser.add_argument( @@ -213,8 +198,6 @@ class SaveObject(command.Command): return parser def take_action(self, parsed_args): - self.log.debug("take_action(%s)", parsed_args) - self.app.client_manager.object_store.object_save( container=parsed_args.container, object=parsed_args.object, @@ -225,8 +208,6 @@ class SaveObject(command.Command): class SetObject(command.Command): """Set object properties""" - log = logging.getLogger(__name__ + '.SetObject') - def get_parser(self, prog_name): parser = super(SetObject, self).get_parser(prog_name) parser.add_argument( @@ -249,7 +230,6 @@ class SetObject(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): self.app.client_manager.object_store.object_set( parsed_args.container, @@ -258,11 +238,9 @@ class SetObject(command.Command): ) -class ShowObject(show.ShowOne): +class ShowObject(command.ShowOne): """Display object details""" - log = logging.getLogger(__name__ + '.ShowObject') - def get_parser(self, prog_name): parser = super(ShowObject, self).get_parser(prog_name) parser.add_argument( @@ -277,7 +255,6 @@ class ShowObject(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): data = self.app.client_manager.object_store.object_show( @@ -293,8 +270,6 @@ class ShowObject(show.ShowOne): class UnsetObject(command.Command): """Unset object properties""" - log = logging.getLogger(__name__ + '.UnsetObject') - def get_parser(self, prog_name): parser = super(UnsetObject, self).get_parser(prog_name) parser.add_argument( @@ -318,7 +293,6 @@ class UnsetObject(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): self.app.client_manager.object_store.object_unset( parsed_args.container, diff --git a/openstackclient/volume/v1/backup.py b/openstackclient/volume/v1/backup.py index 4f2ff8bb16..32f39fb539 100644 --- a/openstackclient/volume/v1/backup.py +++ b/openstackclient/volume/v1/backup.py @@ -16,21 +16,15 @@ """Volume v1 Backup action implementations""" import copy -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import utils -class CreateBackup(show.ShowOne): +class CreateBackup(command.ShowOne): """Create new backup""" - log = logging.getLogger(__name__ + '.CreateBackup') - def get_parser(self, prog_name): parser = super(CreateBackup, self).get_parser(prog_name) parser.add_argument( @@ -57,7 +51,6 @@ class CreateBackup(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume volume_id = utils.find_resource(volume_client.volumes, @@ -76,8 +69,6 @@ class CreateBackup(show.ShowOne): class DeleteBackup(command.Command): """Delete backup(s)""" - log = logging.getLogger(__name__ + '.DeleteBackup') - def get_parser(self, prog_name): parser = super(DeleteBackup, self).get_parser(prog_name) parser.add_argument( @@ -88,7 +79,6 @@ class DeleteBackup(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume for backup in parsed_args.backups: @@ -97,11 +87,9 @@ class DeleteBackup(command.Command): volume_client.backups.delete(backup_id) -class ListBackup(lister.Lister): +class ListBackup(command.Lister): """List backups""" - log = logging.getLogger(__name__ + '.ListBackup') - def get_parser(self, prog_name): parser = super(ListBackup, self).get_parser(prog_name) parser.add_argument( @@ -112,7 +100,6 @@ class ListBackup(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): def _format_volume_id(volume_id): @@ -157,8 +144,6 @@ class ListBackup(lister.Lister): class RestoreBackup(command.Command): """Restore backup""" - log = logging.getLogger(__name__ + '.RestoreBackup') - def get_parser(self, prog_name): parser = super(RestoreBackup, self).get_parser(prog_name) parser.add_argument( @@ -171,7 +156,6 @@ class RestoreBackup(command.Command): help='Volume to restore to (name or ID)') return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume backup = utils.find_resource(volume_client.backups, @@ -182,11 +166,9 @@ class RestoreBackup(command.Command): destination_volume.id) -class ShowBackup(show.ShowOne): +class ShowBackup(command.ShowOne): """Display backup details""" - log = logging.getLogger(__name__ + '.ShowBackup') - def get_parser(self, prog_name): parser = super(ShowBackup, self).get_parser(prog_name) parser.add_argument( @@ -195,7 +177,6 @@ class ShowBackup(show.ShowOne): help='Backup to display (ID only)') return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume backup = utils.find_resource(volume_client.backups, diff --git a/openstackclient/volume/v1/qos_specs.py b/openstackclient/volume/v1/qos_specs.py index 73e70a21fb..826e5c4938 100644 --- a/openstackclient/volume/v1/qos_specs.py +++ b/openstackclient/volume/v1/qos_specs.py @@ -15,13 +15,9 @@ """Volume v1 QoS action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils @@ -29,8 +25,6 @@ from openstackclient.common import utils class AssociateQos(command.Command): """Associate a QoS specification to a volume type""" - log = logging.getLogger(__name__ + '.AssociateQos') - def get_parser(self, prog_name): parser = super(AssociateQos, self).get_parser(prog_name) parser.add_argument( @@ -45,7 +39,6 @@ class AssociateQos(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume qos_spec = utils.find_resource(volume_client.qos_specs, @@ -56,11 +49,9 @@ class AssociateQos(command.Command): volume_client.qos_specs.associate(qos_spec.id, volume_type.id) -class CreateQos(show.ShowOne): +class CreateQos(command.ShowOne): """Create new QoS specification""" - log = logging.getLogger(__name__ + '.CreateQos') - def get_parser(self, prog_name): parser = super(CreateQos, self).get_parser(prog_name) parser.add_argument( @@ -86,7 +77,6 @@ class CreateQos(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume specs = {} @@ -103,8 +93,6 @@ class CreateQos(show.ShowOne): class DeleteQos(command.Command): """Delete QoS specification""" - log = logging.getLogger(__name__ + '.DeleteQos') - def get_parser(self, prog_name): parser = super(DeleteQos, self).get_parser(prog_name) parser.add_argument( @@ -115,7 +103,6 @@ class DeleteQos(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume for qos in parsed_args.qos_specs: @@ -126,8 +113,6 @@ class DeleteQos(command.Command): class DisassociateQos(command.Command): """Disassociate a QoS specification from a volume type""" - log = logging.getLogger(__name__ + '.DisassociateQos') - def get_parser(self, prog_name): parser = super(DisassociateQos, self).get_parser(prog_name) parser.add_argument( @@ -150,7 +135,6 @@ class DisassociateQos(command.Command): return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume qos_spec = utils.find_resource(volume_client.qos_specs, @@ -164,12 +148,9 @@ class DisassociateQos(command.Command): volume_client.qos_specs.disassociate_all(qos_spec.id) -class ListQos(lister.Lister): +class ListQos(command.Lister): """List QoS specifications""" - log = logging.getLogger(__name__ + '.ListQos') - - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume qos_specs_list = volume_client.qos_specs.list() @@ -195,8 +176,6 @@ class ListQos(lister.Lister): class SetQos(command.Command): """Set QoS specification properties""" - log = logging.getLogger(__name__ + '.SetQos') - def get_parser(self, prog_name): parser = super(SetQos, self).get_parser(prog_name) parser.add_argument( @@ -213,7 +192,6 @@ class SetQos(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume qos_spec = utils.find_resource(volume_client.qos_specs, @@ -226,11 +204,9 @@ class SetQos(command.Command): self.app.log.error("No changes requested\n") -class ShowQos(show.ShowOne): +class ShowQos(command.ShowOne): """Display QoS specification details""" - log = logging.getLogger(__name__ + '.ShowQos') - def get_parser(self, prog_name): parser = super(ShowQos, self).get_parser(prog_name) parser.add_argument( @@ -240,7 +216,6 @@ class ShowQos(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume qos_spec = utils.find_resource(volume_client.qos_specs, @@ -261,8 +236,6 @@ class ShowQos(show.ShowOne): class UnsetQos(command.Command): """Unset QoS specification properties""" - log = logging.getLogger(__name__ + '.SetQos') - def get_parser(self, prog_name): parser = super(UnsetQos, self).get_parser(prog_name) parser.add_argument( @@ -280,7 +253,6 @@ class UnsetQos(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume qos_spec = utils.find_resource(volume_client.qos_specs, diff --git a/openstackclient/volume/v1/snapshot.py b/openstackclient/volume/v1/snapshot.py index 24379a9a93..95200e4074 100644 --- a/openstackclient/volume/v1/snapshot.py +++ b/openstackclient/volume/v1/snapshot.py @@ -16,22 +16,16 @@ """Volume v1 Snapshot action implementations""" import copy -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils -class CreateSnapshot(show.ShowOne): +class CreateSnapshot(command.ShowOne): """Create new snapshot""" - log = logging.getLogger(__name__ + '.CreateSnapshot') - def get_parser(self, prog_name): parser = super(CreateSnapshot, self).get_parser(prog_name) parser.add_argument( @@ -59,7 +53,6 @@ class CreateSnapshot(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume volume_id = utils.find_resource(volume_client.volumes, @@ -81,8 +74,6 @@ class CreateSnapshot(show.ShowOne): class DeleteSnapshot(command.Command): """Delete snapshot(s)""" - log = logging.getLogger(__name__ + '.DeleteSnapshot') - def get_parser(self, prog_name): parser = super(DeleteSnapshot, self).get_parser(prog_name) parser.add_argument( @@ -93,7 +84,6 @@ class DeleteSnapshot(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume for snapshot in parsed_args.snapshots: @@ -102,11 +92,9 @@ class DeleteSnapshot(command.Command): volume_client.volume_snapshots.delete(snapshot_id) -class ListSnapshot(lister.Lister): +class ListSnapshot(command.Lister): """List snapshots""" - log = logging.getLogger(__name__ + '.ListSnapshot') - def get_parser(self, prog_name): parser = super(ListSnapshot, self).get_parser(prog_name) parser.add_argument( @@ -123,7 +111,6 @@ class ListSnapshot(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): def _format_volume_id(volume_id): @@ -179,8 +166,6 @@ class ListSnapshot(lister.Lister): class SetSnapshot(command.Command): """Set snapshot properties""" - log = logging.getLogger(__name__ + '.SetSnapshot') - def get_parser(self, prog_name): parser = super(SetSnapshot, self).get_parser(prog_name) parser.add_argument( @@ -204,7 +189,6 @@ class SetSnapshot(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume snapshot = utils.find_resource(volume_client.volume_snapshots, @@ -227,11 +211,9 @@ class SetSnapshot(command.Command): snapshot.update(**kwargs) -class ShowSnapshot(show.ShowOne): +class ShowSnapshot(command.ShowOne): """Display snapshot details""" - log = logging.getLogger(__name__ + '.ShowSnapshot') - def get_parser(self, prog_name): parser = super(ShowSnapshot, self).get_parser(prog_name) parser.add_argument( @@ -240,7 +222,6 @@ class ShowSnapshot(show.ShowOne): help='Snapshot to display (name or ID)') return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume snapshot = utils.find_resource(volume_client.volume_snapshots, @@ -256,8 +237,6 @@ class ShowSnapshot(show.ShowOne): class UnsetSnapshot(command.Command): """Unset snapshot properties""" - log = logging.getLogger(__name__ + '.UnsetSnapshot') - def get_parser(self, prog_name): parser = super(UnsetSnapshot, self).get_parser(prog_name) parser.add_argument( @@ -276,7 +255,6 @@ class UnsetSnapshot(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume snapshot = utils.find_resource( diff --git a/openstackclient/volume/v1/volume.py b/openstackclient/volume/v1/volume.py index 17b6c9c856..90827d2041 100644 --- a/openstackclient/volume/v1/volume.py +++ b/openstackclient/volume/v1/volume.py @@ -16,22 +16,16 @@ """Volume v1 Volume action implementations""" import argparse -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils -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( @@ -102,7 +96,6 @@ class CreateVolume(show.ShowOne): return parser - @utils.log_method(log) def take_action(self, parsed_args): identity_client = self.app.client_manager.identity @@ -166,8 +159,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( @@ -186,7 +177,6 @@ class DeleteVolume(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume for volume in parsed_args.volumes: @@ -198,11 +188,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( @@ -229,7 +217,6 @@ class ListVolume(lister.Lister): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume @@ -316,8 +303,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( @@ -350,7 +335,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) @@ -382,11 +366,9 @@ class SetVolume(command.Command): self.app.log.error("No changes requested\n") -class ShowVolume(show.ShowOne): +class ShowVolume(command.ShowOne): """Show volume details""" - log = logging.getLogger(__name__ + '.ShowVolume') - def get_parser(self, prog_name): parser = super(ShowVolume, self).get_parser(prog_name) parser.add_argument( @@ -396,7 +378,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) @@ -418,8 +399,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( @@ -438,7 +417,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( diff --git a/openstackclient/volume/v1/volume_type.py b/openstackclient/volume/v1/volume_type.py index b664adfba6..24d0b235ff 100644 --- a/openstackclient/volume/v1/volume_type.py +++ b/openstackclient/volume/v1/volume_type.py @@ -15,22 +15,16 @@ """Volume v1 Type action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils -class CreateVolumeType(show.ShowOne): +class CreateVolumeType(command.ShowOne): """Create new volume type""" - log = logging.getLogger(__name__ + '.CreateVolumeType') - def get_parser(self, prog_name): parser = super(CreateVolumeType, self).get_parser(prog_name) parser.add_argument( @@ -47,7 +41,6 @@ class CreateVolumeType(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume volume_type = volume_client.volume_types.create(parsed_args.name) @@ -64,8 +57,6 @@ class CreateVolumeType(show.ShowOne): class DeleteVolumeType(command.Command): """Delete volume type""" - log = logging.getLogger(__name__ + '.DeleteVolumeType') - def get_parser(self, prog_name): parser = super(DeleteVolumeType, self).get_parser(prog_name) parser.add_argument( @@ -75,7 +66,6 @@ class DeleteVolumeType(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume volume_type_id = utils.find_resource( @@ -83,11 +73,9 @@ class DeleteVolumeType(command.Command): volume_client.volume_types.delete(volume_type_id) -class ListVolumeType(lister.Lister): +class ListVolumeType(command.Lister): """List volume types""" - log = logging.getLogger(__name__ + '.ListVolumeType') - def get_parser(self, prog_name): parser = super(ListVolumeType, self).get_parser(prog_name) parser.add_argument( @@ -97,7 +85,6 @@ class ListVolumeType(lister.Lister): help='List additional fields in output') return parser - @utils.log_method(log) def take_action(self, parsed_args): if parsed_args.long: columns = ('ID', 'Name', 'Extra Specs') @@ -116,8 +103,6 @@ class ListVolumeType(lister.Lister): class SetVolumeType(command.Command): """Set volume type properties""" - log = logging.getLogger(__name__ + '.SetVolumeType') - def get_parser(self, prog_name): parser = super(SetVolumeType, self).get_parser(prog_name) parser.add_argument( @@ -134,7 +119,6 @@ class SetVolumeType(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume volume_type = utils.find_resource( @@ -147,8 +131,6 @@ class SetVolumeType(command.Command): class UnsetVolumeType(command.Command): """Unset volume type properties""" - log = logging.getLogger(__name__ + '.UnsetVolumeType') - def get_parser(self, prog_name): parser = super(UnsetVolumeType, self).get_parser(prog_name) parser.add_argument( @@ -167,7 +149,6 @@ class UnsetVolumeType(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume volume_type = utils.find_resource( @@ -181,11 +162,9 @@ class UnsetVolumeType(command.Command): self.app.log.error("No changes requested\n") -class ShowVolumeType(show.ShowOne): +class ShowVolumeType(command.ShowOne): """Display volume type details""" - log = logging.getLogger(__name__ + ".ShowVolumeType") - def get_parser(self, prog_name): parser = super(ShowVolumeType, self).get_parser(prog_name) parser.add_argument( @@ -196,7 +175,6 @@ class ShowVolumeType(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action: (%s)", parsed_args) volume_client = self.app.client_manager.volume volume_type = utils.find_resource( volume_client.volume_types, parsed_args.volume_type) diff --git a/openstackclient/volume/v2/backup.py b/openstackclient/volume/v2/backup.py index bc919d0bc5..64ca97ae8a 100644 --- a/openstackclient/volume/v2/backup.py +++ b/openstackclient/volume/v2/backup.py @@ -15,21 +15,16 @@ """Volume v2 Backup 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 utils -class CreateBackup(show.ShowOne): +class CreateBackup(command.ShowOne): """Create new backup""" - log = logging.getLogger(__name__ + ".CreateBackup") - def get_parser(self, prog_name): parser = super(CreateBackup, self).get_parser(prog_name) parser.add_argument( @@ -56,7 +51,6 @@ class CreateBackup(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action: (%s)", parsed_args) volume_client = self.app.client_manager.volume volume_id = utils.find_resource( volume_client.volumes, parsed_args.volume).id @@ -73,8 +67,6 @@ class CreateBackup(show.ShowOne): class DeleteBackup(command.Command): """Delete backup(s)""" - log = logging.getLogger(__name__ + ".DeleteBackup") - def get_parser(self, prog_name): parser = super(DeleteBackup, self).get_parser(prog_name) parser.add_argument( @@ -86,7 +78,6 @@ class DeleteBackup(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 backup in parsed_args.backups: backup_id = utils.find_resource( @@ -94,11 +85,9 @@ class DeleteBackup(command.Command): volume_client.backups.delete(backup_id) -class ListBackup(lister.Lister): +class ListBackup(command.Lister): """List backups""" - log = logging.getLogger(__name__ + ".ListBackup") - def get_parser(self, prog_name): parser = super(ListBackup, self).get_parser(prog_name) parser.add_argument( @@ -110,7 +99,6 @@ class ListBackup(lister.Lister): return parser def take_action(self, parsed_args): - self.log.debug("take_action: (%s)", parsed_args) def _format_volume_id(volume_id): """Return a volume name if available @@ -151,11 +139,9 @@ class ListBackup(lister.Lister): ) for s in data)) -class RestoreBackup(show.ShowOne): +class RestoreBackup(command.ShowOne): """Restore backup""" - log = logging.getLogger(__name__ + ".RestoreBackup") - def get_parser(self, prog_name): parser = super(RestoreBackup, self).get_parser(prog_name) parser.add_argument( @@ -171,7 +157,6 @@ class RestoreBackup(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action: (%s)", parsed_args) volume_client = self.app.client_manager.volume backup = utils.find_resource(volume_client.backups, parsed_args.backup) destination_volume = utils.find_resource(volume_client.volumes, @@ -179,11 +164,9 @@ class RestoreBackup(show.ShowOne): return volume_client.restores.restore(backup.id, destination_volume.id) -class ShowBackup(show.ShowOne): +class ShowBackup(command.ShowOne): """Display backup details""" - log = logging.getLogger(__name__ + ".ShowBackup") - def get_parser(self, prog_name): parser = super(ShowBackup, self).get_parser(prog_name) parser.add_argument( @@ -193,7 +176,6 @@ class ShowBackup(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action: (%s)", parsed_args) volume_client = self.app.client_manager.volume backup = utils.find_resource(volume_client.backups, parsed_args.backup) diff --git a/openstackclient/volume/v2/qos_specs.py b/openstackclient/volume/v2/qos_specs.py index 678fde4f3c..961cc27e5c 100644 --- a/openstackclient/volume/v2/qos_specs.py +++ b/openstackclient/volume/v2/qos_specs.py @@ -15,13 +15,9 @@ """Volume v2 QoS action implementations""" -import logging import six -from cliff import command -from cliff import lister -from cliff import show - +from openstackclient.common import command from openstackclient.common import parseractions from openstackclient.common import utils @@ -29,8 +25,6 @@ from openstackclient.common import utils class AssociateQos(command.Command): """Associate a QoS specification to a volume type""" - log = logging.getLogger(__name__ + '.AssociateQos') - def get_parser(self, prog_name): parser = super(AssociateQos, self).get_parser(prog_name) parser.add_argument( @@ -45,7 +39,6 @@ class AssociateQos(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume qos_spec = utils.find_resource(volume_client.qos_specs, @@ -56,11 +49,9 @@ class AssociateQos(command.Command): volume_client.qos_specs.associate(qos_spec.id, volume_type.id) -class CreateQos(show.ShowOne): +class CreateQos(command.ShowOne): """Create new QoS specification""" - log = logging.getLogger(__name__ + '.CreateQos') - def get_parser(self, prog_name): parser = super(CreateQos, self).get_parser(prog_name) parser.add_argument( @@ -86,7 +77,6 @@ class CreateQos(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume specs = {} @@ -103,8 +93,6 @@ class CreateQos(show.ShowOne): class DeleteQos(command.Command): """Delete QoS specification""" - log = logging.getLogger(__name__ + '.DeleteQos') - def get_parser(self, prog_name): parser = super(DeleteQos, self).get_parser(prog_name) parser.add_argument( @@ -115,7 +103,6 @@ class DeleteQos(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume for qos in parsed_args.qos_specs: @@ -126,8 +113,6 @@ class DeleteQos(command.Command): class DisassociateQos(command.Command): """Disassociate a QoS specification from a volume type""" - log = logging.getLogger(__name__ + '.DisassociateQos') - def get_parser(self, prog_name): parser = super(DisassociateQos, self).get_parser(prog_name) parser.add_argument( @@ -150,7 +135,6 @@ class DisassociateQos(command.Command): return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume qos_spec = utils.find_resource(volume_client.qos_specs, @@ -164,12 +148,9 @@ class DisassociateQos(command.Command): volume_client.qos_specs.disassociate_all(qos_spec.id) -class ListQos(lister.Lister): +class ListQos(command.Lister): """List QoS specifications""" - log = logging.getLogger(__name__ + '.ListQos') - - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume qos_specs_list = volume_client.qos_specs.list() @@ -195,8 +176,6 @@ class ListQos(lister.Lister): class SetQos(command.Command): """Set QoS specification properties""" - log = logging.getLogger(__name__ + '.SetQos') - def get_parser(self, prog_name): parser = super(SetQos, self).get_parser(prog_name) parser.add_argument( @@ -213,7 +192,6 @@ class SetQos(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume qos_spec = utils.find_resource(volume_client.qos_specs, @@ -226,11 +204,9 @@ class SetQos(command.Command): self.app.log.error("No changes requested\n") -class ShowQos(show.ShowOne): +class ShowQos(command.ShowOne): """Display QoS specification details""" - log = logging.getLogger(__name__ + '.ShowQos') - def get_parser(self, prog_name): parser = super(ShowQos, self).get_parser(prog_name) parser.add_argument( @@ -240,7 +216,6 @@ class ShowQos(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume qos_spec = utils.find_resource(volume_client.qos_specs, @@ -261,8 +236,6 @@ class ShowQos(show.ShowOne): class UnsetQos(command.Command): """Unset QoS specification properties""" - log = logging.getLogger(__name__ + '.SetQos') - def get_parser(self, prog_name): parser = super(UnsetQos, self).get_parser(prog_name) parser.add_argument( @@ -280,7 +253,6 @@ class UnsetQos(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume qos_spec = utils.find_resource(volume_client.qos_specs, diff --git a/openstackclient/volume/v2/snapshot.py b/openstackclient/volume/v2/snapshot.py index f939a553f3..4d00b72623 100644 --- a/openstackclient/volume/v2/snapshot.py +++ b/openstackclient/volume/v2/snapshot.py @@ -15,22 +15,17 @@ """Volume v2 snapshot 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 -class CreateSnapshot(show.ShowOne): +class CreateSnapshot(command.ShowOne): """Create new snapshot""" - log = logging.getLogger(__name__ + ".CreateSnapshot") - def get_parser(self, prog_name): parser = super(CreateSnapshot, self).get_parser(prog_name) parser.add_argument( @@ -59,7 +54,6 @@ class CreateSnapshot(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action: (%s)", parsed_args) volume_client = self.app.client_manager.volume volume_id = utils.find_resource( volume_client.volumes, parsed_args.volume).id @@ -78,8 +72,6 @@ class CreateSnapshot(show.ShowOne): class DeleteSnapshot(command.Command): """Delete volume snapshot(s)""" - log = logging.getLogger(__name__ + ".DeleteSnapshot") - def get_parser(self, prog_name): parser = super(DeleteSnapshot, self).get_parser(prog_name) parser.add_argument( @@ -91,7 +83,6 @@ class DeleteSnapshot(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 snapshot in parsed_args.snapshots: snapshot_id = utils.find_resource( @@ -99,11 +90,9 @@ class DeleteSnapshot(command.Command): volume_client.volume_snapshots.delete(snapshot_id) -class ListSnapshot(lister.Lister): +class ListSnapshot(command.Lister): """List snapshots""" - log = logging.getLogger(__name__ + ".ListSnapshot") - def get_parser(self, prog_name): parser = super(ListSnapshot, self).get_parser(prog_name) parser.add_argument( @@ -121,7 +110,6 @@ class ListSnapshot(lister.Lister): return parser def take_action(self, parsed_args): - self.log.debug("take_action: (%s)", parsed_args) def _format_volume_id(volume_id): """Return a volume name if available @@ -171,8 +159,6 @@ class ListSnapshot(lister.Lister): class SetSnapshot(command.Command): """Set snapshot properties""" - log = logging.getLogger(__name__ + '.SetSnapshot') - def get_parser(self, prog_name): parser = super(SetSnapshot, self).get_parser(prog_name) parser.add_argument( @@ -196,7 +182,6 @@ class SetSnapshot(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume snapshot = utils.find_resource(volume_client.volume_snapshots, @@ -218,11 +203,9 @@ class SetSnapshot(command.Command): volume_client.volume_snapshots.update(snapshot.id, **kwargs) -class ShowSnapshot(show.ShowOne): +class ShowSnapshot(command.ShowOne): """Display snapshot details""" - log = logging.getLogger(__name__ + ".ShowSnapshot") - def get_parser(self, prog_name): parser = super(ShowSnapshot, self).get_parser(prog_name) parser.add_argument( @@ -233,7 +216,6 @@ class ShowSnapshot(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action: (%s)", parsed_args) volume_client = self.app.client_manager.volume snapshot = utils.find_resource( volume_client.volume_snapshots, parsed_args.snapshot) @@ -246,8 +228,6 @@ class ShowSnapshot(show.ShowOne): class UnsetSnapshot(command.Command): """Unset snapshot properties""" - log = logging.getLogger(__name__ + '.UnsetSnapshot') - def get_parser(self, prog_name): parser = super(UnsetSnapshot, self).get_parser(prog_name) parser.add_argument( @@ -265,7 +245,6 @@ class UnsetSnapshot(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume snapshot = utils.find_resource( diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py index c636cf2fa1..436ec689dc 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( diff --git a/openstackclient/volume/v2/volume_type.py b/openstackclient/volume/v2/volume_type.py index 06ab8f82c3..d2b3ed6a61 100644 --- a/openstackclient/volume/v2/volume_type.py +++ b/openstackclient/volume/v2/volume_type.py @@ -14,22 +14,16 @@ """Volume v2 Type action implementations""" -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 -class CreateVolumeType(show.ShowOne): +class CreateVolumeType(command.ShowOne): """Create new volume type""" - log = logging.getLogger(__name__ + ".CreateVolumeType") - def get_parser(self, prog_name): parser = super(CreateVolumeType, self).get_parser(prog_name) parser.add_argument( @@ -66,7 +60,6 @@ class CreateVolumeType(show.ShowOne): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume @@ -93,8 +86,6 @@ class CreateVolumeType(show.ShowOne): class DeleteVolumeType(command.Command): """Delete volume type""" - log = logging.getLogger(__name__ + ".DeleteVolumeType") - def get_parser(self, prog_name): parser = super(DeleteVolumeType, self).get_parser(prog_name) parser.add_argument( @@ -105,18 +96,15 @@ class DeleteVolumeType(command.Command): return parser def take_action(self, parsed_args): - self.log.info("take_action: (%s)", parsed_args) volume_client = self.app.client_manager.volume volume_type = utils.find_resource( volume_client.volume_types, parsed_args.volume_type) volume_client.volume_types.delete(volume_type.id) -class ListVolumeType(lister.Lister): +class ListVolumeType(command.Lister): """List volume types""" - log = logging.getLogger(__name__ + '.ListVolumeType') - def get_parser(self, prog_name): parser = super(ListVolumeType, self).get_parser(prog_name) parser.add_argument( @@ -126,7 +114,6 @@ class ListVolumeType(lister.Lister): help='List additional fields in output') return parser - @utils.log_method(log) def take_action(self, parsed_args): if parsed_args.long: columns = ['ID', 'Name', 'Description', 'Extra Specs'] @@ -145,8 +132,6 @@ class ListVolumeType(lister.Lister): class SetVolumeType(command.Command): """Set volume type properties""" - log = logging.getLogger(__name__ + '.SetVolumeType') - def get_parser(self, prog_name): parser = super(SetVolumeType, self).get_parser(prog_name) parser.add_argument( @@ -173,7 +158,6 @@ class SetVolumeType(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume volume_type = utils.find_resource( @@ -201,11 +185,9 @@ class SetVolumeType(command.Command): volume_type.set_keys(parsed_args.property) -class ShowVolumeType(show.ShowOne): +class ShowVolumeType(command.ShowOne): """Display volume type details""" - log = logging.getLogger(__name__ + ".ShowVolumeType") - def get_parser(self, prog_name): parser = super(ShowVolumeType, self).get_parser(prog_name) parser.add_argument( @@ -216,7 +198,6 @@ class ShowVolumeType(show.ShowOne): return parser def take_action(self, parsed_args): - self.log.debug("take_action: (%s)", parsed_args) volume_client = self.app.client_manager.volume volume_type = utils.find_resource( volume_client.volume_types, parsed_args.volume_type) @@ -228,8 +209,6 @@ class ShowVolumeType(show.ShowOne): class UnsetVolumeType(command.Command): """Unset volume type properties""" - log = logging.getLogger(__name__ + '.UnsetVolumeType') - def get_parser(self, prog_name): parser = super(UnsetVolumeType, self).get_parser(prog_name) parser.add_argument( @@ -247,7 +226,6 @@ class UnsetVolumeType(command.Command): ) return parser - @utils.log_method(log) def take_action(self, parsed_args): volume_client = self.app.client_manager.volume volume_type = utils.find_resource(