Add self to validator method

This patchset allows access to extension class instance for more
advanced command validation.

Change-Id: I9d6df1ab44ab06ef2e663ad777ad3560d9ab7565
This commit is contained in:
Alexander Gordeev 2014-04-14 15:36:59 +04:00
parent 5bc793bcb0
commit bd19a03f92
3 changed files with 3 additions and 3 deletions
ironic_python_agent

@ -28,7 +28,7 @@ def async_command(validator=None):
# Run a validator before passing everything off to async.
# validators should raise exceptions or return silently.
if validator:
validator(**command_params)
validator(self, **command_params)
# bind self to func so that AsyncCommandResult doesn't need to
# know about the mode

@ -133,7 +133,7 @@ def _verify_image(image_info, image_location):
return False
def _validate_image_info(image_info=None, **kwargs):
def _validate_image_info(ext, image_info=None, **kwargs):
image_info = image_info or {}
for field in ['id', 'urls', 'hashes']:

@ -45,7 +45,7 @@ class TestStandbyExtension(test_base.BaseTestCase):
}
def test_validate_image_info_success(self):
standby._validate_image_info(self._build_fake_image_info())
standby._validate_image_info(None, self._build_fake_image_info())
def test_validate_image_info_missing_field(self):
for field in ['id', 'urls', 'hashes']: