Use a common decorator to log 'take_action' activation
Instead of duplicating the same log statement throughout the code, the same logic can be provided by a shared decorator that abstracts away the logging capability and unifies it behind a common function instead. Change-Id: Icc63bced7347c8bbf0299a4c5821425a10892a79
This commit is contained in:
@@ -47,8 +47,8 @@ class CreateKeypair(show.ShowOne):
|
||||
)
|
||||
return parser
|
||||
|
||||
@utils.log_method(log)
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
compute_client = self.app.client_manager.compute
|
||||
|
||||
public_key = parsed_args.public_key
|
||||
@@ -93,8 +93,8 @@ class DeleteKeypair(command.Command):
|
||||
)
|
||||
return parser
|
||||
|
||||
@utils.log_method(log)
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
compute_client = self.app.client_manager.compute
|
||||
compute_client.keypairs.delete(parsed_args.name)
|
||||
return
|
||||
@@ -140,8 +140,8 @@ class ShowKeypair(show.ShowOne):
|
||||
)
|
||||
return parser
|
||||
|
||||
@utils.log_method(log)
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug('take_action(%s)', parsed_args)
|
||||
compute_client = self.app.client_manager.compute
|
||||
keypair = utils.find_resource(compute_client.keypairs,
|
||||
parsed_args.name)
|
||||
|
||||
Reference in New Issue
Block a user