Use a common decorator to log 'take_action' activation

Instead of duplicating the same log statement throughout
the code, the same logic can be provided by a shared decorator
that abstracts away the logging capability and unifies it behind
a common function instead.

Change-Id: Icc63bced7347c8bbf0299a4c5821425a10892a79
This commit is contained in:
Joshua Harlow 2015-09-01 16:43:07 -07:00
parent f14251669f
commit e3c46ece4a
50 changed files with 242 additions and 212 deletions

View File

@ -18,6 +18,8 @@ import logging
from cliff import show from cliff import show
import six import six
from openstackclient.common import utils
REDACTED = "<redacted>" REDACTED = "<redacted>"
@ -44,8 +46,8 @@ class ShowConfiguration(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
info = self.app.client_manager.get_configuration() info = self.app.client_manager.get_configuration()
for key, value in six.iteritems(info.pop('auth', {})): for key, value in six.iteritems(info.pop('auth', {})):

View File

@ -64,8 +64,8 @@ class ShowLimits(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume

View File

@ -22,6 +22,8 @@ import sys
from cliff import lister from cliff import lister
from cliff import show from cliff import show
from openstackclient.common import utils
class ListCommand(lister.Lister): class ListCommand(lister.Lister):
"""List recognized commands by group""" """List recognized commands by group"""
@ -29,8 +31,8 @@ class ListCommand(lister.Lister):
auth_required = False auth_required = False
log = logging.getLogger(__name__ + '.ListCommand') log = logging.getLogger(__name__ + '.ListCommand')
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
cm = self.app.command_manager cm = self.app.command_manager
groups = cm.get_command_groups() groups = cm.get_command_groups()
@ -54,8 +56,8 @@ class ListModule(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
data = {} data = {}
# Get module versions # Get module versions

View File

@ -23,6 +23,8 @@ import sys
from cliff import command from cliff import command
from cliff import show from cliff import show
from openstackclient.common import utils
# List the quota items, map the internal argument name to the option # List the quota items, map the internal argument name to the option
# name that the user sees. # name that the user sees.
@ -89,8 +91,8 @@ class SetQuota(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
@ -188,8 +190,8 @@ class ShowQuota(show.ShowOne):
else: else:
return {} return {}
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume

View File

@ -26,6 +26,29 @@ from oslo_utils import importutils
from openstackclient.common import exceptions from openstackclient.common import exceptions
def log_method(log, level=logging.DEBUG):
"""Logs a method and its arguments when entered."""
def decorator(func):
func_name = func.__name__
@six.wraps(func)
def wrapper(self, *args, **kwargs):
if log.isEnabledFor(level):
pretty_args = []
if args:
pretty_args.extend(str(a) for a in args)
if kwargs:
pretty_args.extend(
"%s=%s" % (k, v) for k, v in six.iteritems(kwargs))
log.log(level, "%s(%s)", func_name, ", ".join(pretty_args))
return func(self, *args, **kwargs)
return wrapper
return decorator
def find_resource(manager, name_or_id, **kwargs): def find_resource(manager, name_or_id, **kwargs):
"""Helper for the _find_* methods. """Helper for the _find_* methods.

View File

@ -123,8 +123,8 @@ class DeleteAggregate(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
data = utils.find_resource( data = utils.find_resource(
@ -256,8 +256,8 @@ class SetAggregate(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
aggregate = utils.find_resource( aggregate = utils.find_resource(
@ -303,8 +303,8 @@ class ShowAggregate(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
data = utils.find_resource( data = utils.find_resource(

View File

@ -73,8 +73,8 @@ class ListAvailabilityZone(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
if parsed_args.long: if parsed_args.long:
columns = ('Zone Name', 'Zone Status', columns = ('Zone Name', 'Zone Status',

View File

@ -47,8 +47,8 @@ class ShowConsoleLog(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
server = utils.find_resource( server = utils.find_resource(
@ -103,8 +103,8 @@ class ShowConsoleURL(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
server = utils.find_resource( server = utils.find_resource(
compute_client.servers, compute_client.servers,

View File

@ -69,8 +69,8 @@ class CreateFloatingIP(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
floating_ip = compute_client.floating_ips.create(parsed_args.pool) floating_ip = compute_client.floating_ips.create(parsed_args.pool)
@ -93,8 +93,8 @@ class DeleteFloatingIP(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
floating_ip = utils.find_resource( floating_ip = utils.find_resource(
@ -111,8 +111,8 @@ class ListFloatingIP(lister.Lister):
log = logging.getLogger(__name__ + '.ListFloatingIP') log = logging.getLogger(__name__ + '.ListFloatingIP')
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
columns = ('ID', 'Pool', 'IP', 'Fixed IP', 'Instance ID') columns = ('ID', 'Pool', 'IP', 'Fixed IP', 'Instance ID')

View File

@ -27,8 +27,8 @@ class ListFloatingIPPool(lister.Lister):
log = logging.getLogger(__name__ + '.ListFloatingIPPool') log = logging.getLogger(__name__ + '.ListFloatingIPPool')
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
columns = ('Name',) columns = ('Name',)

View File

@ -47,8 +47,8 @@ class CreateKeypair(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
public_key = parsed_args.public_key public_key = parsed_args.public_key
@ -93,8 +93,8 @@ class DeleteKeypair(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
compute_client.keypairs.delete(parsed_args.name) compute_client.keypairs.delete(parsed_args.name)
return return
@ -140,8 +140,8 @@ class ShowKeypair(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
keypair = utils.find_resource(compute_client.keypairs, keypair = utils.find_resource(compute_client.keypairs,
parsed_args.name) parsed_args.name)

View File

@ -107,8 +107,8 @@ class DeleteSecurityGroup(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
data = utils.find_resource( data = utils.find_resource(
@ -199,8 +199,8 @@ class SetSecurityGroup(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
data = utils.find_resource( data = utils.find_resource(
@ -240,8 +240,8 @@ class ShowSecurityGroup(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
info = {} info = {}
@ -334,8 +334,8 @@ class DeleteSecurityGroupRule(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
compute_client.security_group_rules.delete(parsed_args.rule) compute_client.security_group_rules.delete(parsed_args.rule)

View File

@ -355,8 +355,8 @@ class CreateServer(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
@ -553,8 +553,8 @@ class CreateServerImage(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
image_client = self.app.client_manager.image image_client = self.app.client_manager.image
server = utils.find_resource( server = utils.find_resource(
@ -612,8 +612,8 @@ class DeleteServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
for server in parsed_args.servers: for server in parsed_args.servers:
server_obj = utils.find_resource( server_obj = utils.find_resource(
@ -701,8 +701,8 @@ class ListServer(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
search_opts = { search_opts = {
'reservation_id': parsed_args.reservation_id, 'reservation_id': parsed_args.reservation_id,
@ -772,8 +772,8 @@ class LockServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
utils.find_resource( utils.find_resource(
@ -845,8 +845,8 @@ class MigrateServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
@ -889,8 +889,8 @@ class PauseServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
utils.find_resource( utils.find_resource(
@ -935,8 +935,8 @@ class RebootServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
server = utils.find_resource( server = utils.find_resource(
compute_client.servers, parsed_args.server) compute_client.servers, parsed_args.server)
@ -984,8 +984,8 @@ class RebuildServer(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
# Lookup parsed_args.image # Lookup parsed_args.image
@ -1100,8 +1100,8 @@ class RescueServer(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
_, body = utils.find_resource( _, body = utils.find_resource(
@ -1146,8 +1146,8 @@ class ResizeServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
server = utils.find_resource( server = utils.find_resource(
@ -1191,8 +1191,8 @@ class ResumeServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
utils.find_resource( utils.find_resource(
@ -1232,8 +1232,8 @@ class SetServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
server = utils.find_resource( server = utils.find_resource(
@ -1280,8 +1280,8 @@ class ShowServer(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
server = utils.find_resource(compute_client.servers, server = utils.find_resource(compute_client.servers,
parsed_args.server) parsed_args.server)
@ -1403,8 +1403,8 @@ class SshServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
server = utils.find_resource( server = utils.find_resource(
@ -1458,8 +1458,8 @@ class SuspendServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
utils.find_resource( utils.find_resource(
@ -1482,8 +1482,8 @@ class UnlockServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
utils.find_resource( utils.find_resource(
@ -1506,8 +1506,8 @@ class UnpauseServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
utils.find_resource( utils.find_resource(
@ -1530,8 +1530,8 @@ class UnrescueServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
utils.find_resource( utils.find_resource(
@ -1562,8 +1562,8 @@ class UnsetServer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
server = utils.find_resource( server = utils.find_resource(
compute_client.servers, compute_client.servers,

View File

@ -42,8 +42,8 @@ class ListCatalog(lister.Lister):
log = logging.getLogger(__name__ + '.ListCatalog') log = logging.getLogger(__name__ + '.ListCatalog')
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
# This is ugly because if auth hasn't happened yet we need # This is ugly because if auth hasn't happened yet we need
# to trigger it here. # to trigger it here.
@ -76,8 +76,8 @@ class ShowCatalog(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
# This is ugly because if auth hasn't happened yet we need # This is ugly because if auth hasn't happened yet we need
# to trigger it here. # to trigger it here.

View File

@ -52,8 +52,8 @@ class CreateEC2Creds(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if parsed_args.project: if parsed_args.project:
@ -105,8 +105,8 @@ class DeleteEC2Creds(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if parsed_args.user: if parsed_args.user:
@ -135,8 +135,8 @@ class ListEC2Creds(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if parsed_args.user: if parsed_args.user:
@ -178,8 +178,8 @@ class ShowEC2Creds(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if parsed_args.user: if parsed_args.user:

View File

@ -62,8 +62,8 @@ class CreateEndpoint(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
service = common.find_service(identity_client, parsed_args.service) service = common.find_service(identity_client, parsed_args.service)
endpoint = identity_client.endpoints.create( endpoint = identity_client.endpoints.create(
@ -93,8 +93,8 @@ class DeleteEndpoint(command.Command):
help=_('Endpoint ID to delete')) help=_('Endpoint ID to delete'))
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
identity_client.endpoints.delete(parsed_args.endpoint) identity_client.endpoints.delete(parsed_args.endpoint)
return return
@ -115,8 +115,8 @@ class ListEndpoint(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if parsed_args.long: if parsed_args.long:
columns = ('ID', 'Region', 'Service Name', 'Service Type', columns = ('ID', 'Region', 'Service Name', 'Service Type',
@ -150,8 +150,8 @@ class ShowEndpoint(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
data = identity_client.endpoints.list() data = identity_client.endpoints.list()
match = None match = None

View File

@ -70,8 +70,8 @@ class CreateProject(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
enabled = True enabled = True
@ -118,8 +118,8 @@ class DeleteProject(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
for project in parsed_args.projects: for project in parsed_args.projects:
@ -146,8 +146,8 @@ class ListProject(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
if parsed_args.long: if parsed_args.long:
columns = ('ID', 'Name', 'Description', 'Enabled') columns = ('ID', 'Name', 'Description', 'Enabled')
else: else:
@ -202,8 +202,8 @@ class SetProject(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if (not parsed_args.name if (not parsed_args.name
@ -253,8 +253,8 @@ class ShowProject(show.ShowOne):
help=_('Project to display (name or ID)')) help=_('Project to display (name or ID)'))
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
info = {} info = {}

View File

@ -54,8 +54,8 @@ class AddRole(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
role = utils.find_resource(identity_client.roles, parsed_args.role) role = utils.find_resource(identity_client.roles, parsed_args.role)
project = utils.find_resource( project = utils.find_resource(
@ -93,8 +93,8 @@ class CreateRole(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
try: try:
role = identity_client.roles.create(parsed_args.role_name) role = identity_client.roles.create(parsed_args.role_name)
@ -128,8 +128,8 @@ class DeleteRole(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
for role in parsed_args.roles: for role in parsed_args.roles:
@ -160,8 +160,8 @@ class ListRole(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
auth_ref = self.app.client_manager.auth_ref auth_ref = self.app.client_manager.auth_ref
@ -242,8 +242,8 @@ class ListUserRole(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
auth_ref = self.app.client_manager.auth_ref auth_ref = self.app.client_manager.auth_ref
@ -316,8 +316,8 @@ class RemoveRole(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
role = utils.find_resource(identity_client.roles, parsed_args.role) role = utils.find_resource(identity_client.roles, parsed_args.role)
project = utils.find_resource( project = utils.find_resource(
@ -345,8 +345,8 @@ class ShowRole(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
role = utils.find_resource(identity_client.roles, parsed_args.role) role = utils.find_resource(identity_client.roles, parsed_args.role)

View File

@ -59,8 +59,8 @@ class CreateService(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
type_or_name = parsed_args.type_or_name type_or_name = parsed_args.type_or_name
@ -106,8 +106,8 @@ class DeleteService(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
service = common.find_service(identity_client, parsed_args.service) service = common.find_service(identity_client, parsed_args.service)
identity_client.services.delete(service.id) identity_client.services.delete(service.id)
@ -129,8 +129,8 @@ class ListService(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
if parsed_args.long: if parsed_args.long:
columns = ('ID', 'Name', 'Type', 'Description') columns = ('ID', 'Name', 'Type', 'Description')
@ -163,8 +163,8 @@ class ShowService(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
auth_ref = self.app.client_manager.auth_ref auth_ref = self.app.client_manager.auth_ref

View File

@ -21,6 +21,7 @@ import six
from cliff import command from cliff import command
from cliff import show from cliff import show
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa from openstackclient.i18n import _ # noqa
@ -33,8 +34,8 @@ class IssueToken(show.ShowOne):
parser = super(IssueToken, self).get_parser(prog_name) parser = super(IssueToken, self).get_parser(prog_name)
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
token = self.app.client_manager.auth_ref.service_catalog.get_token() token = self.app.client_manager.auth_ref.service_catalog.get_token()
token['project_id'] = token.pop('tenant_id') token['project_id'] = token.pop('tenant_id')

View File

@ -78,8 +78,8 @@ class CreateUser(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if parsed_args.project: if parsed_args.project:
@ -142,8 +142,8 @@ class DeleteUser(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
for user in parsed_args.users: for user in parsed_args.users:
@ -174,8 +174,8 @@ class ListUser(lister.Lister):
help=_('List additional fields in output')) help=_('List additional fields in output'))
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
def _format_project(project): def _format_project(project):
@ -296,8 +296,8 @@ class SetUser(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if parsed_args.password_prompt: if parsed_args.password_prompt:
@ -362,8 +362,8 @@ class ShowUser(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
info = {} info = {}

View File

@ -39,8 +39,8 @@ class ListCatalog(lister.Lister):
log = logging.getLogger(__name__ + '.ListCatalog') log = logging.getLogger(__name__ + '.ListCatalog')
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
# This is ugly because if auth hasn't happened yet we need # This is ugly because if auth hasn't happened yet we need
# to trigger it here. # to trigger it here.
@ -73,8 +73,8 @@ class ShowCatalog(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
# This is ugly because if auth hasn't happened yet we need # This is ugly because if auth hasn't happened yet we need
# to trigger it here. # to trigger it here.

View File

@ -40,8 +40,8 @@ class CreateConsumer(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
consumer = identity_client.oauth1.consumers.create( consumer = identity_client.oauth1.consumers.create(
parsed_args.description parsed_args.description
@ -64,8 +64,8 @@ class DeleteConsumer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
consumer = utils.find_resource( consumer = utils.find_resource(
identity_client.oauth1.consumers, parsed_args.consumer) identity_client.oauth1.consumers, parsed_args.consumer)
@ -78,8 +78,8 @@ class ListConsumer(lister.Lister):
log = logging.getLogger(__name__ + '.ListConsumer') log = logging.getLogger(__name__ + '.ListConsumer')
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
columns = ('ID', 'Description') columns = ('ID', 'Description')
data = self.app.client_manager.identity.oauth1.consumers.list() data = self.app.client_manager.identity.oauth1.consumers.list()
return (columns, return (columns,
@ -108,8 +108,8 @@ class SetConsumer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
consumer = utils.find_resource( consumer = utils.find_resource(
identity_client.oauth1.consumers, parsed_args.consumer) identity_client.oauth1.consumers, parsed_args.consumer)
@ -140,8 +140,8 @@ class ShowConsumer(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
consumer = utils.find_resource( consumer = utils.find_resource(
identity_client.oauth1.consumers, parsed_args.consumer) identity_client.oauth1.consumers, parsed_args.consumer)

View File

@ -57,8 +57,8 @@ class CreateCredential(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
user_id = utils.find_resource(identity_client.users, user_id = utils.find_resource(identity_client.users,
parsed_args.user).id parsed_args.user).id
@ -91,8 +91,8 @@ class DeleteCredential(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
identity_client.credentials.delete(parsed_args.credential) identity_client.credentials.delete(parsed_args.credential)
return return
@ -103,8 +103,8 @@ class ListCredential(lister.Lister):
log = logging.getLogger(__name__ + '.ListCredential') log = logging.getLogger(__name__ + '.ListCredential')
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
columns = ('ID', 'Type', 'User ID', 'Blob', 'Project ID') columns = ('ID', 'Type', 'User ID', 'Blob', 'Project ID')
column_headers = ('ID', 'Type', 'User ID', 'Data', 'Project ID') column_headers = ('ID', 'Type', 'User ID', 'Data', 'Project ID')
data = self.app.client_manager.identity.credentials.list() data = self.app.client_manager.identity.credentials.list()
@ -150,8 +150,8 @@ class SetCredential(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
kwargs = {} kwargs = {}
if parsed_args.user: if parsed_args.user:
@ -189,8 +189,8 @@ class ShowCredential(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
credential = utils.find_resource(identity_client.credentials, credential = utils.find_resource(identity_client.credentials,
parsed_args.credential) parsed_args.credential)

View File

@ -63,8 +63,8 @@ class CreateDomain(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
enabled = True enabled = True
@ -103,8 +103,8 @@ class DeleteDomain(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
domain = utils.find_resource(identity_client.domains, domain = utils.find_resource(identity_client.domains,
parsed_args.domain) parsed_args.domain)
@ -117,8 +117,8 @@ class ListDomain(lister.Lister):
log = logging.getLogger(__name__ + '.ListDomain') log = logging.getLogger(__name__ + '.ListDomain')
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
columns = ('ID', 'Name', 'Enabled', 'Description') columns = ('ID', 'Name', 'Enabled', 'Description')
data = self.app.client_manager.identity.domains.list() data = self.app.client_manager.identity.domains.list()
return (columns, return (columns,
@ -163,8 +163,8 @@ class SetDomain(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
domain = utils.find_resource(identity_client.domains, domain = utils.find_resource(identity_client.domains,
parsed_args.domain) parsed_args.domain)
@ -200,8 +200,8 @@ class ShowDomain(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
domain = utils.find_resource(identity_client.domains, domain = utils.find_resource(identity_client.domains,
parsed_args.domain) parsed_args.domain)

View File

@ -79,8 +79,8 @@ class CreateEC2Creds(show.ShowOne):
common.add_project_domain_option_to_parser(parser) common.add_project_domain_option_to_parser(parser)
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
client_manager = self.app.client_manager client_manager = self.app.client_manager
user = _determine_ec2_user(parsed_args, client_manager) user = _determine_ec2_user(parsed_args, client_manager)
@ -136,8 +136,8 @@ class DeleteEC2Creds(command.Command):
common.add_user_domain_option_to_parser(parser) common.add_user_domain_option_to_parser(parser)
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
client_manager = self.app.client_manager client_manager = self.app.client_manager
user = _determine_ec2_user(parsed_args, client_manager) user = _determine_ec2_user(parsed_args, client_manager)
client_manager.identity.ec2.delete(user, parsed_args.access_key) client_manager.identity.ec2.delete(user, parsed_args.access_key)
@ -158,8 +158,8 @@ class ListEC2Creds(lister.Lister):
common.add_user_domain_option_to_parser(parser) common.add_user_domain_option_to_parser(parser)
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
client_manager = self.app.client_manager client_manager = self.app.client_manager
user = _determine_ec2_user(parsed_args, client_manager) user = _determine_ec2_user(parsed_args, client_manager)
@ -194,8 +194,8 @@ class ShowEC2Creds(show.ShowOne):
common.add_user_domain_option_to_parser(parser) common.add_user_domain_option_to_parser(parser)
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
client_manager = self.app.client_manager client_manager = self.app.client_manager
user = _determine_ec2_user(parsed_args, client_manager) user = _determine_ec2_user(parsed_args, client_manager)
creds = client_manager.identity.ec2.get(user, parsed_args.access_key) creds = client_manager.identity.ec2.get(user, parsed_args.access_key)

View File

@ -78,8 +78,8 @@ class CreateEndpoint(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
service = common.find_service(identity_client, parsed_args.service) service = common.find_service(identity_client, parsed_args.service)
@ -113,8 +113,8 @@ class DeleteEndpoint(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
endpoint_id = utils.find_resource(identity_client.endpoints, endpoint_id = utils.find_resource(identity_client.endpoints,
parsed_args.endpoint).id parsed_args.endpoint).id
@ -147,8 +147,8 @@ class ListEndpoint(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
columns = ('ID', 'Region', 'Service Name', 'Service Type', columns = ('ID', 'Region', 'Service Name', 'Service Type',
'Enabled', 'Interface', 'URL') 'Enabled', 'Interface', 'URL')
@ -221,8 +221,8 @@ class SetEndpoint(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
endpoint = utils.find_resource(identity_client.endpoints, endpoint = utils.find_resource(identity_client.endpoints,
parsed_args.endpoint) parsed_args.endpoint)
@ -270,8 +270,8 @@ class ShowEndpoint(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
endpoint = utils.find_resource(identity_client.endpoints, endpoint = utils.find_resource(identity_client.endpoints,
parsed_args.endpoint) parsed_args.endpoint)

View File

@ -50,8 +50,8 @@ class CreateProtocol(show.ShowOne):
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
protocol = identity_client.federation.protocols.create( protocol = identity_client.federation.protocols.create(
protocol_id=parsed_args.federation_protocol, protocol_id=parsed_args.federation_protocol,
@ -88,8 +88,8 @@ class DeleteProtocol(command.Command):
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
identity_client.federation.protocols.delete( identity_client.federation.protocols.delete(
parsed_args.identity_provider, parsed_args.federation_protocol) parsed_args.identity_provider, parsed_args.federation_protocol)

View File

@ -50,8 +50,8 @@ class AddUserToGroup(command.Command):
common.add_user_domain_option_to_parser(parser) common.add_user_domain_option_to_parser(parser)
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
user_id = common.find_user(identity_client, user_id = common.find_user(identity_client,
@ -92,8 +92,8 @@ class CheckUserInGroup(command.Command):
common.add_user_domain_option_to_parser(parser) common.add_user_domain_option_to_parser(parser)
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
user_id = common.find_user(identity_client, user_id = common.find_user(identity_client,
@ -142,8 +142,8 @@ class CreateGroup(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
domain = None domain = None
@ -188,8 +188,8 @@ class DeleteGroup(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
for group in parsed_args.groups: for group in parsed_args.groups:
@ -226,8 +226,8 @@ class ListGroup(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
domain = None domain = None
@ -284,8 +284,8 @@ class RemoveUserFromGroup(command.Command):
common.add_user_domain_option_to_parser(parser) common.add_user_domain_option_to_parser(parser)
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
user_id = common.find_user(identity_client, user_id = common.find_user(identity_client,
@ -331,8 +331,8 @@ class SetGroup(command.Command):
help='New group description') help='New group description')
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
group = common.find_group(identity_client, parsed_args.group, group = common.find_group(identity_client, parsed_args.group,
parsed_args.domain) parsed_args.domain)
@ -368,8 +368,8 @@ class ShowGroup(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
group = common.find_group(identity_client, group = common.find_group(identity_client,

View File

@ -70,8 +70,8 @@ class CreateIdentityProvider(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if parsed_args.remote_id_file: if parsed_args.remote_id_file:
file_content = utils.read_blob_file_contents( file_content = utils.read_blob_file_contents(
@ -105,8 +105,8 @@ class DeleteIdentityProvider(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
identity_client.federation.identity_providers.delete( identity_client.federation.identity_providers.delete(
parsed_args.identity_provider) parsed_args.identity_provider)
@ -118,8 +118,8 @@ class ListIdentityProvider(lister.Lister):
log = logging.getLogger(__name__ + '.ListIdentityProvider') log = logging.getLogger(__name__ + '.ListIdentityProvider')
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
columns = ('ID', 'Enabled', 'Description') columns = ('ID', 'Enabled', 'Description')
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
data = identity_client.federation.identity_providers.list() data = identity_client.federation.identity_providers.list()
@ -169,8 +169,8 @@ class SetIdentityProvider(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
federation_client = self.app.client_manager.identity.federation federation_client = self.app.client_manager.identity.federation
# Basic argument checking # Basic argument checking
@ -218,8 +218,8 @@ class ShowIdentityProvider(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
identity_provider = utils.find_resource( identity_provider = utils.find_resource(
identity_client.federation.identity_providers, identity_client.federation.identity_providers,

View File

@ -47,8 +47,8 @@ class CreatePolicy(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
blob = utils.read_blob_file_contents(parsed_args.rules) blob = utils.read_blob_file_contents(parsed_args.rules)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
@ -75,8 +75,8 @@ class DeletePolicy(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
identity_client.policies.delete(parsed_args.policy) identity_client.policies.delete(parsed_args.policy)
return return
@ -97,8 +97,8 @@ class ListPolicy(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
if parsed_args.long: if parsed_args.long:
columns = ('ID', 'Type', 'Blob') columns = ('ID', 'Type', 'Blob')
column_headers = ('ID', 'Type', 'Rules') column_headers = ('ID', 'Type', 'Rules')
@ -137,8 +137,8 @@ class SetPolicy(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
blob = None blob = None
@ -172,8 +172,8 @@ class ShowPolicy(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
policy = utils.find_resource(identity_client.policies, policy = utils.find_resource(identity_client.policies,
parsed_args.policy) parsed_args.policy)

View File

@ -81,8 +81,8 @@ class CreateProject(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
domain = None domain = None
@ -146,8 +146,8 @@ class DeleteProject(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
domain = None domain = None
@ -190,8 +190,8 @@ class ListProject(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if parsed_args.long: if parsed_args.long:
columns = ('ID', 'Name', 'Domain ID', 'Description', 'Enabled') columns = ('ID', 'Name', 'Domain ID', 'Description', 'Enabled')
@ -271,8 +271,8 @@ class SetProject(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if (not parsed_args.name if (not parsed_args.name
@ -337,8 +337,8 @@ class ShowProject(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if parsed_args.domain: if parsed_args.domain:

View File

@ -56,8 +56,8 @@ class CreateRegion(show.ShowOne):
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
region = identity_client.regions.create( region = identity_client.regions.create(
@ -87,8 +87,8 @@ class DeleteRegion(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
identity_client.regions.delete(parsed_args.region) identity_client.regions.delete(parsed_args.region)
@ -109,8 +109,8 @@ class ListRegion(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
kwargs = {} kwargs = {}
@ -157,8 +157,8 @@ class SetRegion(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if (not parsed_args.url if (not parsed_args.url
@ -192,8 +192,8 @@ class ShowRegion(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
region = utils.find_resource(identity_client.regions, region = utils.find_resource(identity_client.regions,

View File

@ -122,8 +122,8 @@ class AddRole(command.Command):
_add_identity_and_resource_options_to_parser(parser) _add_identity_and_resource_options_to_parser(parser)
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if (not parsed_args.user and not parsed_args.domain if (not parsed_args.user and not parsed_args.domain
@ -166,8 +166,8 @@ class CreateRole(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
try: try:
@ -199,8 +199,8 @@ class DeleteRole(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
for role in parsed_args.roles: for role in parsed_args.roles:
@ -325,8 +325,8 @@ class RemoveRole(command.Command):
_add_identity_and_resource_options_to_parser(parser) _add_identity_and_resource_options_to_parser(parser)
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if (not parsed_args.user and not parsed_args.domain if (not parsed_args.user and not parsed_args.domain
@ -368,8 +368,8 @@ class SetRole(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if not parsed_args.name: if not parsed_args.name:
@ -398,8 +398,8 @@ class ShowRole(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
role = utils.find_resource( role = utils.find_resource(

View File

@ -61,8 +61,8 @@ class CreateService(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
enabled = True enabled = True
@ -94,8 +94,8 @@ class DeleteService(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
service = common.find_service(identity_client, parsed_args.service) service = common.find_service(identity_client, parsed_args.service)
@ -119,8 +119,8 @@ class ListService(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
if parsed_args.long: if parsed_args.long:
columns = ('ID', 'Name', 'Type', 'Description', 'Enabled') columns = ('ID', 'Name', 'Type', 'Description', 'Enabled')
@ -173,8 +173,8 @@ class SetService(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if (not parsed_args.name if (not parsed_args.name
@ -219,8 +219,8 @@ class ShowService(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
service = common.find_service(identity_client, parsed_args.service) service = common.find_service(identity_client, parsed_args.service)

View File

@ -73,8 +73,8 @@ class CreateServiceProvider(show.ShowOne):
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
service_client = self.app.client_manager.identity service_client = self.app.client_manager.identity
sp = service_client.federation.service_providers.create( sp = service_client.federation.service_providers.create(
id=parsed_args.service_provider_id, id=parsed_args.service_provider_id,
@ -101,8 +101,8 @@ class DeleteServiceProvider(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
service_client = self.app.client_manager.identity service_client = self.app.client_manager.identity
service_client.federation.service_providers.delete( service_client.federation.service_providers.delete(
parsed_args.service_provider) parsed_args.service_provider)
@ -114,8 +114,8 @@ class ListServiceProvider(lister.Lister):
log = logging.getLogger(__name__ + '.ListServiceProvider') log = logging.getLogger(__name__ + '.ListServiceProvider')
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
service_client = self.app.client_manager.identity service_client = self.app.client_manager.identity
data = service_client.federation.service_providers.list() data = service_client.federation.service_providers.list()
@ -168,8 +168,8 @@ class SetServiceProvider(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
federation_client = self.app.client_manager.identity.federation federation_client = self.app.client_manager.identity.federation
enabled = None enabled = None
@ -207,8 +207,8 @@ class ShowServiceProvider(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
service_client = self.app.client_manager.identity service_client = self.app.client_manager.identity
service_provider = utils.find_resource( service_provider = utils.find_resource(
service_client.federation.service_providers, service_client.federation.service_providers,

View File

@ -182,8 +182,8 @@ class IssueToken(show.ShowOne):
parser = super(IssueToken, self).get_parser(prog_name) parser = super(IssueToken, self).get_parser(prog_name)
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
token = self.app.client_manager.auth_ref.service_catalog.get_token() token = self.app.client_manager.auth_ref.service_catalog.get_token()
if 'tenant_id' in token: if 'tenant_id' in token:
token['project_id'] = token.pop('tenant_id') token['project_id'] = token.pop('tenant_id')

View File

@ -49,8 +49,8 @@ class ListAccessibleDomains(lister.Lister):
log = logging.getLogger(__name__ + '.ListAccessibleDomains') log = logging.getLogger(__name__ + '.ListAccessibleDomains')
@auth_with_unscoped_saml @auth_with_unscoped_saml
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
columns = ('ID', 'Enabled', 'Name', 'Description') columns = ('ID', 'Enabled', 'Name', 'Description')
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
data = identity_client.federation.domains.list() data = identity_client.federation.domains.list()
@ -67,8 +67,8 @@ class ListAccessibleProjects(lister.Lister):
log = logging.getLogger(__name__ + '.ListAccessibleProjects') log = logging.getLogger(__name__ + '.ListAccessibleProjects')
@auth_with_unscoped_saml @auth_with_unscoped_saml
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
columns = ('ID', 'Domain ID', 'Enabled', 'Name') columns = ('ID', 'Domain ID', 'Enabled', 'Name')
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
data = identity_client.federation.projects.list() data = identity_client.federation.projects.list()

View File

@ -91,8 +91,8 @@ class CreateUser(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
project_id = None project_id = None
@ -155,8 +155,8 @@ class DeleteUser(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
domain = None domain = None
@ -205,8 +205,8 @@ class ListUser(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
domain = None domain = None
@ -336,8 +336,8 @@ class SetUser(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if parsed_args.password_prompt: if parsed_args.password_prompt:
@ -396,8 +396,8 @@ class SetPasswordUser(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
current_password = utils.get_password( current_password = utils.get_password(
@ -430,8 +430,8 @@ class ShowUser(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
if parsed_args.domain: if parsed_args.domain:

View File

@ -41,8 +41,8 @@ class CreateContainer(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
results = [] results = []
for container in parsed_args.containers: for container in parsed_args.containers:
@ -74,8 +74,8 @@ class DeleteContainer(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
for container in parsed_args.containers: for container in parsed_args.containers:
self.app.client_manager.object_store.container_delete( self.app.client_manager.object_store.container_delete(
@ -125,8 +125,8 @@ class ListContainer(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
if parsed_args.long: if parsed_args.long:
columns = ('Name', 'Bytes', 'Count') columns = ('Name', 'Bytes', 'Count')
@ -192,8 +192,8 @@ class ShowContainer(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
data = self.app.client_manager.object_store.container_show( data = self.app.client_manager.object_store.container_show(
container=parsed_args.container, container=parsed_args.container,

View File

@ -46,8 +46,8 @@ class CreateObject(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
results = [] results = []
for obj in parsed_args.objects: for obj in parsed_args.objects:
@ -85,8 +85,8 @@ class DeleteObject(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
for obj in parsed_args.objects: for obj in parsed_args.objects:
self.app.client_manager.object_store.object_delete( self.app.client_manager.object_store.object_delete(
@ -147,8 +147,8 @@ class ListObject(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
if parsed_args.long: if parsed_args.long:
columns = ( columns = (
@ -240,8 +240,8 @@ class ShowObject(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
data = self.app.client_manager.object_store.object_show( data = self.app.client_manager.object_store.object_show(
container=parsed_args.container, container=parsed_args.container,

View File

@ -57,8 +57,8 @@ class CreateBackup(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume_id = utils.find_resource(volume_client.volumes, volume_id = utils.find_resource(volume_client.volumes,
parsed_args.volume).id parsed_args.volume).id
@ -88,8 +88,8 @@ class DeleteBackup(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
for backup in parsed_args.backups: for backup in parsed_args.backups:
backup_id = utils.find_resource(volume_client.backups, backup_id = utils.find_resource(volume_client.backups,
@ -113,8 +113,8 @@ class ListBackup(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
def _format_volume_id(volume_id): def _format_volume_id(volume_id):
"""Return a volume name if available """Return a volume name if available
@ -172,8 +172,8 @@ class RestoreBackup(command.Command):
help='Volume to restore to (name or ID)') help='Volume to restore to (name or ID)')
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
backup = utils.find_resource(volume_client.backups, backup = utils.find_resource(volume_client.backups,
parsed_args.backup) parsed_args.backup)
@ -196,8 +196,8 @@ class ShowBackup(show.ShowOne):
help='Backup to display (ID only)') help='Backup to display (ID only)')
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
backup = utils.find_resource(volume_client.backups, backup = utils.find_resource(volume_client.backups,
parsed_args.backup) parsed_args.backup)

View File

@ -45,8 +45,8 @@ class AssociateQos(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs, qos_spec = utils.find_resource(volume_client.qos_specs,
parsed_args.qos_spec) parsed_args.qos_spec)
@ -88,8 +88,8 @@ class CreateQos(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
specs = {} specs = {}
specs.update({'consumer': parsed_args.consumer}) specs.update({'consumer': parsed_args.consumer})
@ -117,8 +117,8 @@ class DeleteQos(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
for qos in parsed_args.qos_specs: for qos in parsed_args.qos_specs:
qos_spec = utils.find_resource(volume_client.qos_specs, qos) qos_spec = utils.find_resource(volume_client.qos_specs, qos)
@ -153,8 +153,8 @@ class DisassociateQos(command.Command):
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs, qos_spec = utils.find_resource(volume_client.qos_specs,
parsed_args.qos_spec) parsed_args.qos_spec)
@ -174,8 +174,8 @@ class ListQos(lister.Lister):
log = logging.getLogger(__name__ + '.ListQos') log = logging.getLogger(__name__ + '.ListQos')
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
qos_specs_list = volume_client.qos_specs.list() qos_specs_list = volume_client.qos_specs.list()
@ -218,8 +218,8 @@ class SetQos(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs, qos_spec = utils.find_resource(volume_client.qos_specs,
parsed_args.qos_spec) parsed_args.qos_spec)
@ -247,8 +247,8 @@ class ShowQos(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs, qos_spec = utils.find_resource(volume_client.qos_specs,
parsed_args.qos_spec) parsed_args.qos_spec)
@ -287,8 +287,8 @@ class UnsetQos(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs, qos_spec = utils.find_resource(volume_client.qos_specs,
parsed_args.qos_spec) parsed_args.qos_spec)

View File

@ -59,8 +59,8 @@ class CreateSnapshot(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume_id = utils.find_resource(volume_client.volumes, volume_id = utils.find_resource(volume_client.volumes,
parsed_args.volume).id parsed_args.volume).id
@ -93,8 +93,8 @@ class DeleteSnapshot(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
for snapshot in parsed_args.snapshots: for snapshot in parsed_args.snapshots:
snapshot_id = utils.find_resource(volume_client.volume_snapshots, snapshot_id = utils.find_resource(volume_client.volume_snapshots,
@ -118,8 +118,8 @@ class ListSnapshot(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
def _format_volume_id(volume_id): def _format_volume_id(volume_id):
"""Return a volume name if available """Return a volume name if available
@ -194,8 +194,8 @@ class SetSnapshot(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
snapshot = utils.find_resource(volume_client.volume_snapshots, snapshot = utils.find_resource(volume_client.volume_snapshots,
parsed_args.snapshot) parsed_args.snapshot)
@ -231,8 +231,8 @@ class ShowSnapshot(show.ShowOne):
help='Snapshot to display (name or ID)') help='Snapshot to display (name or ID)')
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
snapshot = utils.find_resource(volume_client.volume_snapshots, snapshot = utils.find_resource(volume_client.volume_snapshots,
parsed_args.snapshot) parsed_args.snapshot)
@ -267,8 +267,8 @@ class UnsetSnapshot(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
snapshot = utils.find_resource( snapshot = utils.find_resource(
volume_client.volume_snapshots, parsed_args.snapshot) volume_client.volume_snapshots, parsed_args.snapshot)

View File

@ -102,8 +102,8 @@ class CreateVolume(show.ShowOne):
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
image_client = self.app.client_manager.image image_client = self.app.client_manager.image
@ -186,8 +186,8 @@ class DeleteVolume(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
for volume in parsed_args.volumes: for volume in parsed_args.volumes:
volume_obj = utils.find_resource( volume_obj = utils.find_resource(
@ -230,8 +230,8 @@ class ListVolume(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
@ -351,8 +351,8 @@ class SetVolume(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume = utils.find_resource(volume_client.volumes, parsed_args.volume) volume = utils.find_resource(volume_client.volumes, parsed_args.volume)
@ -399,8 +399,8 @@ class ShowVolume(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume = utils.find_resource(volume_client.volumes, parsed_args.volume) volume = utils.find_resource(volume_client.volumes, parsed_args.volume)
# Map 'metadata' column to 'properties' # Map 'metadata' column to 'properties'
@ -441,8 +441,8 @@ class UnsetVolume(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume = utils.find_resource( volume = utils.find_resource(
volume_client.volumes, parsed_args.volume) volume_client.volumes, parsed_args.volume)

View File

@ -47,8 +47,8 @@ class CreateVolumeType(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume_type = volume_client.volume_types.create(parsed_args.name) volume_type = volume_client.volume_types.create(parsed_args.name)
volume_type._info.pop('extra_specs') volume_type._info.pop('extra_specs')
@ -75,8 +75,8 @@ class DeleteVolumeType(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume_type_id = utils.find_resource( volume_type_id = utils.find_resource(
volume_client.volume_types, parsed_args.volume_type).id volume_client.volume_types, parsed_args.volume_type).id
@ -98,8 +98,8 @@ class ListVolumeType(lister.Lister):
help='List additional fields in output') help='List additional fields in output')
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
if parsed_args.long: if parsed_args.long:
columns = ('ID', 'Name', 'Extra Specs') columns = ('ID', 'Name', 'Extra Specs')
column_headers = ('ID', 'Name', 'Properties') column_headers = ('ID', 'Name', 'Properties')
@ -135,8 +135,8 @@ class SetVolumeType(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume_type = utils.find_resource( volume_type = utils.find_resource(
volume_client.volume_types, parsed_args.volume_type) volume_client.volume_types, parsed_args.volume_type)
@ -170,8 +170,8 @@ class UnsetVolumeType(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume_type = utils.find_resource( volume_type = utils.find_resource(
volume_client.volume_types, volume_client.volume_types,

View File

@ -45,8 +45,8 @@ class AssociateQos(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs, qos_spec = utils.find_resource(volume_client.qos_specs,
parsed_args.qos_spec) parsed_args.qos_spec)
@ -88,8 +88,8 @@ class CreateQos(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
specs = {} specs = {}
specs.update({'consumer': parsed_args.consumer}) specs.update({'consumer': parsed_args.consumer})
@ -117,8 +117,8 @@ class DeleteQos(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
for qos in parsed_args.qos_specs: for qos in parsed_args.qos_specs:
qos_spec = utils.find_resource(volume_client.qos_specs, qos) qos_spec = utils.find_resource(volume_client.qos_specs, qos)
@ -153,8 +153,8 @@ class DisassociateQos(command.Command):
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs, qos_spec = utils.find_resource(volume_client.qos_specs,
parsed_args.qos_spec) parsed_args.qos_spec)
@ -174,8 +174,8 @@ class ListQos(lister.Lister):
log = logging.getLogger(__name__ + '.ListQos') log = logging.getLogger(__name__ + '.ListQos')
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
qos_specs_list = volume_client.qos_specs.list() qos_specs_list = volume_client.qos_specs.list()
@ -218,8 +218,8 @@ class SetQos(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs, qos_spec = utils.find_resource(volume_client.qos_specs,
parsed_args.qos_spec) parsed_args.qos_spec)
@ -247,8 +247,8 @@ class ShowQos(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs, qos_spec = utils.find_resource(volume_client.qos_specs,
parsed_args.qos_spec) parsed_args.qos_spec)
@ -287,8 +287,8 @@ class UnsetQos(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs, qos_spec = utils.find_resource(volume_client.qos_specs,
parsed_args.qos_spec) parsed_args.qos_spec)

View File

@ -186,8 +186,8 @@ class SetSnapshot(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
snapshot = utils.find_resource(volume_client.volume_snapshots, snapshot = utils.find_resource(volume_client.volume_snapshots,
parsed_args.snapshot) parsed_args.snapshot)
@ -256,8 +256,8 @@ class UnsetSnapshot(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
snapshot = utils.find_resource( snapshot = utils.find_resource(
volume_client.volume_snapshots, parsed_args.snapshot) volume_client.volume_snapshots, parsed_args.snapshot)

View File

@ -223,8 +223,8 @@ class ListVolume(lister.Lister):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
compute_client = self.app.client_manager.compute compute_client = self.app.client_manager.compute
@ -335,8 +335,8 @@ class SetVolume(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume = utils.find_resource(volume_client.volumes, parsed_args.volume) volume = utils.find_resource(volume_client.volumes, parsed_args.volume)
@ -383,8 +383,8 @@ class ShowVolume(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume = utils.find_resource(volume_client.volumes, parsed_args.volume) volume = utils.find_resource(volume_client.volumes, parsed_args.volume)
@ -416,8 +416,8 @@ class UnsetVolume(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume = utils.find_resource( volume = utils.find_resource(
volume_client.volumes, parsed_args.volume) volume_client.volumes, parsed_args.volume)

View File

@ -66,8 +66,8 @@ class CreateVolumeType(show.ShowOne):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
@ -127,8 +127,8 @@ class ListVolumeType(lister.Lister):
help='List additional fields in output') help='List additional fields in output')
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
if parsed_args.long: if parsed_args.long:
columns = ['ID', 'Name', 'Description', 'Extra Specs'] columns = ['ID', 'Name', 'Description', 'Extra Specs']
column_headers = ['ID', 'Name', 'Description', 'Properties'] column_headers = ['ID', 'Name', 'Description', 'Properties']
@ -174,8 +174,8 @@ class SetVolumeType(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume_type = utils.find_resource( volume_type = utils.find_resource(
volume_client.volume_types, parsed_args.volume_type) volume_client.volume_types, parsed_args.volume_type)
@ -250,8 +250,8 @@ class UnsetVolumeType(command.Command):
) )
return parser return parser
@utils.log_method(log)
def take_action(self, parsed_args): def take_action(self, parsed_args):
self.log.debug('take_action(%s)', parsed_args)
volume_client = self.app.client_manager.volume volume_client = self.app.client_manager.volume
volume_type = utils.find_resource( volume_type = utils.find_resource(
volume_client.volume_types, volume_client.volume_types,