refactor: Merge all debug logging at the beginning of take_action
After refactoring made in this series of patches, all neutronclient commands implements take_action(). Debug logging at the beginning of take_action can be implemented in a signle place. Change-Id: Ic766c0bd0f203b2408dc459247804c7d9290b0d5
This commit is contained in:
@@ -397,6 +397,10 @@ class NeutronCommand(command.Command):
|
||||
shadow_resource = None
|
||||
parent_id = None
|
||||
|
||||
def run(self, parsed_args):
|
||||
self.log.debug('run(%s)', parsed_args)
|
||||
return super(NeutronCommand, self).run(parsed_args)
|
||||
|
||||
@property
|
||||
def cmd_resource(self):
|
||||
if self.shadow_resource:
|
||||
@@ -466,7 +470,6 @@ class CreateCommand(NeutronCommand, show.ShowOne):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
self.set_extra_attrs(parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
_extra_values = parse_args_to_dict(self.values_specs)
|
||||
@@ -512,7 +515,6 @@ class UpdateCommand(NeutronCommand):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)', parsed_args)
|
||||
self.set_extra_attrs(parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
_extra_values = parse_args_to_dict(self.values_specs)
|
||||
@@ -569,7 +571,6 @@ class DeleteCommand(NeutronCommand):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)', parsed_args)
|
||||
self.set_extra_attrs(parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
obj_deleter = getattr(neutron_client,
|
||||
@@ -758,7 +759,6 @@ class ListCommand(NeutronCommand, lister.Lister):
|
||||
for s in info), )
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)', parsed_args)
|
||||
self.set_extra_attrs(parsed_args)
|
||||
data = self.retrieve_list(parsed_args)
|
||||
self.extend_list(data, parsed_args)
|
||||
@@ -788,7 +788,6 @@ class ShowCommand(NeutronCommand, show.ShowOne):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)', parsed_args)
|
||||
self.set_extra_attrs(parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
|
||||
|
@@ -41,7 +41,6 @@ class AddNetworkToDhcpAgent(neutronV20.NeutronCommand):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
_net_id = neutronV20.find_resourceid_by_name_or_id(
|
||||
neutron_client, 'network', parsed_args.network)
|
||||
@@ -67,7 +66,6 @@ class RemoveNetworkFromDhcpAgent(neutronV20.NeutronCommand):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
_net_id = neutronV20.find_resourceid_by_name_or_id(
|
||||
neutron_client, 'network', parsed_args.network)
|
||||
@@ -143,7 +141,6 @@ class AddRouterToL3Agent(neutronV20.NeutronCommand):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
_id = neutronV20.find_resourceid_by_name_or_id(
|
||||
neutron_client, 'router', parsed_args.router)
|
||||
@@ -169,7 +166,6 @@ class RemoveRouterFromL3Agent(neutronV20.NeutronCommand):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
_id = neutronV20.find_resourceid_by_name_or_id(
|
||||
neutron_client, 'router', parsed_args.router)
|
||||
|
@@ -116,7 +116,6 @@ class AssociateFloatingIP(neutronV20.NeutronCommand):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
update_dict = {}
|
||||
neutronV20.update_dict(parsed_args, update_dict,
|
||||
@@ -140,7 +139,6 @@ class DisassociateFloatingIP(neutronV20.NeutronCommand):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
neutron_client.update_floatingip(parsed_args.floatingip_id,
|
||||
{'floatingip': {'port_id': None}})
|
||||
|
@@ -108,7 +108,6 @@ class RetrievePoolStats(neutronV20.ShowCommand):
|
||||
resource = 'pool'
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
pool_id = neutronV20.find_resourceid_by_name_or_id(
|
||||
self.get_client(), 'pool', parsed_args.id)
|
||||
|
@@ -102,7 +102,6 @@ class RetrieveLoadBalancerStats(neutronV20.ShowCommand):
|
||||
resource = 'loadbalancer'
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
neutron_client.format = parsed_args.request_format
|
||||
loadbalancer_id = neutronV20.find_resourceid_by_name_or_id(
|
||||
|
@@ -235,7 +235,6 @@ class ConnectNetworkGateway(NetworkGatewayInterfaceCommand):
|
||||
"""Add an internal network interface to a router."""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
(gateway_id, network_id) = self.retrieve_ids(neutron_client,
|
||||
parsed_args)
|
||||
@@ -253,7 +252,6 @@ class DisconnectNetworkGateway(NetworkGatewayInterfaceCommand):
|
||||
"""Remove a network from a network gateway."""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
(gateway_id, network_id) = self.retrieve_ids(neutron_client,
|
||||
parsed_args)
|
||||
|
@@ -53,7 +53,6 @@ class DeleteQuota(neutronV20.NeutronCommand):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
tenant_id = get_tenant_id(parsed_args, neutron_client)
|
||||
obj_deleter = getattr(neutron_client,
|
||||
@@ -76,7 +75,6 @@ class ListQuota(neutronV20.NeutronCommand, lister.Lister):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)', parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
search_opts = {}
|
||||
self.log.debug('search options: %s', search_opts)
|
||||
@@ -115,7 +113,6 @@ class ShowQuota(neutronV20.NeutronCommand, show.ShowOne):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)', parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
tenant_id = get_tenant_id(parsed_args, neutron_client)
|
||||
params = {}
|
||||
@@ -214,7 +211,6 @@ class UpdateQuota(neutronV20.NeutronCommand, show.ShowOne):
|
||||
return {self.resource: quota}
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)', parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
_extra_values = neutronV20.parse_args_to_dict(self.values_specs)
|
||||
neutronV20._merge_args(self, parsed_args, _extra_values,
|
||||
|
@@ -162,7 +162,6 @@ class RouterInterfaceCommand(neutronV20.NeutronCommand):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
|
||||
if '=' in parsed_args.interface:
|
||||
@@ -237,7 +236,6 @@ class SetGatewayRouter(neutronV20.NeutronCommand):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
_router_id = neutronV20.find_resourceid_by_name_or_id(
|
||||
neutron_client, self.resource, parsed_args.router)
|
||||
@@ -274,7 +272,6 @@ class RemoveGatewayRouter(neutronV20.NeutronCommand):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('run(%s)' % parsed_args)
|
||||
neutron_client = self.get_client()
|
||||
_router_id = neutronV20.find_resourceid_by_name_or_id(
|
||||
neutron_client, self.resource, parsed_args.router)
|
||||
|
Reference in New Issue
Block a user