Merge "Replace voluptuous with JSONSchema to validate nop action"
This commit is contained in:
@@ -17,9 +17,8 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import jsonschema
|
||||||
from oslo_log import log
|
from oslo_log import log
|
||||||
import six
|
|
||||||
import voluptuous
|
|
||||||
|
|
||||||
from watcher.applier.actions import base
|
from watcher.applier.actions import base
|
||||||
|
|
||||||
@@ -42,10 +41,23 @@ class Nop(base.BaseAction):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def schema(self):
|
def schema(self):
|
||||||
return voluptuous.Schema({
|
return {
|
||||||
voluptuous.Required(self.MESSAGE): voluptuous.Any(
|
'type': 'object',
|
||||||
voluptuous.Any(*six.string_types), None)
|
'properties': {
|
||||||
})
|
'message': {
|
||||||
|
'type': ['string', 'null']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'required': ['message'],
|
||||||
|
'additionalProperties': False,
|
||||||
|
}
|
||||||
|
|
||||||
|
def validate_parameters(self):
|
||||||
|
try:
|
||||||
|
jsonschema.validate(self.input_parameters, self.schema)
|
||||||
|
return True
|
||||||
|
except jsonschema.ValidationError as e:
|
||||||
|
raise e
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def message(self):
|
def message(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user