summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules
diff options
context:
space:
mode:
authorTan Lin <tan.lin.good@gmail.com>2014-12-29 22:45:29 +0000
committerLin Tan <tan.lin.good@gmail.com>2015-01-14 20:55:41 +0800
commit9650c88d97c46f8d03921674d2c92cc1d0c9b0d9 (patch)
treeb03d7521f39d43e58fd5ac8cb080dff92f2304c4 /ironic/drivers/modules
parent892e382c21e1ba5ea079edffa4cefe536a71399e (diff)
downloadironic-9650c88d97c46f8d03921674d2c92cc1d0c9b0d9.tar.gz
Make 'method' explicit for VendorInterface.validate()
Method should be more explicit than only having it via kwargs. Closes-Bug: #1394470 Change-Id: I6a55e1be013629e22c384b968699980e83ae0cd3
Diffstat (limited to 'ironic/drivers/modules')
-rw-r--r--ironic/drivers/modules/agent.py3
-rw-r--r--ironic/drivers/modules/fake.py6
-rw-r--r--ironic/drivers/modules/ilo/deploy.py5
-rw-r--r--ironic/drivers/modules/ipmitool.py4
-rw-r--r--ironic/drivers/modules/pxe.py8
-rw-r--r--ironic/drivers/modules/seamicro.py2
6 files changed, 14 insertions, 14 deletions
diff --git a/ironic/drivers/modules/agent.py b/ironic/drivers/modules/agent.py
index a40ab6e7b..f67300b44 100644
--- a/ironic/drivers/modules/agent.py
+++ b/ironic/drivers/modules/agent.py
@@ -296,12 +296,13 @@ class AgentVendorInterface(base.VendorInterface):
# not by the operator.
return {}
- def validate(self, task, **kwargs):
+ def validate(self, task, method, **kwargs):
"""Validate the driver-specific Node deployment info.
No validation necessary.
:param task: a TaskManager instance
+ :param method: method to be validated
"""
pass
diff --git a/ironic/drivers/modules/fake.py b/ironic/drivers/modules/fake.py
index 967ecd816..4451891a6 100644
--- a/ironic/drivers/modules/fake.py
+++ b/ironic/drivers/modules/fake.py
@@ -89,8 +89,7 @@ class FakeVendorA(base.VendorInterface):
return {'A1': 'A1 description. Required.',
'A2': 'A2 description. Optional.'}
- def validate(self, task, **kwargs):
- method = kwargs.get('method')
+ def validate(self, task, method, **kwargs):
if method == 'first_method':
bar = kwargs.get('bar')
if not bar:
@@ -110,8 +109,7 @@ class FakeVendorB(base.VendorInterface):
return {'B1': 'B1 description. Required.',
'B2': 'B2 description. Required.'}
- def validate(self, task, **kwargs):
- method = kwargs.get('method')
+ def validate(self, task, method, **kwargs):
if method in ('second_method', 'third_method_sync'):
bar = kwargs.get('bar')
if not bar:
diff --git a/ironic/drivers/modules/ilo/deploy.py b/ironic/drivers/modules/ilo/deploy.py
index f3edd1122..f2812dd53 100644
--- a/ironic/drivers/modules/ilo/deploy.py
+++ b/ironic/drivers/modules/ilo/deploy.py
@@ -486,14 +486,15 @@ class VendorPassthru(base.VendorInterface):
def get_properties(self):
return COMMON_PROPERTIES
- def validate(self, task, **kwargs):
+ def validate(self, task, method, **kwargs):
"""Validate vendor-specific actions.
Checks if a valid vendor passthru method was passed and validates
the parameters for the vendor passthru method.
:param task: a TaskManager instance containing the node to act on.
- :param kwargs: kwargs containing the vendor passthru method and its
+ :param method: method to be validated.
+ :param kwargs: kwargs containing the vendor passthru method's
parameters.
:raises: MissingParameterValue, if some required parameters were not
passed.
diff --git a/ironic/drivers/modules/ipmitool.py b/ironic/drivers/modules/ipmitool.py
index 27e9aa57b..7dde2a6e5 100644
--- a/ironic/drivers/modules/ipmitool.py
+++ b/ironic/drivers/modules/ipmitool.py
@@ -884,7 +884,7 @@ class VendorPassthru(base.VendorInterface):
def get_properties(self):
return COMMON_PROPERTIES
- def validate(self, task, **kwargs):
+ def validate(self, task, method, **kwargs):
"""Validate vendor-specific actions.
If invalid, raises an exception; otherwise returns None.
@@ -894,13 +894,13 @@ class VendorPassthru(base.VendorInterface):
* bmc_reset
:param task: a task from TaskManager.
+ :param method: method to be validated
:param kwargs: info for action.
:raises: InvalidParameterValue when an invalid parameter value is
specified.
:raises: MissingParameterValue if a required parameter is missing.
"""
- method = kwargs['method']
if method == 'send_raw':
if not kwargs.get('raw_bytes'):
raise exception.MissingParameterValue(_(
diff --git a/ironic/drivers/modules/pxe.py b/ironic/drivers/modules/pxe.py
index a8dc41c91..9171d7421 100644
--- a/ironic/drivers/modules/pxe.py
+++ b/ironic/drivers/modules/pxe.py
@@ -432,7 +432,7 @@ class VendorPassthru(base.VendorInterface):
def get_properties(self):
return COMMON_PROPERTIES
- def validate(self, task, **kwargs):
+ def validate(self, task, method, **kwargs):
"""Validates the inputs for a vendor passthru.
This method checks whether the vendor passthru method is a valid one,
@@ -440,9 +440,9 @@ class VendorPassthru(base.VendorInterface):
vendor passthru has been provided or not.
:param task: a TaskManager instance containing the node to act on.
- :param kwargs: kwargs containins the method name and its parameters.
- :raises: InvalidParameterValue if method is invalid or any parameters
- to the method is invalid.
+ :param method: method to be validated.
+ :param kwargs: kwargs containins the method's parameters.
+ :raises: InvalidParameterValue if any parameters is invalid.
"""
iscsi_deploy.get_deploy_info(task.node, **kwargs)
diff --git a/ironic/drivers/modules/seamicro.py b/ironic/drivers/modules/seamicro.py
index 655dea331..e9563344b 100644
--- a/ironic/drivers/modules/seamicro.py
+++ b/ironic/drivers/modules/seamicro.py
@@ -451,7 +451,7 @@ class VendorPassthru(base.VendorInterface):
def get_properties(self):
return COMMON_PROPERTIES
- def validate(self, task, **kwargs):
+ def validate(self, task, method, **kwargs):
_parse_driver_info(task.node)
@base.passthru(['POST'])