log take_action parameters in a single place

Previously each command logs take_action parameters explicitly
by using @utils.log_method decorator or log.debug().
Some commands have no logging.

This commit calls a logger in the base class and
drops all logging definition from individual commands.

Closes-Bug: #1532294
Change-Id: I43cd0290a4353c68c075bade9571c940733da1be
This commit is contained in:
Akihiro Motoki 2016-01-10 21:54:53 +09:00
parent e9ff42eee7
commit 258c1102cc
71 changed files with 242 additions and 1391 deletions

View File

@ -14,12 +14,11 @@
"""Availability Zone action implementations"""
import copy
import logging
from cliff import lister
from novaclient import exceptions as nova_exceptions
import six
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
@ -70,11 +69,9 @@ def _xform_volume_availability_zone(az):
return result
class ListAvailabilityZone(lister.Lister):
class ListAvailabilityZone(command.Lister):
"""List availability zones and their status"""
log = logging.getLogger(__name__ + '.ListAvailabilityZone')
def get_parser(self, prog_name):
parser = super(ListAvailabilityZone, self).get_parser(prog_name)
parser.add_argument(
@ -125,7 +122,6 @@ class ListAvailabilityZone(lister.Lister):
result += _xform_volume_availability_zone(zone)
return result
@utils.log_method(log)
def take_action(self, parsed_args):
if parsed_args.long:

View File

@ -31,7 +31,10 @@ class CommandMeta(abc.ABCMeta):
@six.add_metaclass(CommandMeta)
class Command(command.Command):
pass
def run(self, parsed_args):
self.log.debug('run(%s)', parsed_args)
return super(Command, self).run(parsed_args)
class Lister(Command, lister.Lister):

View File

@ -13,21 +13,16 @@
"""Configuration action implementations"""
import logging
from cliff import show
import six
from openstackclient.common import utils
from openstackclient.common import command
REDACTED = "<redacted>"
class ShowConfiguration(show.ShowOne):
class ShowConfiguration(command.ShowOne):
"""Display configuration details"""
log = logging.getLogger(__name__ + '.ShowConfiguration')
def get_parser(self, prog_name):
parser = super(ShowConfiguration, self).get_parser(prog_name)
mask_group = parser.add_mutually_exclusive_group()
@ -46,7 +41,6 @@ class ShowConfiguration(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
info = self.app.client_manager.get_configuration()

View File

@ -16,18 +16,14 @@
"""Extension action implementations"""
import itertools
import logging
from cliff import lister
from openstackclient.common import command
from openstackclient.common import utils
class ListExtension(lister.Lister):
class ListExtension(command.Lister):
"""List API extensions"""
log = logging.getLogger(__name__ + '.ListExtension')
def get_parser(self, prog_name):
parser = super(ListExtension, self).get_parser(prog_name)
parser.add_argument(
@ -58,8 +54,6 @@ class ListExtension(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
if parsed_args.long:
columns = ('Name', 'Namespace', 'Description',
'Alias', 'Updated', 'Links')

View File

@ -16,19 +16,15 @@
"""Limits Action Implementation"""
import itertools
import logging
from cliff import lister
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.identity import common as identity_common
class ShowLimits(lister.Lister):
class ShowLimits(command.Lister):
"""Show compute and block storage limits"""
log = logging.getLogger(__name__ + '.ShowLimits')
def get_parser(self, prog_name):
parser = super(ShowLimits, self).get_parser(prog_name)
type_group = parser.add_mutually_exclusive_group(required=True)
@ -64,7 +60,6 @@ class ShowLimits(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute

View File

@ -15,23 +15,17 @@
"""Module action implementation"""
import logging
import six
import sys
from cliff import lister
from cliff import show
from openstackclient.common import utils
from openstackclient.common import command
class ListCommand(lister.Lister):
class ListCommand(command.Lister):
"""List recognized commands by group"""
auth_required = False
log = logging.getLogger(__name__ + '.ListCommand')
@utils.log_method(log)
def take_action(self, parsed_args):
cm = self.app.command_manager
groups = cm.get_command_groups()
@ -40,11 +34,10 @@ class ListCommand(lister.Lister):
return (columns, ((c, cm.get_command_names(group=c)) for c in groups))
class ListModule(show.ShowOne):
class ListModule(command.ShowOne):
"""List module versions"""
auth_required = False
log = logging.getLogger(__name__ + '.ListModule')
def get_parser(self, prog_name):
parser = super(ListModule, self).get_parser(prog_name)
@ -56,7 +49,6 @@ class ListModule(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
data = {}

View File

@ -16,13 +16,10 @@
"""Quota action implementations"""
import itertools
import logging
import six
import sys
from cliff import command
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
@ -60,8 +57,6 @@ NETWORK_QUOTAS = {
class SetQuota(command.Command):
"""Set quotas for project or class"""
log = logging.getLogger(__name__ + '.SetQuota')
def get_parser(self, prog_name):
parser = super(SetQuota, self).get_parser(prog_name)
parser.add_argument(
@ -92,7 +87,6 @@ class SetQuota(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -143,11 +137,9 @@ class SetQuota(command.Command):
**volume_kwargs)
class ShowQuota(show.ShowOne):
class ShowQuota(command.ShowOne):
"""Show quotas for project or class"""
log = logging.getLogger(__name__ + '.ShowQuota')
def get_parser(self, prog_name):
parser = super(ShowQuota, self).get_parser(prog_name)
parser.add_argument(
@ -203,7 +195,6 @@ class ShowQuota(show.ShowOne):
else:
return {}
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute

View File

@ -13,19 +13,13 @@
"""Timing Implementation"""
import logging
from cliff import lister
from openstackclient.common import command
class Timing(lister.Lister):
class Timing(command.Lister):
"""Show timing data"""
log = logging.getLogger(__name__ + '.Timing')
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
column_headers = (
'URL',
'Seconds',

View File

@ -15,21 +15,15 @@
"""Agent action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
class CreateAgent(show.ShowOne):
class CreateAgent(command.ShowOne):
"""Create compute agent command"""
log = logging.getLogger(__name__ + ".CreateAgent")
def get_parser(self, prog_name):
parser = super(CreateAgent, self).get_parser(prog_name)
parser.add_argument(
@ -60,7 +54,6 @@ class CreateAgent(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
args = (
parsed_args.os,
@ -77,8 +70,6 @@ class CreateAgent(show.ShowOne):
class DeleteAgent(command.Command):
"""Delete compute agent command"""
log = logging.getLogger(__name__ + ".DeleteAgent")
def get_parser(self, prog_name):
parser = super(DeleteAgent, self).get_parser(prog_name)
parser.add_argument(
@ -88,16 +79,13 @@ class DeleteAgent(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
compute_client.agents.delete(parsed_args.id)
class ListAgent(lister.Lister):
class ListAgent(command.Lister):
"""List compute agent command"""
log = logging.getLogger(__name__ + ".ListAgent")
def get_parser(self, prog_name):
parser = super(ListAgent, self).get_parser(prog_name)
parser.add_argument(
@ -107,7 +95,6 @@ class ListAgent(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
columns = (
"Agent ID",
@ -125,11 +112,9 @@ class ListAgent(lister.Lister):
) for s in data))
class SetAgent(show.ShowOne):
class SetAgent(command.ShowOne):
"""Set compute agent command"""
log = logging.getLogger(__name__ + ".SetAgent")
def get_parser(self, prog_name):
parser = super(SetAgent, self).get_parser(prog_name)
parser.add_argument(
@ -151,7 +136,6 @@ class SetAgent(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
args = (
parsed_args.id,

View File

@ -16,22 +16,16 @@
"""Compute v2 Aggregate action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
class AddAggregateHost(show.ShowOne):
class AddAggregateHost(command.ShowOne):
"""Add host to aggregate"""
log = logging.getLogger(__name__ + '.AddAggregateHost')
def get_parser(self, prog_name):
parser = super(AddAggregateHost, self).get_parser(prog_name)
parser.add_argument(
@ -47,8 +41,6 @@ class AddAggregateHost(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
aggregate = utils.find_resource(
@ -62,11 +54,9 @@ class AddAggregateHost(show.ShowOne):
return zip(*sorted(six.iteritems(info)))
class CreateAggregate(show.ShowOne):
class CreateAggregate(command.ShowOne):
"""Create a new aggregate"""
log = logging.getLogger(__name__ + ".CreateAggregate")
def get_parser(self, prog_name):
parser = super(CreateAggregate, self).get_parser(prog_name)
parser.add_argument(
@ -89,8 +79,6 @@ class CreateAggregate(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
info = {}
@ -112,8 +100,6 @@ class CreateAggregate(show.ShowOne):
class DeleteAggregate(command.Command):
"""Delete an existing aggregate"""
log = logging.getLogger(__name__ + '.DeleteAggregate')
def get_parser(self, prog_name):
parser = super(DeleteAggregate, self).get_parser(prog_name)
parser.add_argument(
@ -123,7 +109,6 @@ class DeleteAggregate(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -134,11 +119,9 @@ class DeleteAggregate(command.Command):
compute_client.aggregates.delete(data.id)
class ListAggregate(lister.Lister):
class ListAggregate(command.Lister):
"""List all aggregates"""
log = logging.getLogger(__name__ + ".ListAggregate")
def get_parser(self, prog_name):
parser = super(ListAggregate, self).get_parser(prog_name)
parser.add_argument(
@ -149,8 +132,6 @@ class ListAggregate(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
data = compute_client.aggregates.list()
@ -186,11 +167,9 @@ class ListAggregate(lister.Lister):
) for s in data))
class RemoveAggregateHost(show.ShowOne):
class RemoveAggregateHost(command.ShowOne):
"""Remove host from aggregate"""
log = logging.getLogger(__name__ + '.RemoveAggregateHost')
def get_parser(self, prog_name):
parser = super(RemoveAggregateHost, self).get_parser(prog_name)
parser.add_argument(
@ -206,8 +185,6 @@ class RemoveAggregateHost(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
aggregate = utils.find_resource(
@ -224,11 +201,9 @@ class RemoveAggregateHost(show.ShowOne):
return zip(*sorted(six.iteritems(info)))
class SetAggregate(show.ShowOne):
class SetAggregate(command.ShowOne):
"""Set aggregate properties"""
log = logging.getLogger(__name__ + '.SetAggregate')
def get_parser(self, prog_name):
parser = super(SetAggregate, self).get_parser(prog_name)
parser.add_argument(
@ -255,7 +230,6 @@ class SetAggregate(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -288,11 +262,9 @@ class SetAggregate(show.ShowOne):
return ({}, {})
class ShowAggregate(show.ShowOne):
class ShowAggregate(command.ShowOne):
"""Display aggregate details"""
log = logging.getLogger(__name__ + '.ShowAggregate')
def get_parser(self, prog_name):
parser = super(ShowAggregate, self).get_parser(prog_name)
parser.add_argument(
@ -302,7 +274,6 @@ class ShowAggregate(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute

View File

@ -15,13 +15,10 @@
"""Compute v2 Console action implementations"""
import logging
import six
import sys
from cliff import command
from cliff import show
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
@ -29,8 +26,6 @@ from openstackclient.common import utils
class ShowConsoleLog(command.Command):
"""Show server's console output"""
log = logging.getLogger(__name__ + '.ShowConsoleLog')
def get_parser(self, prog_name):
parser = super(ShowConsoleLog, self).get_parser(prog_name)
parser.add_argument(
@ -49,7 +44,6 @@ class ShowConsoleLog(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -67,11 +61,9 @@ class ShowConsoleLog(command.Command):
sys.stdout.write(data)
class ShowConsoleURL(show.ShowOne):
class ShowConsoleURL(command.ShowOne):
"""Show server's remote console URL"""
log = logging.getLogger(__name__ + '.ShowConsoleURL')
def get_parser(self, prog_name):
parser = super(ShowConsoleURL, self).get_parser(prog_name)
parser.add_argument(
@ -104,7 +96,6 @@ class ShowConsoleURL(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
server = utils.find_resource(

View File

@ -15,18 +15,13 @@
"""Fixed IP action implementations"""
import logging
from cliff import command
from openstackclient.common import command
from openstackclient.common import utils
class AddFixedIP(command.Command):
"""Add fixed IP address to server"""
log = logging.getLogger(__name__ + ".AddFixedIP")
def get_parser(self, prog_name):
parser = super(AddFixedIP, self).get_parser(prog_name)
parser.add_argument(
@ -42,7 +37,6 @@ class AddFixedIP(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
network = utils.find_resource(
@ -57,8 +51,6 @@ class AddFixedIP(command.Command):
class RemoveFixedIP(command.Command):
"""Remove fixed IP address from server"""
log = logging.getLogger(__name__ + ".RemoveFixedIP")
def get_parser(self, prog_name):
parser = super(RemoveFixedIP, self).get_parser(prog_name)
parser.add_argument(
@ -74,7 +66,6 @@ class RemoveFixedIP(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
server = utils.find_resource(

View File

@ -98,7 +98,6 @@ class CreateFlavor(command.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
args = (
@ -132,7 +131,6 @@ class DeleteFlavor(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
flavor = utils.find_resource(compute_client.flavors,
parsed_args.flavor)
@ -182,7 +180,6 @@ class ListFlavor(command.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
columns = (
"ID",
@ -234,7 +231,6 @@ class ShowFlavor(command.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
resource_flavor = utils.find_resource(compute_client.flavors,
parsed_args.flavor)
@ -266,7 +262,6 @@ class SetFlavor(command.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
resource_flavor = compute_client.flavors.find(name=parsed_args.flavor)
@ -299,7 +294,6 @@ class UnsetFlavor(command.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
resource_flavor = compute_client.flavors.find(name=parsed_args.flavor)

View File

@ -15,21 +15,15 @@
"""Floating IP action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
class AddFloatingIP(command.Command):
"""Add floating IP address to server"""
log = logging.getLogger(__name__ + ".AddFloatingIP")
def get_parser(self, prog_name):
parser = super(AddFloatingIP, self).get_parser(prog_name)
parser.add_argument(
@ -45,7 +39,6 @@ class AddFloatingIP(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
server = utils.find_resource(
@ -54,11 +47,9 @@ class AddFloatingIP(command.Command):
server.add_floating_ip(parsed_args.ip_address)
class CreateFloatingIP(show.ShowOne):
class CreateFloatingIP(command.ShowOne):
"""Create new floating IP address"""
log = logging.getLogger(__name__ + '.CreateFloatingIP')
def get_parser(self, prog_name):
parser = super(CreateFloatingIP, self).get_parser(prog_name)
parser.add_argument(
@ -68,7 +59,6 @@ class CreateFloatingIP(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
floating_ip = compute_client.floating_ips.create(parsed_args.pool)
@ -81,8 +71,6 @@ class CreateFloatingIP(show.ShowOne):
class DeleteFloatingIP(command.Command):
"""Delete a floating IP address"""
log = logging.getLogger(__name__ + '.DeleteFloatingIP')
def get_parser(self, prog_name):
parser = super(DeleteFloatingIP, self).get_parser(prog_name)
parser.add_argument(
@ -92,7 +80,6 @@ class DeleteFloatingIP(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -104,12 +91,9 @@ class DeleteFloatingIP(command.Command):
compute_client.floating_ips.delete(floating_ip)
class ListFloatingIP(lister.Lister):
class ListFloatingIP(command.Lister):
"""List floating IP addresses"""
log = logging.getLogger(__name__ + '.ListFloatingIP')
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -127,8 +111,6 @@ class ListFloatingIP(lister.Lister):
class RemoveFloatingIP(command.Command):
"""Remove floating IP address from server"""
log = logging.getLogger(__name__ + ".RemoveFloatingIP")
def get_parser(self, prog_name):
parser = super(RemoveFloatingIP, self).get_parser(prog_name)
parser.add_argument(
@ -144,7 +126,6 @@ class RemoveFloatingIP(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
server = utils.find_resource(

View File

@ -15,19 +15,13 @@
"""Floating IP Pool action implementations"""
import logging
from cliff import lister
from openstackclient.common import command
from openstackclient.common import utils
class ListFloatingIPPool(lister.Lister):
class ListFloatingIPPool(command.Lister):
"""List pools of floating IP addresses"""
log = logging.getLogger(__name__ + '.ListFloatingIPPool')
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute

View File

@ -15,18 +15,13 @@
"""Host action implementations"""
import logging
from cliff import lister
from openstackclient.common import command
from openstackclient.common import utils
class ListHost(lister.Lister):
class ListHost(command.Lister):
"""List host command"""
log = logging.getLogger(__name__ + ".ListHost")
def get_parser(self, prog_name):
parser = super(ListHost, self).get_parser(prog_name)
parser.add_argument(
@ -36,7 +31,6 @@ class ListHost(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
columns = (
"Host Name",
@ -50,11 +44,9 @@ class ListHost(lister.Lister):
) for s in data))
class ShowHost(lister.Lister):
class ShowHost(command.Lister):
"""Show host command"""
log = logging.getLogger(__name__ + ".ShowHost")
def get_parser(self, prog_name):
parser = super(ShowHost, self).get_parser(prog_name)
parser.add_argument(
@ -64,7 +56,6 @@ class ShowHost(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
columns = (
"Host",

View File

@ -15,21 +15,16 @@
"""Hypervisor action implementations"""
import logging
import re
import six
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
class ListHypervisor(lister.Lister):
class ListHypervisor(command.Lister):
"""List hypervisors"""
log = logging.getLogger(__name__ + ".ListHypervisor")
def get_parser(self, prog_name):
parser = super(ListHypervisor, self).get_parser(prog_name)
parser.add_argument(
@ -40,7 +35,6 @@ class ListHypervisor(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
columns = (
"ID",
@ -58,11 +52,9 @@ class ListHypervisor(lister.Lister):
) for s in data))
class ShowHypervisor(show.ShowOne):
class ShowHypervisor(command.ShowOne):
"""Display hypervisor details"""
log = logging.getLogger(__name__ + ".ShowHypervisor")
def get_parser(self, prog_name):
parser = super(ShowHypervisor, self).get_parser(prog_name)
parser.add_argument(
@ -72,7 +64,6 @@ class ShowHypervisor(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
hypervisor = utils.find_resource(compute_client.hypervisors,
parsed_args.hypervisor)._info.copy()

View File

@ -14,19 +14,15 @@
"""Hypervisor Stats action implementations"""
import logging
import six
from cliff import show
from openstackclient.common import command
class ShowHypervisorStats(show.ShowOne):
class ShowHypervisorStats(command.ShowOne):
"""Display hypervisor stats details"""
log = logging.getLogger(__name__ + ".ShowHypervisorStats")
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
hypervisor_stats = compute_client.hypervisors.statistics().to_dict()

View File

@ -15,24 +15,18 @@
"""Keypair action implementations"""
import logging
import os
import six
import sys
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import exceptions
from openstackclient.common import utils
class CreateKeypair(show.ShowOne):
class CreateKeypair(command.ShowOne):
"""Create new public key"""
log = logging.getLogger(__name__ + '.CreateKeypair')
def get_parser(self, prog_name):
parser = super(CreateKeypair, self).get_parser(prog_name)
parser.add_argument(
@ -47,7 +41,6 @@ class CreateKeypair(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -82,8 +75,6 @@ class CreateKeypair(show.ShowOne):
class DeleteKeypair(command.Command):
"""Delete public key"""
log = logging.getLogger(__name__ + '.DeleteKeypair')
def get_parser(self, prog_name):
parser = super(DeleteKeypair, self).get_parser(prog_name)
parser.add_argument(
@ -93,19 +84,15 @@ class DeleteKeypair(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
compute_client.keypairs.delete(parsed_args.name)
class ListKeypair(lister.Lister):
class ListKeypair(command.Lister):
"""List public key fingerprints"""
log = logging.getLogger(__name__ + ".ListKeypair")
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
columns = (
"Name",
@ -119,11 +106,9 @@ class ListKeypair(lister.Lister):
) for s in data))
class ShowKeypair(show.ShowOne):
class ShowKeypair(command.ShowOne):
"""Display public key details"""
log = logging.getLogger(__name__ + '.ShowKeypair')
def get_parser(self, prog_name):
parser = super(ShowKeypair, self).get_parser(prog_name)
parser.add_argument(
@ -139,7 +124,6 @@ class ShowKeypair(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
keypair = utils.find_resource(compute_client.keypairs,

View File

@ -16,13 +16,8 @@
"""Compute v2 Security Group action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from keystoneauth1 import exceptions as ks_exc
try:
@ -30,6 +25,7 @@ try:
except ImportError:
from novaclient.v1_1 import security_group_rules
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
@ -79,11 +75,9 @@ def _xform_and_trim_security_group_rule(sgroup):
return info
class CreateSecurityGroup(show.ShowOne):
class CreateSecurityGroup(command.ShowOne):
"""Create a new security group"""
log = logging.getLogger(__name__ + ".CreateSecurityGroup")
def get_parser(self, prog_name):
parser = super(CreateSecurityGroup, self).get_parser(prog_name)
parser.add_argument(
@ -99,8 +93,6 @@ class CreateSecurityGroup(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
description = parsed_args.description or parsed_args.name
@ -115,11 +107,9 @@ class CreateSecurityGroup(show.ShowOne):
return zip(*sorted(six.iteritems(info)))
class CreateSecurityGroupRule(show.ShowOne):
class CreateSecurityGroupRule(command.ShowOne):
"""Create a new security group rule"""
log = logging.getLogger(__name__ + ".CreateSecurityGroupRule")
def get_parser(self, prog_name):
parser = super(CreateSecurityGroupRule, self).get_parser(prog_name)
parser.add_argument(
@ -157,8 +147,6 @@ class CreateSecurityGroupRule(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
group = utils.find_resource(
compute_client.security_groups,
@ -184,8 +172,6 @@ class CreateSecurityGroupRule(show.ShowOne):
class DeleteSecurityGroup(command.Command):
"""Delete a security group"""
log = logging.getLogger(__name__ + '.DeleteSecurityGroup')
def get_parser(self, prog_name):
parser = super(DeleteSecurityGroup, self).get_parser(prog_name)
parser.add_argument(
@ -195,7 +181,6 @@ class DeleteSecurityGroup(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -209,8 +194,6 @@ class DeleteSecurityGroup(command.Command):
class DeleteSecurityGroupRule(command.Command):
"""Delete a security group rule"""
log = logging.getLogger(__name__ + '.DeleteSecurityGroupRule')
def get_parser(self, prog_name):
parser = super(DeleteSecurityGroupRule, self).get_parser(prog_name)
parser.add_argument(
@ -220,18 +203,15 @@ class DeleteSecurityGroupRule(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
compute_client.security_group_rules.delete(parsed_args.rule)
class ListSecurityGroup(lister.Lister):
class ListSecurityGroup(command.Lister):
"""List security groups"""
log = logging.getLogger(__name__ + ".ListSecurityGroup")
def get_parser(self, prog_name):
parser = super(ListSecurityGroup, self).get_parser(prog_name)
parser.add_argument(
@ -250,8 +230,6 @@ class ListSecurityGroup(lister.Lister):
except KeyError:
return project_id
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
columns = (
"ID",
@ -283,11 +261,9 @@ class ListSecurityGroup(lister.Lister):
) for s in data))
class ListSecurityGroupRule(lister.Lister):
class ListSecurityGroupRule(command.Lister):
"""List security group rules"""
log = logging.getLogger(__name__ + ".ListSecurityGroupRule")
def get_parser(self, prog_name):
parser = super(ListSecurityGroupRule, self).get_parser(prog_name)
parser.add_argument(
@ -299,8 +275,6 @@ class ListSecurityGroupRule(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
columns = column_headers = (
"ID",
@ -337,11 +311,9 @@ class ListSecurityGroupRule(lister.Lister):
) for s in rules))
class SetSecurityGroup(show.ShowOne):
class SetSecurityGroup(command.ShowOne):
"""Set security group properties"""
log = logging.getLogger(__name__ + '.SetSecurityGroup')
def get_parser(self, prog_name):
parser = super(SetSecurityGroup, self).get_parser(prog_name)
parser.add_argument(
@ -361,7 +333,6 @@ class SetSecurityGroup(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -388,11 +359,9 @@ class SetSecurityGroup(show.ShowOne):
return ({}, {})
class ShowSecurityGroup(show.ShowOne):
class ShowSecurityGroup(command.ShowOne):
"""Display security group details"""
log = logging.getLogger(__name__ + '.ShowSecurityGroup')
def get_parser(self, prog_name):
parser = super(ShowSecurityGroup, self).get_parser(prog_name)
parser.add_argument(
@ -402,7 +371,6 @@ class ShowSecurityGroup(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute

View File

@ -185,8 +185,6 @@ class AddServerSecurityGroup(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
server = utils.find_resource(
@ -224,8 +222,6 @@ class AddServerVolume(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
volume_client = self.app.client_manager.volume
@ -370,7 +366,6 @@ class CreateServer(command.ShowOne):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
volume_client = self.app.client_manager.volume
@ -569,7 +564,6 @@ class CreateServerImage(command.ShowOne):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
image_client = self.app.client_manager.image
@ -626,7 +620,6 @@ class DeleteServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
for server in parsed_args.server:
@ -741,7 +734,6 @@ class ListServer(command.Lister):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
identity_client = self.app.client_manager.identity
@ -872,7 +864,6 @@ class LockServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -944,7 +935,6 @@ class MigrateServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -987,7 +977,6 @@ class PauseServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
for server in parsed_args.server:
@ -1031,7 +1020,6 @@ class RebootServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
server = utils.find_resource(
@ -1078,7 +1066,6 @@ class RebuildServer(command.ShowOne):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -1123,8 +1110,6 @@ class RemoveServerSecurityGroup(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
server = utils.find_resource(
@ -1157,8 +1142,6 @@ class RemoveServerVolume(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
volume_client = self.app.client_manager.volume
@ -1189,7 +1172,6 @@ class RescueServer(command.ShowOne):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -1233,7 +1215,6 @@ class ResizeServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -1277,7 +1258,6 @@ class ResumeServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -1317,7 +1297,6 @@ class SetServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -1358,7 +1337,6 @@ class ShelveServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
for server in parsed_args.server:
@ -1386,7 +1364,6 @@ class ShowServer(command.ShowOne):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
server = utils.find_resource(compute_client.servers,
@ -1507,7 +1484,6 @@ class SshServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -1561,7 +1537,6 @@ class StartServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
for server in parsed_args.server:
@ -1584,7 +1559,6 @@ class StopServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
for server in parsed_args.server:
@ -1607,7 +1581,6 @@ class SuspendServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -1631,7 +1604,6 @@ class UnlockServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -1655,7 +1627,6 @@ class UnpauseServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -1678,7 +1649,6 @@ class UnrescueServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
@ -1708,7 +1678,6 @@ class UnsetServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
server = utils.find_resource(
@ -1736,7 +1705,6 @@ class UnshelveServer(command.Command):
)
return parser
@utils.log_method()
def take_action(self, parsed_args):
compute_client = self.app.client_manager.compute
for server in parsed_args.server:

View File

@ -15,19 +15,13 @@
"""Service action implementations"""
import logging
from cliff import command
from cliff import lister
from openstackclient.common import command
from openstackclient.common import utils
class DeleteService(command.Command):
"""Delete service command"""
log = logging.getLogger(__name__ + ".DeleteService")
def get_parser(self, prog_name):
parser = super(DeleteService, self).get_parser(prog_name)
parser.add_argument(
@ -37,17 +31,14 @@ class DeleteService(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
compute_client.services.delete(parsed_args.service)
class ListService(lister.Lister):
class ListService(command.Lister):
"""List service command"""
log = logging.getLogger(__name__ + ".ListService")
def get_parser(self, prog_name):
parser = super(ListService, self).get_parser(prog_name)
parser.add_argument(
@ -61,7 +52,6 @@ class ListService(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
columns = (
"Id",
@ -83,8 +73,6 @@ class ListService(lister.Lister):
class SetService(command.Command):
"""Set service command"""
log = logging.getLogger(__name__ + ".SetService")
def get_parser(self, prog_name):
parser = super(SetService, self).get_parser(prog_name)
parser.add_argument(
@ -110,7 +98,6 @@ class SetService(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
compute_client = self.app.client_manager.compute
if parsed_args.enabled:

View File

@ -16,21 +16,17 @@
"""Usage action implementations"""
import datetime
import logging
import sys
from cliff import lister
from cliff import show
import six
from openstackclient.common import command
from openstackclient.common import utils
class ListUsage(lister.Lister):
class ListUsage(command.Lister):
"""List resource usage per project"""
log = logging.getLogger(__name__ + ".ListUsage")
def get_parser(self, prog_name):
parser = super(ListUsage, self).get_parser(prog_name)
parser.add_argument(
@ -49,7 +45,6 @@ class ListUsage(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
def _format_project(project):
if not project:
@ -118,11 +113,9 @@ class ListUsage(lister.Lister):
) for s in usage_list))
class ShowUsage(show.ShowOne):
class ShowUsage(command.ShowOne):
"""Show resource usage for a single project"""
log = logging.getLogger(__name__ + ".ShowUsage")
def get_parser(self, prog_name):
parser = super(ShowUsage, self).get_parser(prog_name)
parser.add_argument(
@ -147,8 +140,6 @@ class ShowUsage(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
identity_client = self.app.client_manager.identity
compute_client = self.app.client_manager.compute
dateformat = "%Y-%m-%d"

View File

@ -13,12 +13,9 @@
"""Identity v2 Service Catalog action implementations"""
import logging
import six
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
@ -37,12 +34,9 @@ def _format_endpoints(eps=None):
return ret
class ListCatalog(lister.Lister):
class ListCatalog(command.Lister):
"""List services in the service catalog"""
log = logging.getLogger(__name__ + '.ListCatalog')
@utils.log_method(log)
def take_action(self, parsed_args):
# This is ugly because if auth hasn't happened yet we need
@ -62,11 +56,9 @@ class ListCatalog(lister.Lister):
) for s in data))
class ShowCatalog(show.ShowOne):
class ShowCatalog(command.ShowOne):
"""Display service catalog details"""
log = logging.getLogger(__name__ + '.ShowCatalog')
def get_parser(self, prog_name):
parser = super(ShowCatalog, self).get_parser(prog_name)
parser.add_argument(
@ -76,7 +68,6 @@ class ShowCatalog(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
# This is ugly because if auth hasn't happened yet we need

View File

@ -16,22 +16,16 @@
"""Identity v2 EC2 Credentials action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
class CreateEC2Creds(show.ShowOne):
class CreateEC2Creds(command.ShowOne):
"""Create EC2 credentials"""
log = logging.getLogger(__name__ + ".CreateEC2Creds")
def get_parser(self, prog_name):
parser = super(CreateEC2Creds, self).get_parser(prog_name)
parser.add_argument(
@ -52,7 +46,6 @@ class CreateEC2Creds(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -89,8 +82,6 @@ class CreateEC2Creds(show.ShowOne):
class DeleteEC2Creds(command.Command):
"""Delete EC2 credentials"""
log = logging.getLogger(__name__ + '.DeleteEC2Creds')
def get_parser(self, prog_name):
parser = super(DeleteEC2Creds, self).get_parser(prog_name)
parser.add_argument(
@ -105,7 +96,6 @@ class DeleteEC2Creds(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -121,11 +111,9 @@ class DeleteEC2Creds(command.Command):
identity_client.ec2.delete(user, parsed_args.access_key)
class ListEC2Creds(lister.Lister):
class ListEC2Creds(command.Lister):
"""List EC2 credentials"""
log = logging.getLogger(__name__ + '.ListEC2Creds')
def get_parser(self, prog_name):
parser = super(ListEC2Creds, self).get_parser(prog_name)
parser.add_argument(
@ -135,7 +123,6 @@ class ListEC2Creds(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -159,11 +146,9 @@ class ListEC2Creds(lister.Lister):
) for s in data))
class ShowEC2Creds(show.ShowOne):
class ShowEC2Creds(command.ShowOne):
"""Display EC2 credentials details"""
log = logging.getLogger(__name__ + '.ShowEC2Creds')
def get_parser(self, prog_name):
parser = super(ShowEC2Creds, self).get_parser(prog_name)
parser.add_argument(
@ -178,7 +163,6 @@ class ShowEC2Creds(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity

View File

@ -15,23 +15,17 @@
"""Endpoint action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
from openstackclient.identity import common
class CreateEndpoint(show.ShowOne):
class CreateEndpoint(command.ShowOne):
"""Create new endpoint"""
log = logging.getLogger(__name__ + '.CreateEndpoint')
def get_parser(self, prog_name):
parser = super(CreateEndpoint, self).get_parser(prog_name)
parser.add_argument(
@ -62,7 +56,6 @@ class CreateEndpoint(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
service = common.find_service(identity_client, parsed_args.service)
@ -83,8 +76,6 @@ class CreateEndpoint(show.ShowOne):
class DeleteEndpoint(command.Command):
"""Delete endpoint"""
log = logging.getLogger(__name__ + '.DeleteEndpoint')
def get_parser(self, prog_name):
parser = super(DeleteEndpoint, self).get_parser(prog_name)
parser.add_argument(
@ -93,18 +84,15 @@ class DeleteEndpoint(command.Command):
help=_('Endpoint ID to delete'))
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
identity_client.endpoints.delete(parsed_args.endpoint)
return
class ListEndpoint(lister.Lister):
class ListEndpoint(command.Lister):
"""List endpoints"""
log = logging.getLogger(__name__ + '.ListEndpoint')
def get_parser(self, prog_name):
parser = super(ListEndpoint, self).get_parser(prog_name)
parser.add_argument(
@ -115,7 +103,6 @@ class ListEndpoint(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
if parsed_args.long:
@ -136,11 +123,9 @@ class ListEndpoint(lister.Lister):
) for s in data))
class ShowEndpoint(show.ShowOne):
class ShowEndpoint(command.ShowOne):
"""Display endpoint details"""
log = logging.getLogger(__name__ + '.ShowEndpoint')
def get_parser(self, prog_name):
parser = super(ShowEndpoint, self).get_parser(prog_name)
parser.add_argument(
@ -150,7 +135,6 @@ class ShowEndpoint(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
data = identity_client.endpoints.list()

View File

@ -15,24 +15,19 @@
"""Identity v2 Project action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from keystoneauth1 import exceptions as ks_exc
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
class CreateProject(show.ShowOne):
class CreateProject(command.ShowOne):
"""Create new project"""
log = logging.getLogger(__name__ + '.CreateProject')
def get_parser(self, prog_name):
parser = super(CreateProject, self).get_parser(prog_name)
parser.add_argument(
@ -70,7 +65,6 @@ class CreateProject(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -106,8 +100,6 @@ class CreateProject(show.ShowOne):
class DeleteProject(command.Command):
"""Delete project(s)"""
log = logging.getLogger(__name__ + '.DeleteProject')
def get_parser(self, prog_name):
parser = super(DeleteProject, self).get_parser(prog_name)
parser.add_argument(
@ -118,7 +110,6 @@ class DeleteProject(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -131,11 +122,9 @@ class DeleteProject(command.Command):
return
class ListProject(lister.Lister):
class ListProject(command.Lister):
"""List projects"""
log = logging.getLogger(__name__ + '.ListProject')
def get_parser(self, prog_name):
parser = super(ListProject, self).get_parser(prog_name)
parser.add_argument(
@ -146,7 +135,6 @@ class ListProject(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
if parsed_args.long:
columns = ('ID', 'Name', 'Description', 'Enabled')
@ -163,8 +151,6 @@ class ListProject(lister.Lister):
class SetProject(command.Command):
"""Set project properties"""
log = logging.getLogger(__name__ + '.SetProject')
def get_parser(self, prog_name):
parser = super(SetProject, self).get_parser(prog_name)
parser.add_argument(
@ -202,7 +188,6 @@ class SetProject(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -240,11 +225,9 @@ class SetProject(command.Command):
return
class ShowProject(show.ShowOne):
class ShowProject(command.ShowOne):
"""Display project details"""
log = logging.getLogger(__name__ + '.ShowProject')
def get_parser(self, prog_name):
parser = super(ShowProject, self).get_parser(prog_name)
parser.add_argument(
@ -253,7 +236,6 @@ class ShowProject(show.ShowOne):
help=_('Project to display (name or ID)'))
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -303,8 +285,6 @@ class ShowProject(show.ShowOne):
class UnsetProject(command.Command):
"""Unset project properties"""
log = logging.getLogger(__name__ + '.UnsetProject')
def get_parser(self, prog_name):
parser = super(UnsetProject, self).get_parser(prog_name)
parser.add_argument(
@ -323,7 +303,6 @@ class UnsetProject(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
project = utils.find_resource(

View File

@ -15,24 +15,19 @@
"""Identity v2 Role action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from keystoneauth1 import exceptions as ks_exc
from openstackclient.common import command
from openstackclient.common import exceptions
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
class AddRole(show.ShowOne):
class AddRole(command.ShowOne):
"""Add role to project:user"""
log = logging.getLogger(__name__ + '.AddRole')
def get_parser(self, prog_name):
parser = super(AddRole, self).get_parser(prog_name)
parser.add_argument(
@ -54,7 +49,6 @@ class AddRole(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
role = utils.find_resource(identity_client.roles, parsed_args.role)
@ -74,11 +68,9 @@ class AddRole(show.ShowOne):
return zip(*sorted(six.iteritems(info)))
class CreateRole(show.ShowOne):
class CreateRole(command.ShowOne):
"""Create new role"""
log = logging.getLogger(__name__ + '.CreateRole')
def get_parser(self, prog_name):
parser = super(CreateRole, self).get_parser(prog_name)
parser.add_argument(
@ -93,7 +85,6 @@ class CreateRole(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
try:
@ -116,8 +107,6 @@ class CreateRole(show.ShowOne):
class DeleteRole(command.Command):
"""Delete role(s)"""
log = logging.getLogger(__name__ + '.DeleteRole')
def get_parser(self, prog_name):
parser = super(DeleteRole, self).get_parser(prog_name)
parser.add_argument(
@ -128,7 +117,6 @@ class DeleteRole(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -141,11 +129,9 @@ class DeleteRole(command.Command):
return
class ListRole(lister.Lister):
class ListRole(command.Lister):
"""List roles"""
log = logging.getLogger(__name__ + '.ListRole')
def get_parser(self, prog_name):
parser = super(ListRole, self).get_parser(prog_name)
parser.add_argument(
@ -160,7 +146,6 @@ class ListRole(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
auth_ref = self.app.client_manager.auth_ref
@ -222,11 +207,9 @@ class ListRole(lister.Lister):
) for s in data))
class ListUserRole(lister.Lister):
class ListUserRole(command.Lister):
"""List user-role assignments"""
log = logging.getLogger(__name__ + '.ListUserRole')
def get_parser(self, prog_name):
parser = super(ListUserRole, self).get_parser(prog_name)
parser.add_argument(
@ -242,7 +225,6 @@ class ListUserRole(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
auth_ref = self.app.client_manager.auth_ref
@ -293,8 +275,6 @@ class ListUserRole(lister.Lister):
class RemoveRole(command.Command):
"""Remove role from project : user"""
log = logging.getLogger(__name__ + '.RemoveRole')
def get_parser(self, prog_name):
parser = super(RemoveRole, self).get_parser(prog_name)
parser.add_argument(
@ -316,7 +296,6 @@ class RemoveRole(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
role = utils.find_resource(identity_client.roles, parsed_args.role)
@ -331,11 +310,9 @@ class RemoveRole(command.Command):
project.id)
class ShowRole(show.ShowOne):
class ShowRole(command.ShowOne):
"""Display role details"""
log = logging.getLogger(__name__ + '.ShowRole')
def get_parser(self, prog_name):
parser = super(ShowRole, self).get_parser(prog_name)
parser.add_argument(
@ -345,7 +322,6 @@ class ShowRole(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
role = utils.find_resource(identity_client.roles, parsed_args.role)

View File

@ -16,24 +16,18 @@
"""Service action implementations"""
import argparse
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import exceptions
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
from openstackclient.identity import common
class CreateService(show.ShowOne):
class CreateService(command.ShowOne):
"""Create new service"""
log = logging.getLogger(__name__ + '.CreateService')
def get_parser(self, prog_name):
parser = super(CreateService, self).get_parser(prog_name)
parser.add_argument(
@ -59,7 +53,6 @@ class CreateService(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -95,8 +88,6 @@ class CreateService(show.ShowOne):
class DeleteService(command.Command):
"""Delete service"""
log = logging.getLogger(__name__ + '.DeleteService')
def get_parser(self, prog_name):
parser = super(DeleteService, self).get_parser(prog_name)
parser.add_argument(
@ -106,7 +97,6 @@ class DeleteService(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
service = common.find_service(identity_client, parsed_args.service)
@ -114,11 +104,9 @@ class DeleteService(command.Command):
return
class ListService(lister.Lister):
class ListService(command.Lister):
"""List services"""
log = logging.getLogger(__name__ + '.ListService')
def get_parser(self, prog_name):
parser = super(ListService, self).get_parser(prog_name)
parser.add_argument(
@ -129,7 +117,6 @@ class ListService(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
if parsed_args.long:
@ -143,11 +130,9 @@ class ListService(lister.Lister):
)
class ShowService(show.ShowOne):
class ShowService(command.ShowOne):
"""Display service details"""
log = logging.getLogger(__name__ + '.ShowService')
def get_parser(self, prog_name):
parser = super(ShowService, self).get_parser(prog_name)
parser.add_argument(
@ -163,7 +148,6 @@ class ShowService(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
auth_ref = self.app.client_manager.auth_ref

View File

@ -15,26 +15,19 @@
"""Identity v2 Token action implementations"""
import logging
import six
from cliff import command
from cliff import show
from openstackclient.common import utils
from openstackclient.common import command
from openstackclient.i18n import _ # noqa
class IssueToken(show.ShowOne):
class IssueToken(command.ShowOne):
"""Issue new token"""
log = logging.getLogger(__name__ + '.IssueToken')
def get_parser(self, prog_name):
parser = super(IssueToken, self).get_parser(prog_name)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
token = self.app.client_manager.auth_ref.service_catalog.get_token()
@ -45,8 +38,6 @@ class IssueToken(show.ShowOne):
class RevokeToken(command.Command):
"""Revoke existing token"""
log = logging.getLogger(__name__ + '.RevokeToken')
def get_parser(self, prog_name):
parser = super(RevokeToken, self).get_parser(prog_name)
parser.add_argument(
@ -57,7 +48,6 @@ class RevokeToken(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
identity_client = self.app.client_manager.identity
identity_client.tokens.delete(parsed_args.token)

View File

@ -15,23 +15,18 @@
"""Identity v2.0 User action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from keystoneauth1 import exceptions as ks_exc
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
class CreateUser(show.ShowOne):
class CreateUser(command.ShowOne):
"""Create new user"""
log = logging.getLogger(__name__ + '.CreateUser')
def get_parser(self, prog_name):
parser = super(CreateUser, self).get_parser(prog_name)
parser.add_argument(
@ -78,7 +73,6 @@ class CreateUser(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -130,8 +124,6 @@ class CreateUser(show.ShowOne):
class DeleteUser(command.Command):
"""Delete user(s)"""
log = logging.getLogger(__name__ + '.DeleteUser')
def get_parser(self, prog_name):
parser = super(DeleteUser, self).get_parser(prog_name)
parser.add_argument(
@ -142,7 +134,6 @@ class DeleteUser(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -155,11 +146,9 @@ class DeleteUser(command.Command):
return
class ListUser(lister.Lister):
class ListUser(command.Lister):
"""List users"""
log = logging.getLogger(__name__ + '.ListUser')
def get_parser(self, prog_name):
parser = super(ListUser, self).get_parser(prog_name)
parser.add_argument(
@ -174,7 +163,6 @@ class ListUser(lister.Lister):
help=_('List additional fields in output'))
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -248,8 +236,6 @@ class ListUser(lister.Lister):
class SetUser(command.Command):
"""Set user properties"""
log = logging.getLogger(__name__ + '.SetUser')
def get_parser(self, prog_name):
parser = super(SetUser, self).get_parser(prog_name)
parser.add_argument(
@ -296,7 +282,6 @@ class SetUser(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -348,11 +333,9 @@ class SetUser(command.Command):
return
class ShowUser(show.ShowOne):
class ShowUser(command.ShowOne):
"""Display user details"""
log = logging.getLogger(__name__ + '.ShowUser')
def get_parser(self, prog_name):
parser = super(ShowUser, self).get_parser(prog_name)
parser.add_argument(
@ -362,7 +345,6 @@ class ShowUser(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity

View File

@ -13,12 +13,9 @@
"""Identity v3 Service Catalog action implementations"""
import logging
from cliff import lister
from cliff import show
import six
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
@ -34,12 +31,9 @@ def _format_endpoints(eps=None):
return ret
class ListCatalog(lister.Lister):
class ListCatalog(command.Lister):
"""List services in the service catalog"""
log = logging.getLogger(__name__ + '.ListCatalog')
@utils.log_method(log)
def take_action(self, parsed_args):
# This is ugly because if auth hasn't happened yet we need
@ -59,11 +53,9 @@ class ListCatalog(lister.Lister):
) for s in data))
class ShowCatalog(show.ShowOne):
class ShowCatalog(command.ShowOne):
"""Display service catalog details"""
log = logging.getLogger(__name__ + '.ShowCatalog')
def get_parser(self, prog_name):
parser = super(ShowCatalog, self).get_parser(prog_name)
parser.add_argument(
@ -73,7 +65,6 @@ class ShowCatalog(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
# This is ugly because if auth hasn't happened yet we need

View File

@ -15,22 +15,16 @@
"""Identity v3 Consumer action implementations"""
import logging
import six
import sys
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
class CreateConsumer(show.ShowOne):
class CreateConsumer(command.ShowOne):
"""Create new consumer"""
log = logging.getLogger(__name__ + '.CreateConsumer')
def get_parser(self, prog_name):
parser = super(CreateConsumer, self).get_parser(prog_name)
parser.add_argument(
@ -40,7 +34,6 @@ class CreateConsumer(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
consumer = identity_client.oauth1.consumers.create(
@ -53,8 +46,6 @@ class CreateConsumer(show.ShowOne):
class DeleteConsumer(command.Command):
"""Delete consumer"""
log = logging.getLogger(__name__ + '.DeleteConsumer')
def get_parser(self, prog_name):
parser = super(DeleteConsumer, self).get_parser(prog_name)
parser.add_argument(
@ -64,7 +55,6 @@ class DeleteConsumer(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
consumer = utils.find_resource(
@ -73,12 +63,9 @@ class DeleteConsumer(command.Command):
return
class ListConsumer(lister.Lister):
class ListConsumer(command.Lister):
"""List consumers"""
log = logging.getLogger(__name__ + '.ListConsumer')
@utils.log_method(log)
def take_action(self, parsed_args):
columns = ('ID', 'Description')
data = self.app.client_manager.identity.oauth1.consumers.list()
@ -92,8 +79,6 @@ class ListConsumer(lister.Lister):
class SetConsumer(command.Command):
"""Set consumer properties"""
log = logging.getLogger(__name__ + '.SetConsumer')
def get_parser(self, prog_name):
parser = super(SetConsumer, self).get_parser(prog_name)
parser.add_argument(
@ -108,7 +93,6 @@ class SetConsumer(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
consumer = utils.find_resource(
@ -126,11 +110,9 @@ class SetConsumer(command.Command):
return
class ShowConsumer(show.ShowOne):
class ShowConsumer(command.ShowOne):
"""Display consumer details"""
log = logging.getLogger(__name__ + '.ShowConsumer')
def get_parser(self, prog_name):
parser = super(ShowConsumer, self).get_parser(prog_name)
parser.add_argument(
@ -140,7 +122,6 @@ class ShowConsumer(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
consumer = utils.find_resource(

View File

@ -15,21 +15,15 @@
"""Identity v3 Credential action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
class CreateCredential(show.ShowOne):
class CreateCredential(command.ShowOne):
"""Create credential command"""
log = logging.getLogger(__name__ + '.CreateCredential')
def get_parser(self, prog_name):
parser = super(CreateCredential, self).get_parser(prog_name)
parser.add_argument(
@ -56,7 +50,6 @@ class CreateCredential(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
user_id = utils.find_resource(identity_client.users,
@ -79,8 +72,6 @@ class CreateCredential(show.ShowOne):
class DeleteCredential(command.Command):
"""Delete credential command"""
log = logging.getLogger(__name__ + '.DeleteCredential')
def get_parser(self, prog_name):
parser = super(DeleteCredential, self).get_parser(prog_name)
parser.add_argument(
@ -90,19 +81,15 @@ class DeleteCredential(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
identity_client.credentials.delete(parsed_args.credential)
return
class ListCredential(lister.Lister):
class ListCredential(command.Lister):
"""List credential command"""
log = logging.getLogger(__name__ + '.ListCredential')
@utils.log_method(log)
def take_action(self, parsed_args):
columns = ('ID', 'Type', 'User ID', 'Blob', 'Project ID')
column_headers = ('ID', 'Type', 'User ID', 'Data', 'Project ID')
@ -117,8 +104,6 @@ class ListCredential(lister.Lister):
class SetCredential(command.Command):
"""Set credential command"""
log = logging.getLogger(__name__ + '.SetCredential')
def get_parser(self, prog_name):
parser = super(SetCredential, self).get_parser(prog_name)
parser.add_argument(
@ -152,7 +137,6 @@ class SetCredential(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -174,11 +158,9 @@ class SetCredential(command.Command):
return
class ShowCredential(show.ShowOne):
class ShowCredential(command.ShowOne):
"""Show credential command"""
log = logging.getLogger(__name__ + '.ShowCredential')
def get_parser(self, prog_name):
parser = super(ShowCredential, self).get_parser(prog_name)
parser.add_argument(
@ -188,7 +170,6 @@ class ShowCredential(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
credential = utils.find_resource(identity_client.credentials,

View File

@ -15,24 +15,19 @@
"""Identity v3 Domain action implementations"""
import logging
import six
import sys
from cliff import command
from cliff import lister
from cliff import show
from keystoneauth1 import exceptions as ks_exc
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
class CreateDomain(show.ShowOne):
class CreateDomain(command.ShowOne):
"""Create new domain"""
log = logging.getLogger(__name__ + '.CreateDomain')
def get_parser(self, prog_name):
parser = super(CreateDomain, self).get_parser(prog_name)
parser.add_argument(
@ -63,7 +58,6 @@ class CreateDomain(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -92,8 +86,6 @@ class CreateDomain(show.ShowOne):
class DeleteDomain(command.Command):
"""Delete domain"""
log = logging.getLogger(__name__ + '.DeleteDomain')
def get_parser(self, prog_name):
parser = super(DeleteDomain, self).get_parser(prog_name)
parser.add_argument(
@ -103,7 +95,6 @@ class DeleteDomain(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
domain = utils.find_resource(identity_client.domains,
@ -112,12 +103,9 @@ class DeleteDomain(command.Command):
return
class ListDomain(lister.Lister):
class ListDomain(command.Lister):
"""List domains"""
log = logging.getLogger(__name__ + '.ListDomain')
@utils.log_method(log)
def take_action(self, parsed_args):
columns = ('ID', 'Name', 'Enabled', 'Description')
data = self.app.client_manager.identity.domains.list()
@ -131,8 +119,6 @@ class ListDomain(lister.Lister):
class SetDomain(command.Command):
"""Set domain properties"""
log = logging.getLogger(__name__ + '.SetDomain')
def get_parser(self, prog_name):
parser = super(SetDomain, self).get_parser(prog_name)
parser.add_argument(
@ -163,7 +149,6 @@ class SetDomain(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
domain = utils.find_resource(identity_client.domains,
@ -186,11 +171,9 @@ class SetDomain(command.Command):
return
class ShowDomain(show.ShowOne):
class ShowDomain(command.ShowOne):
"""Display domain details"""
log = logging.getLogger(__name__ + '.ShowDomain')
def get_parser(self, prog_name):
parser = super(ShowDomain, self).get_parser(prog_name)
parser.add_argument(
@ -200,7 +183,6 @@ class ShowDomain(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
domain = utils.find_resource(identity_client.domains,

View File

@ -12,13 +12,9 @@
"""Identity v3 EC2 Credentials action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
from openstackclient.identity import common
@ -52,11 +48,9 @@ def _determine_ec2_user(parsed_args, client_manager):
return user
class CreateEC2Creds(show.ShowOne):
class CreateEC2Creds(command.ShowOne):
"""Create EC2 credentials"""
log = logging.getLogger(__name__ + ".CreateEC2Creds")
def get_parser(self, prog_name):
parser = super(CreateEC2Creds, self).get_parser(prog_name)
parser.add_argument(
@ -79,7 +73,6 @@ class CreateEC2Creds(show.ShowOne):
common.add_project_domain_option_to_parser(parser)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
client_manager = self.app.client_manager
@ -119,8 +112,6 @@ class CreateEC2Creds(show.ShowOne):
class DeleteEC2Creds(command.Command):
"""Delete EC2 credentials"""
log = logging.getLogger(__name__ + '.DeleteEC2Creds')
def get_parser(self, prog_name):
parser = super(DeleteEC2Creds, self).get_parser(prog_name)
parser.add_argument(
@ -136,18 +127,15 @@ class DeleteEC2Creds(command.Command):
common.add_user_domain_option_to_parser(parser)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
client_manager = self.app.client_manager
user = _determine_ec2_user(parsed_args, client_manager)
client_manager.identity.ec2.delete(user, parsed_args.access_key)
class ListEC2Creds(lister.Lister):
class ListEC2Creds(command.Lister):
"""List EC2 credentials"""
log = logging.getLogger(__name__ + '.ListEC2Creds')
def get_parser(self, prog_name):
parser = super(ListEC2Creds, self).get_parser(prog_name)
parser.add_argument(
@ -158,7 +146,6 @@ class ListEC2Creds(lister.Lister):
common.add_user_domain_option_to_parser(parser)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
client_manager = self.app.client_manager
user = _determine_ec2_user(parsed_args, client_manager)
@ -174,11 +161,9 @@ class ListEC2Creds(lister.Lister):
) for s in data))
class ShowEC2Creds(show.ShowOne):
class ShowEC2Creds(command.ShowOne):
"""Display EC2 credentials details"""
log = logging.getLogger(__name__ + '.ShowEC2Creds')
def get_parser(self, prog_name):
parser = super(ShowEC2Creds, self).get_parser(prog_name)
parser.add_argument(
@ -194,7 +179,6 @@ class ShowEC2Creds(show.ShowOne):
common.add_user_domain_option_to_parser(parser)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
client_manager = self.app.client_manager
user = _determine_ec2_user(parsed_args, client_manager)

View File

@ -15,14 +15,10 @@
"""Identity v3 Endpoint action implementations"""
import logging
import six
import sys
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.identity import common
@ -34,11 +30,9 @@ def get_service_name(service):
return ''
class CreateEndpoint(show.ShowOne):
class CreateEndpoint(command.ShowOne):
"""Create new endpoint"""
log = logging.getLogger(__name__ + '.CreateEndpoint')
def get_parser(self, prog_name):
parser = super(CreateEndpoint, self).get_parser(prog_name)
parser.add_argument(
@ -78,7 +72,6 @@ class CreateEndpoint(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
service = common.find_service(identity_client, parsed_args.service)
@ -102,8 +95,6 @@ class CreateEndpoint(show.ShowOne):
class DeleteEndpoint(command.Command):
"""Delete endpoint"""
log = logging.getLogger(__name__ + '.DeleteEndpoint')
def get_parser(self, prog_name):
parser = super(DeleteEndpoint, self).get_parser(prog_name)
parser.add_argument(
@ -113,7 +104,6 @@ class DeleteEndpoint(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
endpoint_id = utils.find_resource(identity_client.endpoints,
@ -122,11 +112,9 @@ class DeleteEndpoint(command.Command):
return
class ListEndpoint(lister.Lister):
class ListEndpoint(command.Lister):
"""List endpoints"""
log = logging.getLogger(__name__ + '.ListEndpoint')
def get_parser(self, prog_name):
parser = super(ListEndpoint, self).get_parser(prog_name)
parser.add_argument(
@ -147,7 +135,6 @@ class ListEndpoint(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
columns = ('ID', 'Region', 'Service Name', 'Service Type',
@ -176,8 +163,6 @@ class ListEndpoint(lister.Lister):
class SetEndpoint(command.Command):
"""Set endpoint properties"""
log = logging.getLogger(__name__ + '.SetEndpoint')
def get_parser(self, prog_name):
parser = super(SetEndpoint, self).get_parser(prog_name)
parser.add_argument(
@ -221,7 +206,6 @@ class SetEndpoint(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
endpoint = utils.find_resource(identity_client.endpoints,
@ -256,11 +240,9 @@ class SetEndpoint(command.Command):
return
class ShowEndpoint(show.ShowOne):
class ShowEndpoint(command.ShowOne):
"""Display endpoint details"""
log = logging.getLogger(__name__ + '.ShowEndpoint')
def get_parser(self, prog_name):
parser = super(ShowEndpoint, self).get_parser(prog_name)
parser.add_argument(
@ -270,7 +252,6 @@ class ShowEndpoint(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
endpoint = utils.find_resource(identity_client.endpoints,

View File

@ -14,21 +14,15 @@
"""Identity v3 Protocols actions implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
class CreateProtocol(show.ShowOne):
class CreateProtocol(command.ShowOne):
"""Create new federation protocol"""
log = logging.getLogger(__name__ + 'CreateProtocol')
def get_parser(self, prog_name):
parser = super(CreateProtocol, self).get_parser(prog_name)
parser.add_argument(
@ -50,7 +44,6 @@ class CreateProtocol(show.ShowOne):
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
protocol = identity_client.federation.protocols.create(
@ -71,8 +64,6 @@ class CreateProtocol(show.ShowOne):
class DeleteProtocol(command.Command):
"""Delete federation protocol"""
log = logging.getLogger(__name__ + '.DeleteProtocol')
def get_parser(self, prog_name):
parser = super(DeleteProtocol, self).get_parser(prog_name)
parser.add_argument(
@ -88,7 +79,6 @@ class DeleteProtocol(command.Command):
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
identity_client.federation.protocols.delete(
@ -96,11 +86,9 @@ class DeleteProtocol(command.Command):
return
class ListProtocols(lister.Lister):
class ListProtocols(command.Lister):
"""List federation protocols"""
log = logging.getLogger(__name__ + '.ListProtocols')
def get_parser(self, prog_name):
parser = super(ListProtocols, self).get_parser(prog_name)
parser.add_argument(
@ -126,8 +114,6 @@ class ListProtocols(lister.Lister):
class SetProtocol(command.Command):
"""Set federation protocol properties"""
log = logging.getLogger(__name__ + '.SetProtocol')
def get_parser(self, prog_name):
parser = super(SetProtocol, self).get_parser(prog_name)
parser.add_argument(
@ -166,11 +152,9 @@ class SetProtocol(command.Command):
return zip(*sorted(six.iteritems(info)))
class ShowProtocol(show.ShowOne):
class ShowProtocol(command.ShowOne):
"""Display federation protocol details"""
log = logging.getLogger(__name__ + '.ShowProtocol')
def get_parser(self, prog_name):
parser = super(ShowProtocol, self).get_parser(prog_name)
parser.add_argument(

View File

@ -15,15 +15,12 @@
"""Group action implementations"""
import logging
import six
import sys
from cliff import command
from cliff import lister
from cliff import show
from keystoneauth1 import exceptions as ks_exc
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
from openstackclient.identity import common
@ -32,8 +29,6 @@ from openstackclient.identity import common
class AddUserToGroup(command.Command):
"""Add user to group"""
log = logging.getLogger(__name__ + '.AddUserToGroup')
def get_parser(self, prog_name):
parser = super(AddUserToGroup, self).get_parser(prog_name)
parser.add_argument(
@ -50,7 +45,6 @@ class AddUserToGroup(command.Command):
common.add_user_domain_option_to_parser(parser)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -74,8 +68,6 @@ class AddUserToGroup(command.Command):
class CheckUserInGroup(command.Command):
"""Check user membership in group"""
log = logging.getLogger(__name__ + '.CheckUserInGroup')
def get_parser(self, prog_name):
parser = super(CheckUserInGroup, self).get_parser(prog_name)
parser.add_argument(
@ -92,7 +84,6 @@ class CheckUserInGroup(command.Command):
common.add_user_domain_option_to_parser(parser)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -113,11 +104,9 @@ class CheckUserInGroup(command.Command):
(parsed_args.user, parsed_args.group))
class CreateGroup(show.ShowOne):
class CreateGroup(command.ShowOne):
"""Create new group"""
log = logging.getLogger(__name__ + '.CreateGroup')
def get_parser(self, prog_name):
parser = super(CreateGroup, self).get_parser(prog_name)
parser.add_argument(
@ -142,7 +131,6 @@ class CreateGroup(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -172,8 +160,6 @@ class CreateGroup(show.ShowOne):
class DeleteGroup(command.Command):
"""Delete group(s)"""
log = logging.getLogger(__name__ + '.DeleteGroup')
def get_parser(self, prog_name):
parser = super(DeleteGroup, self).get_parser(prog_name)
parser.add_argument(
@ -188,7 +174,6 @@ class DeleteGroup(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -200,11 +185,9 @@ class DeleteGroup(command.Command):
return
class ListGroup(lister.Lister):
class ListGroup(command.Lister):
"""List groups"""
log = logging.getLogger(__name__ + '.ListGroup')
def get_parser(self, prog_name):
parser = super(ListGroup, self).get_parser(prog_name)
parser.add_argument(
@ -226,7 +209,6 @@ class ListGroup(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -266,8 +248,6 @@ class ListGroup(lister.Lister):
class RemoveUserFromGroup(command.Command):
"""Remove user from group"""
log = logging.getLogger(__name__ + '.RemoveUserFromGroup')
def get_parser(self, prog_name):
parser = super(RemoveUserFromGroup, self).get_parser(prog_name)
parser.add_argument(
@ -284,7 +264,6 @@ class RemoveUserFromGroup(command.Command):
common.add_user_domain_option_to_parser(parser)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -308,8 +287,6 @@ class RemoveUserFromGroup(command.Command):
class SetGroup(command.Command):
"""Set group properties"""
log = logging.getLogger(__name__ + '.SetGroup')
def get_parser(self, prog_name):
parser = super(SetGroup, self).get_parser(prog_name)
parser.add_argument(
@ -331,7 +308,6 @@ class SetGroup(command.Command):
help='New group description')
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
group = common.find_group(identity_client, parsed_args.group,
@ -349,11 +325,9 @@ class SetGroup(command.Command):
return
class ShowGroup(show.ShowOne):
class ShowGroup(command.ShowOne):
"""Display group details"""
log = logging.getLogger(__name__ + '.ShowGroup')
def get_parser(self, prog_name):
parser = super(ShowGroup, self).get_parser(prog_name)
parser.add_argument(
@ -368,7 +342,6 @@ class ShowGroup(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity

View File

@ -13,21 +13,15 @@
"""Identity v3 IdentityProvider action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
class CreateIdentityProvider(show.ShowOne):
class CreateIdentityProvider(command.ShowOne):
"""Create new identity provider"""
log = logging.getLogger(__name__ + '.CreateIdentityProvider')
def get_parser(self, prog_name):
parser = super(CreateIdentityProvider, self).get_parser(prog_name)
parser.add_argument(
@ -70,7 +64,6 @@ class CreateIdentityProvider(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
if parsed_args.remote_id_file:
@ -96,8 +89,6 @@ class CreateIdentityProvider(show.ShowOne):
class DeleteIdentityProvider(command.Command):
"""Delete identity provider"""
log = logging.getLogger(__name__ + '.DeleteIdentityProvider')
def get_parser(self, prog_name):
parser = super(DeleteIdentityProvider, self).get_parser(prog_name)
parser.add_argument(
@ -107,7 +98,6 @@ class DeleteIdentityProvider(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
identity_client.federation.identity_providers.delete(
@ -115,12 +105,9 @@ class DeleteIdentityProvider(command.Command):
return
class ListIdentityProvider(lister.Lister):
class ListIdentityProvider(command.Lister):
"""List identity providers"""
log = logging.getLogger(__name__ + '.ListIdentityProvider')
@utils.log_method(log)
def take_action(self, parsed_args):
columns = ('ID', 'Enabled', 'Description')
identity_client = self.app.client_manager.identity
@ -135,8 +122,6 @@ class ListIdentityProvider(lister.Lister):
class SetIdentityProvider(command.Command):
"""Set identity provider properties"""
log = logging.getLogger(__name__ + '.SetIdentityProvider')
def get_parser(self, prog_name):
parser = super(SetIdentityProvider, self).get_parser(prog_name)
parser.add_argument(
@ -176,7 +161,6 @@ class SetIdentityProvider(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
federation_client = self.app.client_manager.identity.federation
@ -215,11 +199,9 @@ class SetIdentityProvider(command.Command):
return zip(*sorted(six.iteritems(identity_provider._info)))
class ShowIdentityProvider(show.ShowOne):
class ShowIdentityProvider(command.ShowOne):
"""Display identity provider details"""
log = logging.getLogger(__name__ + '.ShowIdentityProvider')
def get_parser(self, prog_name):
parser = super(ShowIdentityProvider, self).get_parser(prog_name)
parser.add_argument(
@ -229,7 +211,6 @@ class ShowIdentityProvider(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
idp = utils.find_resource(

View File

@ -16,13 +16,10 @@
"""Identity v3 federation mapping action implementations"""
import json
import logging
from cliff import command
from cliff import lister
from cliff import show
import six
from openstackclient.common import command
from openstackclient.common import exceptions
from openstackclient.common import utils
@ -79,11 +76,9 @@ class _RulesReader(object):
return rules
class CreateMapping(show.ShowOne, _RulesReader):
class CreateMapping(command.ShowOne, _RulesReader):
"""Create new mapping"""
log = logging.getLogger(__name__ + '.CreateMapping')
def get_parser(self, prog_name):
parser = super(CreateMapping, self).get_parser(prog_name)
parser.add_argument(
@ -99,7 +94,6 @@ class CreateMapping(show.ShowOne, _RulesReader):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
identity_client = self.app.client_manager.identity
rules = self._read_rules(parsed_args.rules)
@ -114,8 +108,6 @@ class CreateMapping(show.ShowOne, _RulesReader):
class DeleteMapping(command.Command):
"""Delete mapping"""
log = logging.getLogger(__name__ + '.DeleteMapping')
def get_parser(self, prog_name):
parser = super(DeleteMapping, self).get_parser(prog_name)
parser.add_argument(
@ -126,19 +118,16 @@ class DeleteMapping(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
identity_client = self.app.client_manager.identity
identity_client.federation.mappings.delete(parsed_args.mapping)
return
class ListMapping(lister.Lister):
class ListMapping(command.Lister):
"""List mappings"""
log = logging.getLogger(__name__ + '.ListMapping')
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
# NOTE(marek-denis): Since rules can be long and tedious I have decided
# to only list ids of the mappings. If somebody wants to check the
# rules, (s)he should show specific ones.
@ -152,8 +141,6 @@ class ListMapping(lister.Lister):
class SetMapping(command.Command, _RulesReader):
"""Set mapping properties"""
log = logging.getLogger(__name__ + '.SetMapping')
def get_parser(self, prog_name):
parser = super(SetMapping, self).get_parser(prog_name)
parser.add_argument(
@ -169,7 +156,6 @@ class SetMapping(command.Command, _RulesReader):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
identity_client = self.app.client_manager.identity
if not parsed_args.rules:
@ -186,11 +172,9 @@ class SetMapping(command.Command, _RulesReader):
return zip(*sorted(six.iteritems(mapping._info)))
class ShowMapping(show.ShowOne):
class ShowMapping(command.ShowOne):
"""Display mapping details"""
log = logging.getLogger(__name__ + '.ShowMapping')
def get_parser(self, prog_name):
parser = super(ShowMapping, self).get_parser(prog_name)
parser.add_argument(
@ -201,7 +185,6 @@ class ShowMapping(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
identity_client = self.app.client_manager.identity
mapping = identity_client.federation.mappings.get(parsed_args.mapping)

View File

@ -15,22 +15,16 @@
"""Identity v3 Policy action implementations"""
import logging
import six
import sys
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
class CreatePolicy(show.ShowOne):
class CreatePolicy(command.ShowOne):
"""Create new policy"""
log = logging.getLogger(__name__ + '.CreatePolicy')
def get_parser(self, prog_name):
parser = super(CreatePolicy, self).get_parser(prog_name)
parser.add_argument(
@ -47,7 +41,6 @@ class CreatePolicy(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
blob = utils.read_blob_file_contents(parsed_args.rules)
@ -64,8 +57,6 @@ class CreatePolicy(show.ShowOne):
class DeletePolicy(command.Command):
"""Delete policy"""
log = logging.getLogger(__name__ + '.DeletePolicy')
def get_parser(self, prog_name):
parser = super(DeletePolicy, self).get_parser(prog_name)
parser.add_argument(
@ -75,18 +66,15 @@ class DeletePolicy(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
identity_client.policies.delete(parsed_args.policy)
return
class ListPolicy(lister.Lister):
class ListPolicy(command.Lister):
"""List policies"""
log = logging.getLogger(__name__ + '.ListPolicy')
def get_parser(self, prog_name):
parser = super(ListPolicy, self).get_parser(prog_name)
parser.add_argument(
@ -97,7 +85,6 @@ class ListPolicy(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
if parsed_args.long:
columns = ('ID', 'Type', 'Blob')
@ -116,8 +103,6 @@ class ListPolicy(lister.Lister):
class SetPolicy(command.Command):
"""Set policy properties"""
log = logging.getLogger(__name__ + '.SetPolicy')
def get_parser(self, prog_name):
parser = super(SetPolicy, self).get_parser(prog_name)
parser.add_argument(
@ -137,7 +122,6 @@ class SetPolicy(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
blob = None
@ -158,11 +142,9 @@ class SetPolicy(command.Command):
return
class ShowPolicy(show.ShowOne):
class ShowPolicy(command.ShowOne):
"""Display policy details"""
log = logging.getLogger(__name__ + '.ShowPolicy')
def get_parser(self, prog_name):
parser = super(ShowPolicy, self).get_parser(prog_name)
parser.add_argument(
@ -172,7 +154,6 @@ class ShowPolicy(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
policy = utils.find_resource(identity_client.policies,

View File

@ -15,25 +15,20 @@
"""Project action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from keystoneauth1 import exceptions as ks_exc
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
from openstackclient.identity import common
class CreateProject(show.ShowOne):
class CreateProject(command.ShowOne):
"""Create new project"""
log = logging.getLogger(__name__ + '.CreateProject')
def get_parser(self, prog_name):
parser = super(CreateProject, self).get_parser(prog_name)
parser.add_argument(
@ -81,7 +76,6 @@ class CreateProject(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -129,8 +123,6 @@ class CreateProject(show.ShowOne):
class DeleteProject(command.Command):
"""Delete project(s)"""
log = logging.getLogger(__name__ + '.DeleteProject')
def get_parser(self, prog_name):
parser = super(DeleteProject, self).get_parser(prog_name)
parser.add_argument(
@ -146,7 +138,6 @@ class DeleteProject(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -165,11 +156,9 @@ class DeleteProject(command.Command):
return
class ListProject(lister.Lister):
class ListProject(command.Lister):
"""List projects"""
log = logging.getLogger(__name__ + '.ListProject')
def get_parser(self, prog_name):
parser = super(ListProject, self).get_parser(prog_name)
parser.add_argument(
@ -190,7 +179,6 @@ class ListProject(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
if parsed_args.long:
@ -227,8 +215,6 @@ class ListProject(lister.Lister):
class SetProject(command.Command):
"""Set project properties"""
log = logging.getLogger(__name__ + '.SetProject')
def get_parser(self, prog_name):
parser = super(SetProject, self).get_parser(prog_name)
parser.add_argument(
@ -271,7 +257,6 @@ class SetProject(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -302,11 +287,9 @@ class SetProject(command.Command):
return
class ShowProject(show.ShowOne):
class ShowProject(command.ShowOne):
"""Display project details"""
log = logging.getLogger(__name__ + '.ShowProject')
def get_parser(self, prog_name):
parser = super(ShowProject, self).get_parser(prog_name)
parser.add_argument(
@ -333,7 +316,6 @@ class ShowProject(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity

View File

@ -13,22 +13,16 @@
"""Identity v3 Region action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
class CreateRegion(show.ShowOne):
class CreateRegion(command.ShowOne):
"""Create new region"""
log = logging.getLogger(__name__ + '.CreateRegion')
def get_parser(self, prog_name):
parser = super(CreateRegion, self).get_parser(prog_name)
# NOTE(stevemar): The API supports an optional region ID, but that
@ -50,7 +44,6 @@ class CreateRegion(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -69,8 +62,6 @@ class CreateRegion(show.ShowOne):
class DeleteRegion(command.Command):
"""Delete region"""
log = logging.getLogger(__name__ + '.DeleteRegion')
def get_parser(self, prog_name):
parser = super(DeleteRegion, self).get_parser(prog_name)
parser.add_argument(
@ -80,7 +71,6 @@ class DeleteRegion(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -88,11 +78,9 @@ class DeleteRegion(command.Command):
return
class ListRegion(lister.Lister):
class ListRegion(command.Lister):
"""List regions"""
log = logging.getLogger(__name__ + '.ListRegion')
def get_parser(self, prog_name):
parser = super(ListRegion, self).get_parser(prog_name)
parser.add_argument(
@ -102,7 +90,6 @@ class ListRegion(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -124,8 +111,6 @@ class ListRegion(lister.Lister):
class SetRegion(command.Command):
"""Set region properties"""
log = logging.getLogger(__name__ + '.SetRegion')
def get_parser(self, prog_name):
parser = super(SetRegion, self).get_parser(prog_name)
parser.add_argument(
@ -145,7 +130,6 @@ class SetRegion(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -162,11 +146,9 @@ class SetRegion(command.Command):
return
class ShowRegion(show.ShowOne):
class ShowRegion(command.ShowOne):
"""Display region details"""
log = logging.getLogger(__name__ + '.ShowRegion')
def get_parser(self, prog_name):
parser = super(ShowRegion, self).get_parser(prog_name)
parser.add_argument(
@ -176,7 +158,6 @@ class ShowRegion(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity

View File

@ -15,15 +15,12 @@
"""Identity v3 Role action implementations"""
import logging
import six
import sys
from cliff import command
from cliff import lister
from cliff import show
from keystoneauth1 import exceptions as ks_exc
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
from openstackclient.identity import common
@ -110,8 +107,6 @@ def _process_identity_and_resource_options(parsed_args,
class AddRole(command.Command):
"""Adds a role to a user or group on a domain or project"""
log = logging.getLogger(__name__ + '.AddRole')
def get_parser(self, prog_name):
parser = super(AddRole, self).get_parser(prog_name)
parser.add_argument(
@ -122,7 +117,6 @@ class AddRole(command.Command):
_add_identity_and_resource_options_to_parser(parser)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -147,11 +141,9 @@ class AddRole(command.Command):
return
class CreateRole(show.ShowOne):
class CreateRole(command.ShowOne):
"""Create new role"""
log = logging.getLogger(__name__ + '.CreateRole')
def get_parser(self, prog_name):
parser = super(CreateRole, self).get_parser(prog_name)
parser.add_argument(
@ -166,7 +158,6 @@ class CreateRole(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -187,8 +178,6 @@ class CreateRole(show.ShowOne):
class DeleteRole(command.Command):
"""Delete role(s)"""
log = logging.getLogger(__name__ + '.DeleteRole')
def get_parser(self, prog_name):
parser = super(DeleteRole, self).get_parser(prog_name)
parser.add_argument(
@ -199,7 +188,6 @@ class DeleteRole(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -212,18 +200,15 @@ class DeleteRole(command.Command):
return
class ListRole(lister.Lister):
class ListRole(command.Lister):
"""List roles"""
log = logging.getLogger(__name__ + '.ListRole')
def get_parser(self, prog_name):
parser = super(ListRole, self).get_parser(prog_name)
_add_identity_and_resource_options_to_parser(parser)
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
identity_client = self.app.client_manager.identity
if parsed_args.user:
@ -318,8 +303,6 @@ class ListRole(lister.Lister):
class RemoveRole(command.Command):
"""Remove role from domain/project : user/group"""
log = logging.getLogger(__name__ + '.RemoveRole')
def get_parser(self, prog_name):
parser = super(RemoveRole, self).get_parser(prog_name)
parser.add_argument(
@ -330,7 +313,6 @@ class RemoveRole(command.Command):
_add_identity_and_resource_options_to_parser(parser)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -357,8 +339,6 @@ class RemoveRole(command.Command):
class SetRole(command.Command):
"""Set role properties"""
log = logging.getLogger(__name__ + '.SetRole')
def get_parser(self, prog_name):
parser = super(SetRole, self).get_parser(prog_name)
parser.add_argument(
@ -373,7 +353,6 @@ class SetRole(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -389,11 +368,9 @@ class SetRole(command.Command):
return
class ShowRole(show.ShowOne):
class ShowRole(command.ShowOne):
"""Display role details"""
log = logging.getLogger(__name__ + '.ShowRole')
def get_parser(self, prog_name):
parser = super(ShowRole, self).get_parser(prog_name)
parser.add_argument(
@ -403,7 +380,6 @@ class ShowRole(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity

View File

@ -13,19 +13,14 @@
"""Identity v3 Assignment action implementations """
import logging
from cliff import lister
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.identity import common
class ListRoleAssignment(lister.Lister):
class ListRoleAssignment(command.Lister):
"""List role assignments"""
log = logging.getLogger(__name__ + '.ListRoleAssignment')
def get_parser(self, prog_name):
parser = super(ListRoleAssignment, self).get_parser(prog_name)
parser.add_argument(
@ -72,7 +67,6 @@ class ListRoleAssignment(lister.Lister):
assignment.project, assignment.domain, assignment.inherited)
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
identity_client = self.app.client_manager.identity
role = None
@ -114,7 +108,6 @@ class ListRoleAssignment(lister.Lister):
)
effective = True if parsed_args.effective else False
self.log.debug('take_action(%s)' % parsed_args)
columns = ('Role', 'User', 'Group', 'Project', 'Domain', 'Inherited')
inherited_to = 'projects' if parsed_args.inherited else None

View File

@ -15,22 +15,16 @@
"""Identity v3 Service action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.identity import common
class CreateService(show.ShowOne):
class CreateService(command.ShowOne):
"""Create new service"""
log = logging.getLogger(__name__ + '.CreateService')
def get_parser(self, prog_name):
parser = super(CreateService, self).get_parser(prog_name)
parser.add_argument(
@ -61,7 +55,6 @@ class CreateService(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -83,8 +76,6 @@ class CreateService(show.ShowOne):
class DeleteService(command.Command):
"""Delete service"""
log = logging.getLogger(__name__ + '.DeleteService')
def get_parser(self, prog_name):
parser = super(DeleteService, self).get_parser(prog_name)
parser.add_argument(
@ -94,7 +85,6 @@ class DeleteService(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -104,11 +94,9 @@ class DeleteService(command.Command):
return
class ListService(lister.Lister):
class ListService(command.Lister):
"""List services"""
log = logging.getLogger(__name__ + '.ListService')
def get_parser(self, prog_name):
parser = super(ListService, self).get_parser(prog_name)
parser.add_argument(
@ -119,7 +107,6 @@ class ListService(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
if parsed_args.long:
@ -136,8 +123,6 @@ class ListService(lister.Lister):
class SetService(command.Command):
"""Set service properties"""
log = logging.getLogger(__name__ + '.SetService')
def get_parser(self, prog_name):
parser = super(SetService, self).get_parser(prog_name)
parser.add_argument(
@ -173,7 +158,6 @@ class SetService(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -205,11 +189,9 @@ class SetService(command.Command):
return
class ShowService(show.ShowOne):
class ShowService(command.ShowOne):
"""Display service details"""
log = logging.getLogger(__name__ + '.ShowService')
def get_parser(self, prog_name):
parser = super(ShowService, self).get_parser(prog_name)
parser.add_argument(
@ -219,7 +201,6 @@ class ShowService(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity

View File

@ -13,22 +13,16 @@
"""Service Provider action implementations"""
import logging
import six
import sys
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
class CreateServiceProvider(show.ShowOne):
class CreateServiceProvider(command.ShowOne):
"""Create new service provider"""
log = logging.getLogger(__name__ + '.CreateServiceProvider')
def get_parser(self, prog_name):
parser = super(CreateServiceProvider, self).get_parser(prog_name)
parser.add_argument(
@ -73,7 +67,6 @@ class CreateServiceProvider(show.ShowOne):
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
service_client = self.app.client_manager.identity
sp = service_client.federation.service_providers.create(
@ -90,8 +83,6 @@ class CreateServiceProvider(show.ShowOne):
class DeleteServiceProvider(command.Command):
"""Delete service provider"""
log = logging.getLogger(__name__ + '.DeleteServiceProvider')
def get_parser(self, prog_name):
parser = super(DeleteServiceProvider, self).get_parser(prog_name)
parser.add_argument(
@ -101,7 +92,6 @@ class DeleteServiceProvider(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
service_client = self.app.client_manager.identity
service_client.federation.service_providers.delete(
@ -109,12 +99,9 @@ class DeleteServiceProvider(command.Command):
return
class ListServiceProvider(lister.Lister):
class ListServiceProvider(command.Lister):
"""List service providers"""
log = logging.getLogger(__name__ + '.ListServiceProvider')
@utils.log_method(log)
def take_action(self, parsed_args):
service_client = self.app.client_manager.identity
data = service_client.federation.service_providers.list()
@ -130,8 +117,6 @@ class ListServiceProvider(lister.Lister):
class SetServiceProvider(command.Command):
"""Set service provider properties"""
log = logging.getLogger(__name__ + '.SetServiceProvider')
def get_parser(self, prog_name):
parser = super(SetServiceProvider, self).get_parser(prog_name)
parser.add_argument(
@ -168,7 +153,6 @@ class SetServiceProvider(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
federation_client = self.app.client_manager.identity.federation
@ -193,11 +177,9 @@ class SetServiceProvider(command.Command):
return zip(*sorted(six.iteritems(service_provider._info)))
class ShowServiceProvider(show.ShowOne):
class ShowServiceProvider(command.ShowOne):
"""Display service provider details"""
log = logging.getLogger(__name__ + '.ShowServiceProvider')
def get_parser(self, prog_name):
parser = super(ShowServiceProvider, self).get_parser(prog_name)
parser.add_argument(
@ -207,7 +189,6 @@ class ShowServiceProvider(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
service_client = self.app.client_manager.identity
service_provider = utils.find_resource(

View File

@ -15,20 +15,16 @@
"""Identity v3 Token action implementations"""
import logging
import six
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.identity import common
class AuthorizeRequestToken(show.ShowOne):
class AuthorizeRequestToken(command.ShowOne):
"""Authorize a request token"""
log = logging.getLogger(__name__ + '.AuthorizeRequestToken')
def get_parser(self, prog_name):
parser = super(AuthorizeRequestToken, self).get_parser(prog_name)
parser.add_argument(
@ -49,7 +45,6 @@ class AuthorizeRequestToken(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
identity_client = self.app.client_manager.identity
# NOTE(stevemar): We want a list of role ids
@ -68,11 +63,9 @@ class AuthorizeRequestToken(show.ShowOne):
return zip(*sorted(six.iteritems(verifier_pin._info)))
class CreateAccessToken(show.ShowOne):
class CreateAccessToken(command.ShowOne):
"""Create an access token"""
log = logging.getLogger(__name__ + '.CreateAccessToken')
def get_parser(self, prog_name):
parser = super(CreateAccessToken, self).get_parser(prog_name)
parser.add_argument(
@ -108,7 +101,6 @@ class CreateAccessToken(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
token_client = self.app.client_manager.identity.oauth1.access_tokens
access_token = token_client.create(
parsed_args.consumer_key, parsed_args.consumer_secret,
@ -117,11 +109,9 @@ class CreateAccessToken(show.ShowOne):
return zip(*sorted(six.iteritems(access_token._info)))
class CreateRequestToken(show.ShowOne):
class CreateRequestToken(command.ShowOne):
"""Create a request token"""
log = logging.getLogger(__name__ + '.CreateRequestToken')
def get_parser(self, prog_name):
parser = super(CreateRequestToken, self).get_parser(prog_name)
parser.add_argument(
@ -151,8 +141,6 @@ class CreateRequestToken(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
identity_client = self.app.client_manager.identity
if parsed_args.domain:
@ -173,16 +161,13 @@ class CreateRequestToken(show.ShowOne):
return zip(*sorted(six.iteritems(request_token._info)))
class IssueToken(show.ShowOne):
class IssueToken(command.ShowOne):
"""Issue new token"""
log = logging.getLogger(__name__ + '.IssueToken')
def get_parser(self, prog_name):
parser = super(IssueToken, self).get_parser(prog_name)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
token = self.app.client_manager.auth_ref.service_catalog.get_token()
if 'tenant_id' in token:

View File

@ -14,22 +14,16 @@
"""Identity v3 Trust action implementations"""
import datetime
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.identity import common
class CreateTrust(show.ShowOne):
class CreateTrust(command.ShowOne):
"""Create new trust"""
log = logging.getLogger(__name__ + '.CreateTrust')
def get_parser(self, prog_name):
parser = super(CreateTrust, self).get_parser(prog_name)
parser.add_argument(
@ -85,7 +79,6 @@ class CreateTrust(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
identity_client = self.app.client_manager.identity
# NOTE(stevemar): Find the two users, project and roles that
@ -138,8 +131,6 @@ class CreateTrust(show.ShowOne):
class DeleteTrust(command.Command):
"""Delete trust(s)"""
log = logging.getLogger(__name__ + '.DeleteTrust')
def get_parser(self, prog_name):
parser = super(DeleteTrust, self).get_parser(prog_name)
parser.add_argument(
@ -151,20 +142,16 @@ class DeleteTrust(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
identity_client = self.app.client_manager.identity
for t in parsed_args.trust:
trust_obj = utils.find_resource(identity_client.trusts, t)
identity_client.trusts.delete(trust_obj.id)
class ListTrust(lister.Lister):
class ListTrust(command.Lister):
"""List trusts"""
log = logging.getLogger(__name__ + '.ListTrust')
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
columns = ('ID', 'Expires At', 'Impersonation', 'Project ID',
'Trustee User ID', 'Trustor User ID')
data = self.app.client_manager.identity.trusts.list()
@ -175,11 +162,9 @@ class ListTrust(lister.Lister):
) for s in data))
class ShowTrust(show.ShowOne):
class ShowTrust(command.ShowOne):
"""Display trust details"""
log = logging.getLogger(__name__ + '.ShowTrust')
def get_parser(self, prog_name):
parser = super(ShowTrust, self).get_parser(prog_name)
parser.add_argument(
@ -190,7 +175,6 @@ class ShowTrust(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
identity_client = self.app.client_manager.identity
trust = utils.find_resource(identity_client.trusts,
parsed_args.trust)

View File

@ -17,10 +17,7 @@ The first step of federated auth is to fetch an unscoped token. From there,
the user can list domains and projects they are allowed to access, and request
a scoped token."""
import logging
from cliff import lister
from openstackclient.common import command
from openstackclient.common import exceptions
from openstackclient.common import utils
@ -43,13 +40,10 @@ def auth_with_unscoped_saml(func):
return _decorated
class ListAccessibleDomains(lister.Lister):
class ListAccessibleDomains(command.Lister):
"""List accessible domains"""
log = logging.getLogger(__name__ + '.ListAccessibleDomains')
@auth_with_unscoped_saml
@utils.log_method(log)
def take_action(self, parsed_args):
columns = ('ID', 'Enabled', 'Name', 'Description')
identity_client = self.app.client_manager.identity
@ -61,13 +55,10 @@ class ListAccessibleDomains(lister.Lister):
) for s in data))
class ListAccessibleProjects(lister.Lister):
class ListAccessibleProjects(command.Lister):
"""List accessible projects"""
log = logging.getLogger(__name__ + '.ListAccessibleProjects')
@auth_with_unscoped_saml
@utils.log_method(log)
def take_action(self, parsed_args):
columns = ('ID', 'Domain ID', 'Enabled', 'Name')
identity_client = self.app.client_manager.identity

View File

@ -16,24 +16,19 @@
"""Identity v3 User action implementations"""
import copy
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from keystoneauth1 import exceptions as ks_exc
from openstackclient.common import command
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
from openstackclient.identity import common
class CreateUser(show.ShowOne):
class CreateUser(command.ShowOne):
"""Create new user"""
log = logging.getLogger(__name__ + '.CreateUser')
def get_parser(self, prog_name):
parser = super(CreateUser, self).get_parser(prog_name)
parser.add_argument(
@ -91,7 +86,6 @@ class CreateUser(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -138,8 +132,6 @@ class CreateUser(show.ShowOne):
class DeleteUser(command.Command):
"""Delete user(s)"""
log = logging.getLogger(__name__ + '.DeleteUser')
def get_parser(self, prog_name):
parser = super(DeleteUser, self).get_parser(prog_name)
parser.add_argument(
@ -155,7 +147,6 @@ class DeleteUser(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -174,11 +165,9 @@ class DeleteUser(command.Command):
return
class ListUser(lister.Lister):
class ListUser(command.Lister):
"""List users"""
log = logging.getLogger(__name__ + '.ListUser')
def get_parser(self, prog_name):
parser = super(ListUser, self).get_parser(prog_name)
parser.add_argument(
@ -205,7 +194,6 @@ class ListUser(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -280,8 +268,6 @@ class ListUser(lister.Lister):
class SetUser(command.Command):
"""Set user properties"""
log = logging.getLogger(__name__ + '.SetUser')
def get_parser(self, prog_name):
parser = super(SetUser, self).get_parser(prog_name)
parser.add_argument(
@ -334,7 +320,6 @@ class SetUser(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -383,8 +368,6 @@ class SetUser(command.Command):
class SetPasswordUser(command.Command):
"""Change current user password"""
log = logging.getLogger(__name__ + '.SetPasswordUser')
def get_parser(self, prog_name):
parser = super(SetPasswordUser, self).get_parser(prog_name)
parser.add_argument(
@ -399,7 +382,6 @@ class SetPasswordUser(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -436,11 +418,9 @@ class SetPasswordUser(command.Command):
identity_client.users.update_password(current_password, password)
class ShowUser(show.ShowOne):
class ShowUser(command.ShowOne):
"""Display user details"""
log = logging.getLogger(__name__ + '.ShowUser')
def get_parser(self, prog_name):
parser = super(ShowUser, self).get_parser(prog_name)
parser.add_argument(
@ -455,7 +435,6 @@ class ShowUser(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity

View File

@ -17,7 +17,6 @@
import argparse
import io
import logging
import os
import six
import sys
@ -27,12 +26,9 @@ if os.name == "nt":
else:
msvcrt = None
from cliff import command
from cliff import lister
from cliff import show
from glanceclient.common import utils as gc_utils
from openstackclient.api import utils as api_utils
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
from openstackclient.i18n import _ # noqa
@ -57,11 +53,9 @@ def _format_visibility(data):
return 'private'
class CreateImage(show.ShowOne):
class CreateImage(command.ShowOne):
"""Create/upload an image"""
log = logging.getLogger(__name__ + ".CreateImage")
def get_parser(self, prog_name):
parser = super(CreateImage, self).get_parser(prog_name)
parser.add_argument(
@ -191,7 +185,6 @@ class CreateImage(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
if getattr(parsed_args, 'owner', None) is not None:
@ -283,8 +276,6 @@ class CreateImage(show.ShowOne):
class DeleteImage(command.Command):
"""Delete image(s)"""
log = logging.getLogger(__name__ + ".DeleteImage")
def get_parser(self, prog_name):
parser = super(DeleteImage, self).get_parser(prog_name)
parser.add_argument(
@ -296,8 +287,6 @@ class DeleteImage(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
for image in parsed_args.images:
image_obj = utils.find_resource(
@ -307,11 +296,9 @@ class DeleteImage(command.Command):
image_client.images.delete(image_obj.id)
class ListImage(lister.Lister):
class ListImage(command.Lister):
"""List available images"""
log = logging.getLogger(__name__ + ".ListImage")
def get_parser(self, prog_name):
parser = super(ListImage, self).get_parser(prog_name)
public_group = parser.add_mutually_exclusive_group()
@ -367,8 +354,6 @@ class ListImage(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
kwargs = {}
@ -452,8 +437,6 @@ class ListImage(lister.Lister):
class SaveImage(command.Command):
"""Save an image locally"""
log = logging.getLogger(__name__ + ".SaveImage")
def get_parser(self, prog_name):
parser = super(SaveImage, self).get_parser(prog_name)
parser.add_argument(
@ -469,8 +452,6 @@ class SaveImage(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
image = utils.find_resource(
image_client.images,
@ -484,8 +465,6 @@ class SaveImage(command.Command):
class SetImage(command.Command):
"""Set image properties"""
log = logging.getLogger(__name__ + ".SetImage")
def get_parser(self, prog_name):
parser = super(SetImage, self).get_parser(prog_name)
parser.add_argument(
@ -624,7 +603,6 @@ class SetImage(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
if getattr(parsed_args, 'owner', None) is not None:
@ -723,11 +701,9 @@ class SetImage(command.Command):
kwargs['data'].close()
class ShowImage(show.ShowOne):
class ShowImage(command.ShowOne):
"""Display image details"""
log = logging.getLogger(__name__ + ".ShowImage")
def get_parser(self, prog_name):
parser = super(ShowImage, self).get_parser(prog_name)
parser.add_argument(
@ -738,8 +714,6 @@ class ShowImage(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
image = utils.find_resource(
image_client.images,

View File

@ -16,15 +16,12 @@
"""Image V2 Action Implementations"""
import argparse
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from glanceclient.common import utils as gc_utils
from openstackclient.api import utils as api_utils
from openstackclient.common import command
from openstackclient.common import exceptions
from openstackclient.common import parseractions
from openstackclient.common import utils
@ -67,11 +64,9 @@ def _format_image(image):
return info
class AddProjectToImage(show.ShowOne):
class AddProjectToImage(command.ShowOne):
"""Associate project with image"""
log = logging.getLogger(__name__ + ".AddProjectToImage")
def get_parser(self, prog_name):
parser = super(AddProjectToImage, self).get_parser(prog_name)
parser.add_argument(
@ -88,8 +83,6 @@ class AddProjectToImage(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
identity_client = self.app.client_manager.identity
@ -109,10 +102,9 @@ class AddProjectToImage(show.ShowOne):
return zip(*sorted(six.iteritems(image_member)))
class CreateImage(show.ShowOne):
class CreateImage(command.ShowOne):
"""Create/upload an image"""
log = logging.getLogger(__name__ + ".CreateImage")
deadopts = ('size', 'location', 'copy-from', 'checksum', 'store')
def get_parser(self, prog_name):
@ -241,7 +233,6 @@ class CreateImage(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
identity_client = self.app.client_manager.identity
image_client = self.app.client_manager.image
@ -366,8 +357,6 @@ class CreateImage(show.ShowOne):
class DeleteImage(command.Command):
"""Delete image(s)"""
log = logging.getLogger(__name__ + ".DeleteImage")
def get_parser(self, prog_name):
parser = super(DeleteImage, self).get_parser(prog_name)
parser.add_argument(
@ -379,8 +368,6 @@ class DeleteImage(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
for image in parsed_args.images:
image_obj = utils.find_resource(
@ -390,11 +377,9 @@ class DeleteImage(command.Command):
image_client.images.delete(image_obj.id)
class ListImage(lister.Lister):
class ListImage(command.Lister):
"""List available images"""
log = logging.getLogger(__name__ + ".ListImage")
def get_parser(self, prog_name):
parser = super(ListImage, self).get_parser(prog_name)
public_group = parser.add_mutually_exclusive_group()
@ -449,8 +434,6 @@ class ListImage(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
kwargs = {}
@ -529,8 +512,6 @@ class ListImage(lister.Lister):
class RemoveProjectImage(command.Command):
"""Disassociate project with image"""
log = logging.getLogger(__name__ + ".RemoveProjectImage")
def get_parser(self, prog_name):
parser = super(RemoveProjectImage, self).get_parser(prog_name)
parser.add_argument(
@ -547,8 +528,6 @@ class RemoveProjectImage(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
identity_client = self.app.client_manager.identity
@ -566,8 +545,6 @@ class RemoveProjectImage(command.Command):
class SaveImage(command.Command):
"""Save an image locally"""
log = logging.getLogger(__name__ + ".SaveImage")
def get_parser(self, prog_name):
parser = super(SaveImage, self).get_parser(prog_name)
parser.add_argument(
@ -583,8 +560,6 @@ class SaveImage(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
image = utils.find_resource(
image_client.images,
@ -598,7 +573,6 @@ class SaveImage(command.Command):
class SetImage(command.Command):
"""Set image properties"""
log = logging.getLogger(__name__ + ".SetImage")
deadopts = ('visibility',)
def get_parser(self, prog_name):
@ -758,7 +732,6 @@ class SetImage(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
identity_client = self.app.client_manager.identity
image_client = self.app.client_manager.image
@ -848,11 +821,9 @@ class SetImage(command.Command):
raise e
class ShowImage(show.ShowOne):
class ShowImage(command.ShowOne):
"""Display image details"""
log = logging.getLogger(__name__ + ".ShowImage")
def get_parser(self, prog_name):
parser = super(ShowImage, self).get_parser(prog_name)
parser.add_argument(
@ -863,8 +834,6 @@ class ShowImage(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
image_client = self.app.client_manager.image
image = utils.find_resource(
image_client.images,

View File

@ -13,12 +13,7 @@
"""Network action implementations"""
import logging
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import exceptions
from openstackclient.common import utils
from openstackclient.identity import common as identity_common
@ -52,11 +47,9 @@ def _get_columns(item):
return tuple(sorted(columns))
class CreateNetwork(show.ShowOne):
class CreateNetwork(command.ShowOne):
"""Create new network"""
log = logging.getLogger(__name__ + '.CreateNetwork')
def get_parser(self, prog_name):
parser = super(CreateNetwork, self).get_parser(prog_name)
parser.add_argument(
@ -111,7 +104,6 @@ class CreateNetwork(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.network
body = self.get_body(parsed_args)
obj = client.create_network(**body)
@ -142,8 +134,6 @@ class CreateNetwork(show.ShowOne):
class DeleteNetwork(command.Command):
"""Delete network(s)"""
log = logging.getLogger(__name__ + '.DeleteNetwork')
def get_parser(self, prog_name):
parser = super(DeleteNetwork, self).get_parser(prog_name)
parser.add_argument(
@ -155,18 +145,15 @@ class DeleteNetwork(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.network
for network in parsed_args.network:
obj = client.find_network(network)
client.delete_network(obj)
class ListNetwork(lister.Lister):
class ListNetwork(command.Lister):
"""List networks"""
log = logging.getLogger(__name__ + '.ListNetwork')
def get_parser(self, prog_name):
parser = super(ListNetwork, self).get_parser(prog_name)
parser.add_argument(
@ -184,7 +171,6 @@ class ListNetwork(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.network
if parsed_args.long:
@ -239,8 +225,6 @@ class ListNetwork(lister.Lister):
class SetNetwork(command.Command):
"""Set network properties"""
log = logging.getLogger(__name__ + '.SetNetwork')
def get_parser(self, prog_name):
parser = super(SetNetwork, self).get_parser(prog_name)
parser.add_argument(
@ -284,7 +268,6 @@ class SetNetwork(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.network
obj = client.find_network(parsed_args.identifier, ignore_missing=False)
@ -302,11 +285,9 @@ class SetNetwork(command.Command):
client.update_network(obj)
class ShowNetwork(show.ShowOne):
class ShowNetwork(command.ShowOne):
"""Show network details"""
log = logging.getLogger(__name__ + '.ShowNetwork')
def get_parser(self, prog_name):
parser = super(ShowNetwork, self).get_parser(prog_name)
parser.add_argument(
@ -317,7 +298,6 @@ class ShowNetwork(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.network
obj = client.find_network(parsed_args.identifier, ignore_missing=False)
columns = _get_columns(obj)

View File

@ -13,16 +13,12 @@
"""Port action implementations"""
import logging
from cliff import command
class DeletePort(command.Command):
"""Delete port(s)"""
log = logging.getLogger(__name__ + '.DeletePort')
def get_parser(self, prog_name):
parser = super(DeletePort, self).get_parser(prog_name)
parser.add_argument(
@ -34,7 +30,6 @@ class DeletePort(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.network
for port in parsed_args.port:

View File

@ -14,12 +14,8 @@
"""Router action implementations"""
import json
import logging
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import exceptions
from openstackclient.common import utils
from openstackclient.identity import common as identity_common
@ -67,11 +63,9 @@ def _get_attrs(client_manager, parsed_args):
return attrs
class CreateRouter(show.ShowOne):
class CreateRouter(command.ShowOne):
"""Create a new router"""
log = logging.getLogger(__name__ + '.CreateRouter')
def get_parser(self, prog_name):
parser = super(CreateRouter, self).get_parser(prog_name)
parser.add_argument(
@ -109,7 +103,6 @@ class CreateRouter(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.network
attrs = _get_attrs(self.app.client_manager, parsed_args)
@ -128,8 +121,6 @@ class CreateRouter(show.ShowOne):
class DeleteRouter(command.Command):
"""Delete router(s)"""
log = logging.getLogger(__name__ + '.DeleteRouter')
def get_parser(self, prog_name):
parser = super(DeleteRouter, self).get_parser(prog_name)
parser.add_argument(
@ -141,18 +132,15 @@ class DeleteRouter(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.network
for router in parsed_args.router:
obj = client.find_router(router)
client.delete_router(obj)
class ListRouter(lister.Lister):
class ListRouter(command.Lister):
"""List routers"""
log = logging.getLogger(__name__ + '.ListRouter')
def get_parser(self, prog_name):
parser = super(ListRouter, self).get_parser(prog_name)
parser.add_argument(
@ -164,7 +152,6 @@ class ListRouter(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.network
columns = (
@ -206,8 +193,6 @@ class ListRouter(lister.Lister):
class SetRouter(command.Command):
"""Set router properties"""
log = logging.getLogger(__name__ + '.SetRouter')
def get_parser(self, prog_name):
parser = super(SetRouter, self).get_parser(prog_name)
parser.add_argument(
@ -262,7 +247,6 @@ class SetRouter(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.network
obj = client.find_router(parsed_args.router, ignore_missing=False)
@ -274,11 +258,9 @@ class SetRouter(command.Command):
client.update_router(obj, **attrs)
class ShowRouter(show.ShowOne):
class ShowRouter(command.ShowOne):
"""Display router details"""
log = logging.getLogger(__name__ + '.ShowRouter')
def get_parser(self, prog_name):
parser = super(ShowRouter, self).get_parser(prog_name)
parser.add_argument(
@ -289,7 +271,6 @@ class ShowRouter(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
client = self.app.client_manager.network
obj = client.find_router(parsed_args.router, ignore_missing=False)
columns = sorted(obj.keys())

View File

@ -13,8 +13,6 @@
"""Subnet action implementations"""
import logging
from cliff import lister
from openstackclient.common import utils
@ -36,8 +34,6 @@ _formatters = {
class ListSubnet(lister.Lister):
"""List subnets"""
log = logging.getLogger(__name__ + '.ListSubnet')
def get_parser(self, prog_name):
parser = super(ListSubnet, self).get_parser(prog_name)
parser.add_argument(
@ -49,8 +45,6 @@ class ListSubnet(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug('take_action(%s)' % parsed_args)
data = self.app.client_manager.network.subnets()
headers = ('ID', 'Name', 'Network', 'Subnet')

View File

@ -13,12 +13,9 @@
"""Account v1 action implementations"""
import logging
from cliff import command
from cliff import show
import six
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
@ -26,8 +23,6 @@ from openstackclient.common import utils
class SetAccount(command.Command):
"""Set account properties"""
log = logging.getLogger(__name__ + '.SetAccount')
def get_parser(self, prog_name):
parser = super(SetAccount, self).get_parser(prog_name)
parser.add_argument(
@ -40,19 +35,15 @@ class SetAccount(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
self.app.client_manager.object_store.account_set(
properties=parsed_args.property,
)
class ShowAccount(show.ShowOne):
class ShowAccount(command.ShowOne):
"""Display account details"""
log = logging.getLogger(__name__ + '.ShowAccount')
@utils.log_method(log)
def take_action(self, parsed_args):
data = self.app.client_manager.object_store.account_show()
if 'properties' in data:
@ -63,8 +54,6 @@ class ShowAccount(show.ShowOne):
class UnsetAccount(command.Command):
"""Unset account properties"""
log = logging.getLogger(__name__ + '.UnsetAccount')
def get_parser(self, prog_name):
parser = super(UnsetAccount, self).get_parser(prog_name)
parser.add_argument(
@ -78,7 +67,6 @@ class UnsetAccount(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
self.app.client_manager.object_store.account_unset(
properties=parsed_args.property,

View File

@ -16,22 +16,16 @@
"""Container v1 action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
class CreateContainer(lister.Lister):
class CreateContainer(command.Lister):
"""Create new container"""
log = logging.getLogger(__name__ + '.CreateContainer')
def get_parser(self, prog_name):
parser = super(CreateContainer, self).get_parser(prog_name)
parser.add_argument(
@ -42,7 +36,6 @@ class CreateContainer(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
results = []
@ -63,8 +56,6 @@ class CreateContainer(lister.Lister):
class DeleteContainer(command.Command):
"""Delete container"""
log = logging.getLogger(__name__ + '.DeleteContainer')
def get_parser(self, prog_name):
parser = super(DeleteContainer, self).get_parser(prog_name)
parser.add_argument(
@ -75,7 +66,6 @@ class DeleteContainer(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
for container in parsed_args.containers:
@ -84,11 +74,9 @@ class DeleteContainer(command.Command):
)
class ListContainer(lister.Lister):
class ListContainer(command.Lister):
"""List containers"""
log = logging.getLogger(__name__ + '.ListContainer')
def get_parser(self, prog_name):
parser = super(ListContainer, self).get_parser(prog_name)
parser.add_argument(
@ -126,7 +114,6 @@ class ListContainer(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
if parsed_args.long:
@ -160,8 +147,6 @@ class ListContainer(lister.Lister):
class SaveContainer(command.Command):
"""Save container contents locally"""
log = logging.getLogger(__name__ + ".SaveContainer")
def get_parser(self, prog_name):
parser = super(SaveContainer, self).get_parser(prog_name)
parser.add_argument(
@ -172,8 +157,6 @@ class SaveContainer(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
self.app.client_manager.object_store.container_save(
container=parsed_args.container,
)
@ -182,8 +165,6 @@ class SaveContainer(command.Command):
class SetContainer(command.Command):
"""Set container properties"""
log = logging.getLogger(__name__ + '.SetContainer')
def get_parser(self, prog_name):
parser = super(SetContainer, self).get_parser(prog_name)
parser.add_argument(
@ -201,7 +182,6 @@ class SetContainer(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
self.app.client_manager.object_store.container_set(
parsed_args.container,
@ -209,11 +189,9 @@ class SetContainer(command.Command):
)
class ShowContainer(show.ShowOne):
class ShowContainer(command.ShowOne):
"""Display container details"""
log = logging.getLogger(__name__ + '.ShowContainer')
def get_parser(self, prog_name):
parser = super(ShowContainer, self).get_parser(prog_name)
parser.add_argument(
@ -223,7 +201,6 @@ class ShowContainer(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
data = self.app.client_manager.object_store.container_show(
@ -238,8 +215,6 @@ class ShowContainer(show.ShowOne):
class UnsetContainer(command.Command):
"""Unset container properties"""
log = logging.getLogger(__name__ + '.UnsetContainer')
def get_parser(self, prog_name):
parser = super(UnsetContainer, self).get_parser(prog_name)
parser.add_argument(
@ -258,7 +233,6 @@ class UnsetContainer(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
self.app.client_manager.object_store.container_unset(
parsed_args.container,

View File

@ -16,22 +16,16 @@
"""Object v1 action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
class CreateObject(lister.Lister):
class CreateObject(command.Lister):
"""Upload object to container"""
log = logging.getLogger(__name__ + '.CreateObject')
def get_parser(self, prog_name):
parser = super(CreateObject, self).get_parser(prog_name)
parser.add_argument(
@ -47,7 +41,6 @@ class CreateObject(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
results = []
@ -69,8 +62,6 @@ class CreateObject(lister.Lister):
class DeleteObject(command.Command):
"""Delete object from container"""
log = logging.getLogger(__name__ + '.DeleteObject')
def get_parser(self, prog_name):
parser = super(DeleteObject, self).get_parser(prog_name)
parser.add_argument(
@ -86,7 +77,6 @@ class DeleteObject(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
for obj in parsed_args.objects:
@ -96,11 +86,9 @@ class DeleteObject(command.Command):
)
class ListObject(lister.Lister):
class ListObject(command.Lister):
"""List objects"""
log = logging.getLogger(__name__ + '.ListObject')
def get_parser(self, prog_name):
parser = super(ListObject, self).get_parser(prog_name)
parser.add_argument(
@ -148,7 +136,6 @@ class ListObject(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
if parsed_args.long:
@ -191,8 +178,6 @@ class ListObject(lister.Lister):
class SaveObject(command.Command):
"""Save object locally"""
log = logging.getLogger(__name__ + ".SaveObject")
def get_parser(self, prog_name):
parser = super(SaveObject, self).get_parser(prog_name)
parser.add_argument(
@ -213,8 +198,6 @@ class SaveObject(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)", parsed_args)
self.app.client_manager.object_store.object_save(
container=parsed_args.container,
object=parsed_args.object,
@ -225,8 +208,6 @@ class SaveObject(command.Command):
class SetObject(command.Command):
"""Set object properties"""
log = logging.getLogger(__name__ + '.SetObject')
def get_parser(self, prog_name):
parser = super(SetObject, self).get_parser(prog_name)
parser.add_argument(
@ -249,7 +230,6 @@ class SetObject(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
self.app.client_manager.object_store.object_set(
parsed_args.container,
@ -258,11 +238,9 @@ class SetObject(command.Command):
)
class ShowObject(show.ShowOne):
class ShowObject(command.ShowOne):
"""Display object details"""
log = logging.getLogger(__name__ + '.ShowObject')
def get_parser(self, prog_name):
parser = super(ShowObject, self).get_parser(prog_name)
parser.add_argument(
@ -277,7 +255,6 @@ class ShowObject(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
data = self.app.client_manager.object_store.object_show(
@ -293,8 +270,6 @@ class ShowObject(show.ShowOne):
class UnsetObject(command.Command):
"""Unset object properties"""
log = logging.getLogger(__name__ + '.UnsetObject')
def get_parser(self, prog_name):
parser = super(UnsetObject, self).get_parser(prog_name)
parser.add_argument(
@ -318,7 +293,6 @@ class UnsetObject(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
self.app.client_manager.object_store.object_unset(
parsed_args.container,

View File

@ -16,21 +16,15 @@
"""Volume v1 Backup action implementations"""
import copy
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import utils
class CreateBackup(show.ShowOne):
class CreateBackup(command.ShowOne):
"""Create new backup"""
log = logging.getLogger(__name__ + '.CreateBackup')
def get_parser(self, prog_name):
parser = super(CreateBackup, self).get_parser(prog_name)
parser.add_argument(
@ -57,7 +51,6 @@ class CreateBackup(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume_id = utils.find_resource(volume_client.volumes,
@ -76,8 +69,6 @@ class CreateBackup(show.ShowOne):
class DeleteBackup(command.Command):
"""Delete backup(s)"""
log = logging.getLogger(__name__ + '.DeleteBackup')
def get_parser(self, prog_name):
parser = super(DeleteBackup, self).get_parser(prog_name)
parser.add_argument(
@ -88,7 +79,6 @@ class DeleteBackup(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
for backup in parsed_args.backups:
@ -97,11 +87,9 @@ class DeleteBackup(command.Command):
volume_client.backups.delete(backup_id)
class ListBackup(lister.Lister):
class ListBackup(command.Lister):
"""List backups"""
log = logging.getLogger(__name__ + '.ListBackup')
def get_parser(self, prog_name):
parser = super(ListBackup, self).get_parser(prog_name)
parser.add_argument(
@ -112,7 +100,6 @@ class ListBackup(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
def _format_volume_id(volume_id):
@ -157,8 +144,6 @@ class ListBackup(lister.Lister):
class RestoreBackup(command.Command):
"""Restore backup"""
log = logging.getLogger(__name__ + '.RestoreBackup')
def get_parser(self, prog_name):
parser = super(RestoreBackup, self).get_parser(prog_name)
parser.add_argument(
@ -171,7 +156,6 @@ class RestoreBackup(command.Command):
help='Volume to restore to (name or ID)')
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
backup = utils.find_resource(volume_client.backups,
@ -182,11 +166,9 @@ class RestoreBackup(command.Command):
destination_volume.id)
class ShowBackup(show.ShowOne):
class ShowBackup(command.ShowOne):
"""Display backup details"""
log = logging.getLogger(__name__ + '.ShowBackup')
def get_parser(self, prog_name):
parser = super(ShowBackup, self).get_parser(prog_name)
parser.add_argument(
@ -195,7 +177,6 @@ class ShowBackup(show.ShowOne):
help='Backup to display (ID only)')
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
backup = utils.find_resource(volume_client.backups,

View File

@ -15,13 +15,9 @@
"""Volume v1 QoS action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
@ -29,8 +25,6 @@ from openstackclient.common import utils
class AssociateQos(command.Command):
"""Associate a QoS specification to a volume type"""
log = logging.getLogger(__name__ + '.AssociateQos')
def get_parser(self, prog_name):
parser = super(AssociateQos, self).get_parser(prog_name)
parser.add_argument(
@ -45,7 +39,6 @@ class AssociateQos(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs,
@ -56,11 +49,9 @@ class AssociateQos(command.Command):
volume_client.qos_specs.associate(qos_spec.id, volume_type.id)
class CreateQos(show.ShowOne):
class CreateQos(command.ShowOne):
"""Create new QoS specification"""
log = logging.getLogger(__name__ + '.CreateQos')
def get_parser(self, prog_name):
parser = super(CreateQos, self).get_parser(prog_name)
parser.add_argument(
@ -86,7 +77,6 @@ class CreateQos(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
specs = {}
@ -103,8 +93,6 @@ class CreateQos(show.ShowOne):
class DeleteQos(command.Command):
"""Delete QoS specification"""
log = logging.getLogger(__name__ + '.DeleteQos')
def get_parser(self, prog_name):
parser = super(DeleteQos, self).get_parser(prog_name)
parser.add_argument(
@ -115,7 +103,6 @@ class DeleteQos(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
for qos in parsed_args.qos_specs:
@ -126,8 +113,6 @@ class DeleteQos(command.Command):
class DisassociateQos(command.Command):
"""Disassociate a QoS specification from a volume type"""
log = logging.getLogger(__name__ + '.DisassociateQos')
def get_parser(self, prog_name):
parser = super(DisassociateQos, self).get_parser(prog_name)
parser.add_argument(
@ -150,7 +135,6 @@ class DisassociateQos(command.Command):
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs,
@ -164,12 +148,9 @@ class DisassociateQos(command.Command):
volume_client.qos_specs.disassociate_all(qos_spec.id)
class ListQos(lister.Lister):
class ListQos(command.Lister):
"""List QoS specifications"""
log = logging.getLogger(__name__ + '.ListQos')
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
qos_specs_list = volume_client.qos_specs.list()
@ -195,8 +176,6 @@ class ListQos(lister.Lister):
class SetQos(command.Command):
"""Set QoS specification properties"""
log = logging.getLogger(__name__ + '.SetQos')
def get_parser(self, prog_name):
parser = super(SetQos, self).get_parser(prog_name)
parser.add_argument(
@ -213,7 +192,6 @@ class SetQos(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs,
@ -226,11 +204,9 @@ class SetQos(command.Command):
self.app.log.error("No changes requested\n")
class ShowQos(show.ShowOne):
class ShowQos(command.ShowOne):
"""Display QoS specification details"""
log = logging.getLogger(__name__ + '.ShowQos')
def get_parser(self, prog_name):
parser = super(ShowQos, self).get_parser(prog_name)
parser.add_argument(
@ -240,7 +216,6 @@ class ShowQos(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs,
@ -261,8 +236,6 @@ class ShowQos(show.ShowOne):
class UnsetQos(command.Command):
"""Unset QoS specification properties"""
log = logging.getLogger(__name__ + '.SetQos')
def get_parser(self, prog_name):
parser = super(UnsetQos, self).get_parser(prog_name)
parser.add_argument(
@ -280,7 +253,6 @@ class UnsetQos(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs,

View File

@ -16,22 +16,16 @@
"""Volume v1 Snapshot action implementations"""
import copy
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
class CreateSnapshot(show.ShowOne):
class CreateSnapshot(command.ShowOne):
"""Create new snapshot"""
log = logging.getLogger(__name__ + '.CreateSnapshot')
def get_parser(self, prog_name):
parser = super(CreateSnapshot, self).get_parser(prog_name)
parser.add_argument(
@ -59,7 +53,6 @@ class CreateSnapshot(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume_id = utils.find_resource(volume_client.volumes,
@ -81,8 +74,6 @@ class CreateSnapshot(show.ShowOne):
class DeleteSnapshot(command.Command):
"""Delete snapshot(s)"""
log = logging.getLogger(__name__ + '.DeleteSnapshot')
def get_parser(self, prog_name):
parser = super(DeleteSnapshot, self).get_parser(prog_name)
parser.add_argument(
@ -93,7 +84,6 @@ class DeleteSnapshot(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
for snapshot in parsed_args.snapshots:
@ -102,11 +92,9 @@ class DeleteSnapshot(command.Command):
volume_client.volume_snapshots.delete(snapshot_id)
class ListSnapshot(lister.Lister):
class ListSnapshot(command.Lister):
"""List snapshots"""
log = logging.getLogger(__name__ + '.ListSnapshot')
def get_parser(self, prog_name):
parser = super(ListSnapshot, self).get_parser(prog_name)
parser.add_argument(
@ -123,7 +111,6 @@ class ListSnapshot(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
def _format_volume_id(volume_id):
@ -179,8 +166,6 @@ class ListSnapshot(lister.Lister):
class SetSnapshot(command.Command):
"""Set snapshot properties"""
log = logging.getLogger(__name__ + '.SetSnapshot')
def get_parser(self, prog_name):
parser = super(SetSnapshot, self).get_parser(prog_name)
parser.add_argument(
@ -204,7 +189,6 @@ class SetSnapshot(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
snapshot = utils.find_resource(volume_client.volume_snapshots,
@ -227,11 +211,9 @@ class SetSnapshot(command.Command):
snapshot.update(**kwargs)
class ShowSnapshot(show.ShowOne):
class ShowSnapshot(command.ShowOne):
"""Display snapshot details"""
log = logging.getLogger(__name__ + '.ShowSnapshot')
def get_parser(self, prog_name):
parser = super(ShowSnapshot, self).get_parser(prog_name)
parser.add_argument(
@ -240,7 +222,6 @@ class ShowSnapshot(show.ShowOne):
help='Snapshot to display (name or ID)')
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
snapshot = utils.find_resource(volume_client.volume_snapshots,
@ -256,8 +237,6 @@ class ShowSnapshot(show.ShowOne):
class UnsetSnapshot(command.Command):
"""Unset snapshot properties"""
log = logging.getLogger(__name__ + '.UnsetSnapshot')
def get_parser(self, prog_name):
parser = super(UnsetSnapshot, self).get_parser(prog_name)
parser.add_argument(
@ -276,7 +255,6 @@ class UnsetSnapshot(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
snapshot = utils.find_resource(

View File

@ -16,22 +16,16 @@
"""Volume v1 Volume action implementations"""
import argparse
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
class CreateVolume(show.ShowOne):
class CreateVolume(command.ShowOne):
"""Create new volume"""
log = logging.getLogger(__name__ + '.CreateVolume')
def get_parser(self, prog_name):
parser = super(CreateVolume, self).get_parser(prog_name)
parser.add_argument(
@ -102,7 +96,6 @@ class CreateVolume(show.ShowOne):
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
identity_client = self.app.client_manager.identity
@ -166,8 +159,6 @@ class CreateVolume(show.ShowOne):
class DeleteVolume(command.Command):
"""Delete volume(s)"""
log = logging.getLogger(__name__ + '.DeleteVolume')
def get_parser(self, prog_name):
parser = super(DeleteVolume, self).get_parser(prog_name)
parser.add_argument(
@ -186,7 +177,6 @@ class DeleteVolume(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
for volume in parsed_args.volumes:
@ -198,11 +188,9 @@ class DeleteVolume(command.Command):
volume_client.volumes.delete(volume_obj.id)
class ListVolume(lister.Lister):
class ListVolume(command.Lister):
"""List volumes"""
log = logging.getLogger(__name__ + '.ListVolume')
def get_parser(self, prog_name):
parser = super(ListVolume, self).get_parser(prog_name)
parser.add_argument(
@ -229,7 +217,6 @@ class ListVolume(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
@ -316,8 +303,6 @@ class ListVolume(lister.Lister):
class SetVolume(command.Command):
"""Set volume properties"""
log = logging.getLogger(__name__ + '.SetVolume')
def get_parser(self, prog_name):
parser = super(SetVolume, self).get_parser(prog_name)
parser.add_argument(
@ -350,7 +335,6 @@ class SetVolume(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume = utils.find_resource(volume_client.volumes, parsed_args.volume)
@ -382,11 +366,9 @@ class SetVolume(command.Command):
self.app.log.error("No changes requested\n")
class ShowVolume(show.ShowOne):
class ShowVolume(command.ShowOne):
"""Show volume details"""
log = logging.getLogger(__name__ + '.ShowVolume')
def get_parser(self, prog_name):
parser = super(ShowVolume, self).get_parser(prog_name)
parser.add_argument(
@ -396,7 +378,6 @@ class ShowVolume(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume = utils.find_resource(volume_client.volumes, parsed_args.volume)
@ -418,8 +399,6 @@ class ShowVolume(show.ShowOne):
class UnsetVolume(command.Command):
"""Unset volume properties"""
log = logging.getLogger(__name__ + '.UnsetVolume')
def get_parser(self, prog_name):
parser = super(UnsetVolume, self).get_parser(prog_name)
parser.add_argument(
@ -438,7 +417,6 @@ class UnsetVolume(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume = utils.find_resource(

View File

@ -15,22 +15,16 @@
"""Volume v1 Type action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
class CreateVolumeType(show.ShowOne):
class CreateVolumeType(command.ShowOne):
"""Create new volume type"""
log = logging.getLogger(__name__ + '.CreateVolumeType')
def get_parser(self, prog_name):
parser = super(CreateVolumeType, self).get_parser(prog_name)
parser.add_argument(
@ -47,7 +41,6 @@ class CreateVolumeType(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume_type = volume_client.volume_types.create(parsed_args.name)
@ -64,8 +57,6 @@ class CreateVolumeType(show.ShowOne):
class DeleteVolumeType(command.Command):
"""Delete volume type"""
log = logging.getLogger(__name__ + '.DeleteVolumeType')
def get_parser(self, prog_name):
parser = super(DeleteVolumeType, self).get_parser(prog_name)
parser.add_argument(
@ -75,7 +66,6 @@ class DeleteVolumeType(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume_type_id = utils.find_resource(
@ -83,11 +73,9 @@ class DeleteVolumeType(command.Command):
volume_client.volume_types.delete(volume_type_id)
class ListVolumeType(lister.Lister):
class ListVolumeType(command.Lister):
"""List volume types"""
log = logging.getLogger(__name__ + '.ListVolumeType')
def get_parser(self, prog_name):
parser = super(ListVolumeType, self).get_parser(prog_name)
parser.add_argument(
@ -97,7 +85,6 @@ class ListVolumeType(lister.Lister):
help='List additional fields in output')
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
if parsed_args.long:
columns = ('ID', 'Name', 'Extra Specs')
@ -116,8 +103,6 @@ class ListVolumeType(lister.Lister):
class SetVolumeType(command.Command):
"""Set volume type properties"""
log = logging.getLogger(__name__ + '.SetVolumeType')
def get_parser(self, prog_name):
parser = super(SetVolumeType, self).get_parser(prog_name)
parser.add_argument(
@ -134,7 +119,6 @@ class SetVolumeType(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume_type = utils.find_resource(
@ -147,8 +131,6 @@ class SetVolumeType(command.Command):
class UnsetVolumeType(command.Command):
"""Unset volume type properties"""
log = logging.getLogger(__name__ + '.UnsetVolumeType')
def get_parser(self, prog_name):
parser = super(UnsetVolumeType, self).get_parser(prog_name)
parser.add_argument(
@ -167,7 +149,6 @@ class UnsetVolumeType(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume_type = utils.find_resource(
@ -181,11 +162,9 @@ class UnsetVolumeType(command.Command):
self.app.log.error("No changes requested\n")
class ShowVolumeType(show.ShowOne):
class ShowVolumeType(command.ShowOne):
"""Display volume type details"""
log = logging.getLogger(__name__ + ".ShowVolumeType")
def get_parser(self, prog_name):
parser = super(ShowVolumeType, self).get_parser(prog_name)
parser.add_argument(
@ -196,7 +175,6 @@ class ShowVolumeType(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
volume_client = self.app.client_manager.volume
volume_type = utils.find_resource(
volume_client.volume_types, parsed_args.volume_type)

View File

@ -15,21 +15,16 @@
"""Volume v2 Backup action implementations"""
import copy
import logging
from cliff import command
from cliff import lister
from cliff import show
import six
from openstackclient.common import command
from openstackclient.common import utils
class CreateBackup(show.ShowOne):
class CreateBackup(command.ShowOne):
"""Create new backup"""
log = logging.getLogger(__name__ + ".CreateBackup")
def get_parser(self, prog_name):
parser = super(CreateBackup, self).get_parser(prog_name)
parser.add_argument(
@ -56,7 +51,6 @@ class CreateBackup(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
volume_client = self.app.client_manager.volume
volume_id = utils.find_resource(
volume_client.volumes, parsed_args.volume).id
@ -73,8 +67,6 @@ class CreateBackup(show.ShowOne):
class DeleteBackup(command.Command):
"""Delete backup(s)"""
log = logging.getLogger(__name__ + ".DeleteBackup")
def get_parser(self, prog_name):
parser = super(DeleteBackup, self).get_parser(prog_name)
parser.add_argument(
@ -86,7 +78,6 @@ class DeleteBackup(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
volume_client = self.app.client_manager.volume
for backup in parsed_args.backups:
backup_id = utils.find_resource(
@ -94,11 +85,9 @@ class DeleteBackup(command.Command):
volume_client.backups.delete(backup_id)
class ListBackup(lister.Lister):
class ListBackup(command.Lister):
"""List backups"""
log = logging.getLogger(__name__ + ".ListBackup")
def get_parser(self, prog_name):
parser = super(ListBackup, self).get_parser(prog_name)
parser.add_argument(
@ -110,7 +99,6 @@ class ListBackup(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
def _format_volume_id(volume_id):
"""Return a volume name if available
@ -151,11 +139,9 @@ class ListBackup(lister.Lister):
) for s in data))
class RestoreBackup(show.ShowOne):
class RestoreBackup(command.ShowOne):
"""Restore backup"""
log = logging.getLogger(__name__ + ".RestoreBackup")
def get_parser(self, prog_name):
parser = super(RestoreBackup, self).get_parser(prog_name)
parser.add_argument(
@ -171,7 +157,6 @@ class RestoreBackup(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
volume_client = self.app.client_manager.volume
backup = utils.find_resource(volume_client.backups, parsed_args.backup)
destination_volume = utils.find_resource(volume_client.volumes,
@ -179,11 +164,9 @@ class RestoreBackup(show.ShowOne):
return volume_client.restores.restore(backup.id, destination_volume.id)
class ShowBackup(show.ShowOne):
class ShowBackup(command.ShowOne):
"""Display backup details"""
log = logging.getLogger(__name__ + ".ShowBackup")
def get_parser(self, prog_name):
parser = super(ShowBackup, self).get_parser(prog_name)
parser.add_argument(
@ -193,7 +176,6 @@ class ShowBackup(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
volume_client = self.app.client_manager.volume
backup = utils.find_resource(volume_client.backups,
parsed_args.backup)

View File

@ -15,13 +15,9 @@
"""Volume v2 QoS action implementations"""
import logging
import six
from cliff import command
from cliff import lister
from cliff import show
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
@ -29,8 +25,6 @@ from openstackclient.common import utils
class AssociateQos(command.Command):
"""Associate a QoS specification to a volume type"""
log = logging.getLogger(__name__ + '.AssociateQos')
def get_parser(self, prog_name):
parser = super(AssociateQos, self).get_parser(prog_name)
parser.add_argument(
@ -45,7 +39,6 @@ class AssociateQos(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs,
@ -56,11 +49,9 @@ class AssociateQos(command.Command):
volume_client.qos_specs.associate(qos_spec.id, volume_type.id)
class CreateQos(show.ShowOne):
class CreateQos(command.ShowOne):
"""Create new QoS specification"""
log = logging.getLogger(__name__ + '.CreateQos')
def get_parser(self, prog_name):
parser = super(CreateQos, self).get_parser(prog_name)
parser.add_argument(
@ -86,7 +77,6 @@ class CreateQos(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
specs = {}
@ -103,8 +93,6 @@ class CreateQos(show.ShowOne):
class DeleteQos(command.Command):
"""Delete QoS specification"""
log = logging.getLogger(__name__ + '.DeleteQos')
def get_parser(self, prog_name):
parser = super(DeleteQos, self).get_parser(prog_name)
parser.add_argument(
@ -115,7 +103,6 @@ class DeleteQos(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
for qos in parsed_args.qos_specs:
@ -126,8 +113,6 @@ class DeleteQos(command.Command):
class DisassociateQos(command.Command):
"""Disassociate a QoS specification from a volume type"""
log = logging.getLogger(__name__ + '.DisassociateQos')
def get_parser(self, prog_name):
parser = super(DisassociateQos, self).get_parser(prog_name)
parser.add_argument(
@ -150,7 +135,6 @@ class DisassociateQos(command.Command):
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs,
@ -164,12 +148,9 @@ class DisassociateQos(command.Command):
volume_client.qos_specs.disassociate_all(qos_spec.id)
class ListQos(lister.Lister):
class ListQos(command.Lister):
"""List QoS specifications"""
log = logging.getLogger(__name__ + '.ListQos')
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
qos_specs_list = volume_client.qos_specs.list()
@ -195,8 +176,6 @@ class ListQos(lister.Lister):
class SetQos(command.Command):
"""Set QoS specification properties"""
log = logging.getLogger(__name__ + '.SetQos')
def get_parser(self, prog_name):
parser = super(SetQos, self).get_parser(prog_name)
parser.add_argument(
@ -213,7 +192,6 @@ class SetQos(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs,
@ -226,11 +204,9 @@ class SetQos(command.Command):
self.app.log.error("No changes requested\n")
class ShowQos(show.ShowOne):
class ShowQos(command.ShowOne):
"""Display QoS specification details"""
log = logging.getLogger(__name__ + '.ShowQos')
def get_parser(self, prog_name):
parser = super(ShowQos, self).get_parser(prog_name)
parser.add_argument(
@ -240,7 +216,6 @@ class ShowQos(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs,
@ -261,8 +236,6 @@ class ShowQos(show.ShowOne):
class UnsetQos(command.Command):
"""Unset QoS specification properties"""
log = logging.getLogger(__name__ + '.SetQos')
def get_parser(self, prog_name):
parser = super(UnsetQos, self).get_parser(prog_name)
parser.add_argument(
@ -280,7 +253,6 @@ class UnsetQos(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
qos_spec = utils.find_resource(volume_client.qos_specs,

View File

@ -15,22 +15,17 @@
"""Volume v2 snapshot action implementations"""
import copy
import logging
from cliff import command
from cliff import lister
from cliff import show
import six
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
class CreateSnapshot(show.ShowOne):
class CreateSnapshot(command.ShowOne):
"""Create new snapshot"""
log = logging.getLogger(__name__ + ".CreateSnapshot")
def get_parser(self, prog_name):
parser = super(CreateSnapshot, self).get_parser(prog_name)
parser.add_argument(
@ -59,7 +54,6 @@ class CreateSnapshot(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
volume_client = self.app.client_manager.volume
volume_id = utils.find_resource(
volume_client.volumes, parsed_args.volume).id
@ -78,8 +72,6 @@ class CreateSnapshot(show.ShowOne):
class DeleteSnapshot(command.Command):
"""Delete volume snapshot(s)"""
log = logging.getLogger(__name__ + ".DeleteSnapshot")
def get_parser(self, prog_name):
parser = super(DeleteSnapshot, self).get_parser(prog_name)
parser.add_argument(
@ -91,7 +83,6 @@ class DeleteSnapshot(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
volume_client = self.app.client_manager.volume
for snapshot in parsed_args.snapshots:
snapshot_id = utils.find_resource(
@ -99,11 +90,9 @@ class DeleteSnapshot(command.Command):
volume_client.volume_snapshots.delete(snapshot_id)
class ListSnapshot(lister.Lister):
class ListSnapshot(command.Lister):
"""List snapshots"""
log = logging.getLogger(__name__ + ".ListSnapshot")
def get_parser(self, prog_name):
parser = super(ListSnapshot, self).get_parser(prog_name)
parser.add_argument(
@ -121,7 +110,6 @@ class ListSnapshot(lister.Lister):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
def _format_volume_id(volume_id):
"""Return a volume name if available
@ -171,8 +159,6 @@ class ListSnapshot(lister.Lister):
class SetSnapshot(command.Command):
"""Set snapshot properties"""
log = logging.getLogger(__name__ + '.SetSnapshot')
def get_parser(self, prog_name):
parser = super(SetSnapshot, self).get_parser(prog_name)
parser.add_argument(
@ -196,7 +182,6 @@ class SetSnapshot(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
snapshot = utils.find_resource(volume_client.volume_snapshots,
@ -218,11 +203,9 @@ class SetSnapshot(command.Command):
volume_client.volume_snapshots.update(snapshot.id, **kwargs)
class ShowSnapshot(show.ShowOne):
class ShowSnapshot(command.ShowOne):
"""Display snapshot details"""
log = logging.getLogger(__name__ + ".ShowSnapshot")
def get_parser(self, prog_name):
parser = super(ShowSnapshot, self).get_parser(prog_name)
parser.add_argument(
@ -233,7 +216,6 @@ class ShowSnapshot(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
volume_client = self.app.client_manager.volume
snapshot = utils.find_resource(
volume_client.volume_snapshots, parsed_args.snapshot)
@ -246,8 +228,6 @@ class ShowSnapshot(show.ShowOne):
class UnsetSnapshot(command.Command):
"""Unset snapshot properties"""
log = logging.getLogger(__name__ + '.UnsetSnapshot')
def get_parser(self, prog_name):
parser = super(UnsetSnapshot, self).get_parser(prog_name)
parser.add_argument(
@ -265,7 +245,6 @@ class UnsetSnapshot(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
snapshot = utils.find_resource(

View File

@ -15,23 +15,18 @@
"""Volume V2 Volume action implementations"""
import copy
import logging
from cliff import command
from cliff import lister
from cliff import show
import six
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
from openstackclient.identity import common as identity_common
class CreateVolume(show.ShowOne):
class CreateVolume(command.ShowOne):
"""Create new volume"""
log = logging.getLogger(__name__ + ".CreateVolume")
def get_parser(self, prog_name):
parser = super(CreateVolume, self).get_parser(prog_name)
parser.add_argument(
@ -96,8 +91,6 @@ class CreateVolume(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
identity_client = self.app.client_manager.identity
volume_client = self.app.client_manager.volume
image_client = self.app.client_manager.image
@ -159,8 +152,6 @@ class CreateVolume(show.ShowOne):
class DeleteVolume(command.Command):
"""Delete volume(s)"""
log = logging.getLogger(__name__ + ".DeleteVolume")
def get_parser(self, prog_name):
parser = super(DeleteVolume, self).get_parser(prog_name)
parser.add_argument(
@ -180,7 +171,6 @@ class DeleteVolume(command.Command):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
volume_client = self.app.client_manager.volume
for volume in parsed_args.volumes:
volume_obj = utils.find_resource(
@ -191,11 +181,9 @@ class DeleteVolume(command.Command):
volume_client.volumes.delete(volume_obj.id)
class ListVolume(lister.Lister):
class ListVolume(command.Lister):
"""List volumes"""
log = logging.getLogger(__name__ + '.ListVolume')
def get_parser(self, prog_name):
parser = super(ListVolume, self).get_parser(prog_name)
parser.add_argument(
@ -234,7 +222,6 @@ class ListVolume(lister.Lister):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
@ -328,8 +315,6 @@ class ListVolume(lister.Lister):
class SetVolume(command.Command):
"""Set volume properties"""
log = logging.getLogger(__name__ + '.SetVolume')
def get_parser(self, prog_name):
parser = super(SetVolume, self).get_parser(prog_name)
parser.add_argument(
@ -362,7 +347,6 @@ class SetVolume(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume = utils.find_resource(volume_client.volumes, parsed_args.volume)
@ -394,11 +378,9 @@ class SetVolume(command.Command):
self.app.log.error("No changes requested\n")
class ShowVolume(show.ShowOne):
class ShowVolume(command.ShowOne):
"""Display volume details"""
log = logging.getLogger(__name__ + '.ShowVolume')
def get_parser(self, prog_name):
parser = super(ShowVolume, self).get_parser(prog_name)
parser.add_argument(
@ -408,7 +390,6 @@ class ShowVolume(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume = utils.find_resource(volume_client.volumes, parsed_args.volume)
@ -421,8 +402,6 @@ class ShowVolume(show.ShowOne):
class UnsetVolume(command.Command):
"""Unset volume properties"""
log = logging.getLogger(__name__ + '.UnsetVolume')
def get_parser(self, prog_name):
parser = super(UnsetVolume, self).get_parser(prog_name)
parser.add_argument(
@ -441,7 +420,6 @@ class UnsetVolume(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume = utils.find_resource(

View File

@ -14,22 +14,16 @@
"""Volume v2 Type action implementations"""
import logging
from cliff import command
from cliff import lister
from cliff import show
import six
from openstackclient.common import command
from openstackclient.common import parseractions
from openstackclient.common import utils
class CreateVolumeType(show.ShowOne):
class CreateVolumeType(command.ShowOne):
"""Create new volume type"""
log = logging.getLogger(__name__ + ".CreateVolumeType")
def get_parser(self, prog_name):
parser = super(CreateVolumeType, self).get_parser(prog_name)
parser.add_argument(
@ -66,7 +60,6 @@ class CreateVolumeType(show.ShowOne):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
@ -93,8 +86,6 @@ class CreateVolumeType(show.ShowOne):
class DeleteVolumeType(command.Command):
"""Delete volume type"""
log = logging.getLogger(__name__ + ".DeleteVolumeType")
def get_parser(self, prog_name):
parser = super(DeleteVolumeType, self).get_parser(prog_name)
parser.add_argument(
@ -105,18 +96,15 @@ class DeleteVolumeType(command.Command):
return parser
def take_action(self, parsed_args):
self.log.info("take_action: (%s)", parsed_args)
volume_client = self.app.client_manager.volume
volume_type = utils.find_resource(
volume_client.volume_types, parsed_args.volume_type)
volume_client.volume_types.delete(volume_type.id)
class ListVolumeType(lister.Lister):
class ListVolumeType(command.Lister):
"""List volume types"""
log = logging.getLogger(__name__ + '.ListVolumeType')
def get_parser(self, prog_name):
parser = super(ListVolumeType, self).get_parser(prog_name)
parser.add_argument(
@ -126,7 +114,6 @@ class ListVolumeType(lister.Lister):
help='List additional fields in output')
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
if parsed_args.long:
columns = ['ID', 'Name', 'Description', 'Extra Specs']
@ -145,8 +132,6 @@ class ListVolumeType(lister.Lister):
class SetVolumeType(command.Command):
"""Set volume type properties"""
log = logging.getLogger(__name__ + '.SetVolumeType')
def get_parser(self, prog_name):
parser = super(SetVolumeType, self).get_parser(prog_name)
parser.add_argument(
@ -173,7 +158,6 @@ class SetVolumeType(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume_type = utils.find_resource(
@ -201,11 +185,9 @@ class SetVolumeType(command.Command):
volume_type.set_keys(parsed_args.property)
class ShowVolumeType(show.ShowOne):
class ShowVolumeType(command.ShowOne):
"""Display volume type details"""
log = logging.getLogger(__name__ + ".ShowVolumeType")
def get_parser(self, prog_name):
parser = super(ShowVolumeType, self).get_parser(prog_name)
parser.add_argument(
@ -216,7 +198,6 @@ class ShowVolumeType(show.ShowOne):
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
volume_client = self.app.client_manager.volume
volume_type = utils.find_resource(
volume_client.volume_types, parsed_args.volume_type)
@ -228,8 +209,6 @@ class ShowVolumeType(show.ShowOne):
class UnsetVolumeType(command.Command):
"""Unset volume type properties"""
log = logging.getLogger(__name__ + '.UnsetVolumeType')
def get_parser(self, prog_name):
parser = super(UnsetVolumeType, self).get_parser(prog_name)
parser.add_argument(
@ -247,7 +226,6 @@ class UnsetVolumeType(command.Command):
)
return parser
@utils.log_method(log)
def take_action(self, parsed_args):
volume_client = self.app.client_manager.volume
volume_type = utils.find_resource(