8 Commits

Author SHA1 Message Date
John L. Villalovos
0b8763e332 Update to hacking 0.12.0 and use new checks
Use hacking 0.12.0

Use the new checks that are available:
    [H106] Don’t put vim configuration in source files.
    [H203] Use assertIs(Not)None to check for None.
    [H904] Delay string interpolations at logging calls.

Fix code so tests pass.

Change-Id: If22ad272c332f30624ce10861408d377908b152b
Depends-On: I2aa44b62f900d4dfd67701b01eadd0523fbfaf07
2016-11-08 11:31:18 -08:00
Ghe Rivero
10a3a800e7 Use oslo_log lib
Module 'log' from oslo-incubator was removed after release of oslo_log
library.

Change-Id: Ia00e26071fc0cab4fd3f3334ca94860bc7b1c75c
2015-03-24 08:43:35 +01:00
Szymon Wroblewski
324f037eb0 Enhance decorators in agent and automate creation of command_map
sync_command and async_command in ironic_python_agent/extensions/base.py
are implemented so that they change decorated method signature,
which is really bad practice. Example:

@sync_command
def orig_method(self, **kw):
...

sync_command decorator returns lambda which has one additional
argument 'command_name'

def sync_command(func):
    def decorated(self, command_name, **kw):
         ...
         func(self, **kw)
         ...
    return decorated

Additional parameter 'command_name' is moved from decorated function to
decorator signature in both decorators. Every call of decorated functions
is fixed, BaseAgentExtension.execute is updated to not send this extra
argument. BaseAgentExtension.__init__ automatically generates command_map
from decorated methods.

Change-Id: Iff0f495bc8d9c731892feb0f4759a7f10ee76328
Closes-Bug: 1314148
2014-09-11 10:49:33 +02:00
Vladimir Kozhukalov
b306626e86 Flow extension uses extension manager from agent
Removed creating separate extension manager for flow extension.
Instead, have made flow extension using the same extension manager
instance which is initialized in agent. It fixes circular
extension loading in stevedore.

Closes-Bug: #1316145
Change-Id: Id339f1876168a41ca43ba7473f3ff6949a233ef3
2014-06-02 15:21:38 +04:00
Jenkins
24c4382fed Merge "Deprecated extension name attribute" 2014-04-17 15:50:55 +00:00
Russell Haering
bf74673226 Decorated commands no longer take command_name
Prior to the (sync|async)_command decorators, extension methods had to
construct command results themselves, which required that they have
the name of the command being executed.

When the async_command decorator was introduced, we wanted to maintain
the current command interface, so that a command could be made
asynchronous simply by adding the decorator.

The introduction of the sync_command decorator allows us to satisfy
this objective, without requiring decorated methods to accept a
command_name. This patch modifies both decorators to no longer pass
the command_name argument, and modifies existing command methods not
to expect one.

Closes-Bug: #1308021
Change-Id: I1b33bb7519588cdcb79c6f4d2b10c1e5e8c0cca3
2014-04-15 10:25:12 -07:00
Vladimir Kozhukalov
9e153253e5 Deprecated extension name attribute
It seems not to be used, so it is not needed.

Change-Id: Ie46470d888ff11edaf16b94e5b2e716d13cf764f
Closes-Bug: #1308017
2014-04-15 15:56:09 +04:00
Russell Haering
5ebd2e9797 Organize agent extensions
Move extensions under an ironic_python_agent.extensions module. This
change also moves the @async_command() decorator into the base
extension module.

Change-Id: I4021fcc33a30f3460a31bca44a4bf776cd53d488
2014-04-14 15:09:12 -07:00