Пример #1
0
def _validate_parameters(action_ref, action_params=None, runner_params=None):
    position_params = {}
    for action_param, action_param_meta in six.iteritems(action_params):
        # Check if overridden runner parameters are permitted.
        if action_param in runner_params:
            for action_param_attr, value in six.iteritems(action_param_meta):
                util_schema.validate_runner_parameter_attribute_override(
                    action_ref,
                    action_param,
                    action_param_attr,
                    value,
                    runner_params[action_param].get(action_param_attr),
                )

        if "position" in action_param_meta:
            pos = action_param_meta["position"]
            param = position_params.get(pos, None)
            if param:
                msg = (
                    "Parameters %s and %s have same position %d."
                    % (action_param, param, pos)
                    + " Position values have to be unique."
                )
                raise ValueValidationException(msg)
            else:
                position_params[pos] = action_param

        if "immutable" in action_param_meta:
            if action_param in runner_params:
                runner_param_meta = runner_params[action_param]
                if "immutable" in runner_param_meta:
                    msg = (
                        "Param %s is declared immutable in runner. " % action_param
                        + "Cannot override in action."
                    )
                    raise ValueValidationException(msg)
                if (
                    "default" not in action_param_meta
                    and "default" not in runner_param_meta
                ):
                    msg = "Immutable param %s requires a default value." % action_param
                    raise ValueValidationException(msg)
            else:
                if "default" not in action_param_meta:
                    msg = "Immutable param %s requires a default value." % action_param
                    raise ValueValidationException(msg)

    return _validate_position_values_contiguous(position_params)
Пример #2
0
def _validate_parameters(action_ref, action_params=None, runner_params=None):
    for action_param, action_param_meta in six.iteritems(action_params):
        # Check if overridden runner parameters are permitted.
        if action_param in runner_params:
            for action_param_attr, value in six.iteritems(action_param_meta):
                util_schema.validate_runner_parameter_attribute_override(
                    action_ref, action_param, action_param_attr, value,
                    runner_params[action_param].get(action_param_attr))

        if 'immutable' in action_param_meta:
            if action_param in runner_params:
                runner_param_meta = runner_params[action_param]
                if 'immutable' in runner_param_meta:
                    msg = 'Param %s is declared immutable in runner. ' % action_param + \
                          'Cannot override in action.'
                    raise ValueValidationException(msg)
                if 'default' not in action_param_meta and 'default' not in runner_param_meta:
                    msg = 'Immutable param %s requires a default value.' % action_param
                    raise ValueValidationException(msg)
            else:
                if 'default' not in action_param_meta:
                    msg = 'Immutable param %s requires a default value.' % action_param
                    raise ValueValidationException(msg)
Пример #3
0
def _validate_parameters(action_ref, action_params=None, runner_params=None):
    for action_param, action_param_meta in six.iteritems(action_params):
        # Check if overridden runner parameters are permitted.
        if action_param in runner_params:
            for action_param_attr, value in six.iteritems(action_param_meta):
                util_schema.validate_runner_parameter_attribute_override(
                    action_ref, action_param, action_param_attr,
                    value, runner_params[action_param].get(action_param_attr))

        if 'immutable' in action_param_meta:
            if action_param in runner_params:
                runner_param_meta = runner_params[action_param]
                if 'immutable' in runner_param_meta:
                    msg = 'Param %s is declared immutable in runner. ' % action_param + \
                          'Cannot override in action.'
                    raise ValueValidationException(msg)
                if 'default' not in action_param_meta and 'default' not in runner_param_meta:
                    msg = 'Immutable param %s requires a default value.' % action_param
                    raise ValueValidationException(msg)
            else:
                if 'default' not in action_param_meta:
                    msg = 'Immutable param %s requires a default value.' % action_param
                    raise ValueValidationException(msg)
Пример #4
0
def _validate_parameters(action_ref, action_params=None, runner_params=None):
    position_params = {}
    for action_param, action_param_meta in six.iteritems(action_params):
        # Check if overridden runner parameters are permitted.
        if action_param in runner_params:
            for action_param_attr, value in six.iteritems(action_param_meta):
                util_schema.validate_runner_parameter_attribute_override(
                    action_ref, action_param, action_param_attr, value,
                    runner_params[action_param].get(action_param_attr))

        if 'position' in action_param_meta:
            pos = action_param_meta['position']
            param = position_params.get(pos, None)
            if param:
                msg = ('Parameters %s and %s have same position %d.' %
                       (action_param, param, pos) +
                       ' Position values have to be unique.')
                raise ValueValidationException(msg)
            else:
                position_params[pos] = action_param

        if 'immutable' in action_param_meta:
            if action_param in runner_params:
                runner_param_meta = runner_params[action_param]
                if 'immutable' in runner_param_meta:
                    msg = 'Param %s is declared immutable in runner. ' % action_param + \
                          'Cannot override in action.'
                    raise ValueValidationException(msg)
                if 'default' not in action_param_meta and 'default' not in runner_param_meta:
                    msg = 'Immutable param %s requires a default value.' % action_param
                    raise ValueValidationException(msg)
            else:
                if 'default' not in action_param_meta:
                    msg = 'Immutable param %s requires a default value.' % action_param
                    raise ValueValidationException(msg)

    return _validate_position_values_contiguous(position_params)
Пример #5
0
def _validate_parameters(action_ref, action_params=None, runner_params=None):
    position_params = {}
    for action_param, action_param_meta in six.iteritems(action_params):
        # Check if overridden runner parameters are permitted.
        if action_param in runner_params:
            for action_param_attr, value in six.iteritems(action_param_meta):
                util_schema.validate_runner_parameter_attribute_override(
                    action_ref, action_param, action_param_attr,
                    value, runner_params[action_param].get(action_param_attr))

        if 'position' in action_param_meta:
            pos = action_param_meta['position']
            param = position_params.get(pos, None)
            if param:
                msg = ('Parameters %s and %s have same position %d.' % (action_param, param, pos) +
                       ' Position values have to be unique.')
                raise ValueValidationException(msg)
            else:
                position_params[pos] = action_param

        if 'immutable' in action_param_meta:
            if action_param in runner_params:
                runner_param_meta = runner_params[action_param]
                if 'immutable' in runner_param_meta:
                    msg = 'Param %s is declared immutable in runner. ' % action_param + \
                          'Cannot override in action.'
                    raise ValueValidationException(msg)
                if 'default' not in action_param_meta and 'default' not in runner_param_meta:
                    msg = 'Immutable param %s requires a default value.' % action_param
                    raise ValueValidationException(msg)
            else:
                if 'default' not in action_param_meta:
                    msg = 'Immutable param %s requires a default value.' % action_param
                    raise ValueValidationException(msg)

    return _validate_position_values_contiguous(position_params)