Example #1
0
def validate_yaml_groups(groups, yaml_file):
    """Validate groups in clowder loaded from yaml file

    :param dict groups: Parsed YAML python object for groups
    :param str yaml_file: Path to yaml file
    """

    validate_type(groups, 'groups', list, 'list', yaml_file)
    validate_not_empty(groups, 'groups', yaml_file)

    for group in groups:
        validate_type(group, 'group', dict, 'dict', yaml_file)
        validate_not_empty(group, 'group', yaml_file)

        validate_required_string(group, 'group', 'name', yaml_file)

        validate_dict_contains_value(group, 'group', 'projects', yaml_file)
        validate_yaml_projects(group['projects'], yaml_file)
        del group['projects']

        validate_depth(group, yaml_file)
        validate_optional_bool(group, 'recursive', yaml_file)
        validate_optional_ref(group, yaml_file)

        string_args = ['remote', 'source', 'timestamp_author']
        for arg in string_args:
            validate_optional_string(group, arg, yaml_file)

        validate_empty(group, 'group', yaml_file)
Example #2
0
def validate_yaml_defaults_import(defaults, yaml_file):
    """Validate clowder.yaml defaults with an import

    :param dict defaults: Parsed YAML python object for defaults
    :param str yaml_file: Path to yaml file
    """

    validate_type(defaults, 'defaults', dict, 'dict', yaml_file)
    validate_depth(defaults, yaml_file)
    validate_optional_ref(defaults, yaml_file)
    validate_optional_protocol(defaults, yaml_file)
    validate_optional_bool(defaults, 'recursive', yaml_file)
    args = ['remote', 'source', 'timestamp_author']
    for arg in args:
        validate_optional_string(defaults, arg, yaml_file)

    validate_empty(defaults, 'defaults', yaml_file)
Example #3
0
def _validate_yaml_project_optional(project, yaml_file):
    """Validate optional args in project in clowder loaded from yaml file

    :param dict project: Parsed YAML python object for project
    :param str yaml_file: Path to yaml file
    """

    args = ['remote', 'source', 'timestamp_author']
    for arg in args:
        validate_optional_string(project, arg, yaml_file)

    validate_optional_bool(project, 'recursive', yaml_file)
    validate_optional_ref(project, yaml_file)

    validate_depth(project, yaml_file)

    if 'fork' in project:
        validate_yaml_fork(project['fork'], yaml_file)
        del project['fork']
Example #4
0
def validate_yaml_defaults(defaults, yaml_file):
    """Validate defaults in clowder loaded from yaml file

    :param dict defaults: Parsed YAML python object for defaults
    :param str yaml_file: Path to yaml file
    """

    validate_type(defaults, 'defaults', dict, 'dict', yaml_file)
    validate_not_empty(defaults, 'defaults', yaml_file)
    validate_required_ref(defaults, yaml_file)
    validate_required_protocol(defaults, yaml_file)
    validate_required_string(defaults, 'defaults', 'remote', yaml_file)
    validate_required_string(defaults, 'defaults', 'source', yaml_file)

    validate_depth(defaults, yaml_file)
    validate_optional_bool(defaults, 'recursive', yaml_file)
    validate_optional_string(defaults, 'timestamp_author', yaml_file)

    validate_empty(defaults, 'defaults', yaml_file)