Merge "Fixes Congress model validation"
This commit is contained in:
commit
eed7ca666f
@ -160,10 +160,11 @@ class TaskExecutor(object):
|
||||
except Exception as e:
|
||||
return self.exception_result(e, None, '<load>')
|
||||
|
||||
try:
|
||||
self._validate_model(obj, self.action, class_loader)
|
||||
except Exception as e:
|
||||
return self.exception_result(e, obj, '<validate>')
|
||||
if obj is not None:
|
||||
try:
|
||||
self._validate_model(obj.object, self.action, class_loader)
|
||||
except Exception as e:
|
||||
return self.exception_result(e, obj, '<validate>')
|
||||
|
||||
try:
|
||||
LOG.info(_LI('Invoking pre-cleanup hooks'))
|
||||
@ -230,10 +231,9 @@ class TaskExecutor(object):
|
||||
|
||||
def _validate_model(self, obj, action, class_loader):
|
||||
if CONF.engine.enable_model_policy_enforcer:
|
||||
if obj is not None:
|
||||
if action is not None and action['method'] == 'deploy':
|
||||
self._model_policy_enforcer.validate(obj.to_dictionary(),
|
||||
class_loader)
|
||||
if action is not None and action['method'] == 'deploy':
|
||||
self._model_policy_enforcer.validate(obj.to_dictionary(),
|
||||
class_loader)
|
||||
|
||||
def _invoke(self, mpl_executor):
|
||||
obj = mpl_executor.object_store.get(self.action['object_id'])
|
||||
|
@ -91,7 +91,7 @@ class CongressRulesManager(object):
|
||||
|
||||
obj = self._to_dict(obj)
|
||||
new_owner = self._process_item(obj, owner_id, path) or owner_id
|
||||
if isinstance(obj, list):
|
||||
if isinstance(obj, list) or isinstance(obj, tuple):
|
||||
for v in obj:
|
||||
self._walk(v, new_owner, path)
|
||||
elif isinstance(obj, dict):
|
||||
@ -150,7 +150,7 @@ class CongressRulesManager(object):
|
||||
if isinstance(value, dict):
|
||||
rules.extend(self._create_propety_rules(
|
||||
obj_id, value, prefix + key + "."))
|
||||
elif isinstance(value, list):
|
||||
elif isinstance(value, list) or isinstance(obj, tuple):
|
||||
for v in value:
|
||||
v = self._to_dict(v)
|
||||
if not isinstance(v, dict):
|
||||
|
Loading…
x
Reference in New Issue
Block a user