ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxmrlv <...@git.apache.org>
Subject [GitHub] incubator-ariatosca pull request #187: ARIA-313 Fix handling the `required` ...
Date Wed, 26 Jul 2017 14:54:11 GMT
Github user mxmrlv commented on a diff in the pull request:

    https://github.com/apache/incubator-ariatosca/pull/187#discussion_r129571753
  
    --- Diff: aria/modeling/utils.py ---
    @@ -64,81 +64,84 @@ def service_template(self):
             return self.container.service_template
     
     
    -def merge_parameter_values(parameter_values, declared_parameters, model_cls):
    +def validate_no_undeclared_inputs(declared_inputs, supplied_inputs):
    +
    +    undeclared_inputs = [input for input in supplied_inputs if input not in declared_inputs]
    +    if undeclared_inputs:
    +        raise exceptions.UndeclaredInputsException(
    +            'Undeclared inputs have been provided: {0}; Declared inputs: {1}'
    +            .format(string_list_as_string(list(undeclared_inputs)),
    +                    string_list_as_string(declared_inputs.keys())))
    +
    +
    +def validate_required_inputs_are_supplied(declared_inputs, supplied_inputs):
    +    required_inputs = [input for input in declared_inputs.values() if input.required]
    +    missing_required_inputs = [input for input in required_inputs
    +                               if input.name not in supplied_inputs and not input.value]
    +    if missing_required_inputs:
    +        raise exceptions.MissingRequiredInputsException(
    +            'Required inputs {0} have not been provided values'
    +            .format(string_list_as_string(missing_required_inputs)))
    +
    +
    +def merge_parameter_values(provided_values, declared_parameters, model_cls):
         """
         Merges parameter values according to those declared by a type.
     
         Exceptions will be raised for validation errors.
     
    -    :param parameter_values: provided parameter values or None
    -    :type parameter_values: {:obj:`basestring`: object}
    -    :param declared_parameters: declared parameters
    +    :param provided_values: provided parameter values or None
    +    :type provided_values: {:obj:`basestring`: object}
    +    :param declared_parameters: declared code_parameters
    --- End diff --
    
    just `parameters`, not `code_parameters`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message