Example #1
0
from hc2002.validation import absolute_path, at_most_one_of, file_mode, \
        one_of, one_or_more, path, tolerant_dict, url

_file_attributes = [
    tolerant_dict({
        'content': basestring,
        'source': url,
        'target': path,
        'mode': file_mode,
        'owner': basestring,
        'group': basestring,
        'uid': int,
        'gid': int,
    }),
    at_most_one_of('content', 'source', 'target'),
    at_most_one_of('owner', 'uid'),
    at_most_one_of('group', 'gid'),
]

validator = one_or_more([
    tolerant_dict({
        'destination': absolute_path,
    }),
    _file_attributes,
    tolerant_dict({
        'files':
        one_or_more(
            one_of(
                basestring,
                [
                    _file_attributes,
Example #2
0
    'max-count',
    'subnet',
    'availability-zone',
    'auto-scaling-cooldown',
    'auto-scaling-grace-period',
    'auto-scaling-health-check',
    'load-balancers',
    'tags',
    'termination-policies',
    'schedule',
    'notification',
]

validator = [
    dict,
    tolerant_dict(_instance_dict),
    one_of(
        [
            validate_keys(in_(_run_instance_keys)),
            at_most_one_of('count', 'min_count'),
            at_most_one_of('count', 'max_count'),
        ],
        validate_keys(in_(_spot_instance_keys)),
        validate_keys(in_(_launch_config_keys + _auto_scaling_group_keys)),
    ),
]

_block_device_mapping = {
    'source':
    xl.switch({
        'no-device': xl.set_value('no_device', True),
Example #3
0
    'max-count',
    'subnet',
    'availability-zone',
    'auto-scaling-cooldown',
    'auto-scaling-grace-period',
    'auto-scaling-health-check',
    'load-balancers',
    'tags',
    'termination-policies',
    'schedule',
    'notification',
]

validator = [
    dict,
    tolerant_dict(_instance_dict),
    one_of(
        [
            validate_keys(in_(_run_instance_keys)),
            at_most_one_of('count', 'min_count'),
            at_most_one_of('count', 'max_count'),
        ],
        validate_keys(in_(_spot_instance_keys)),
        validate_keys(in_(_launch_config_keys + _auto_scaling_group_keys)),
    ),
]

_block_device_mapping = {
    'source':       xl.switch({
                        'no-device':            xl.set_value('no_device', True),
                        'ephemeral[0-9]':       xl.set_key('ephemeral_name'),
Example #4
0
from hc2002.validation import absolute_path, at_most_one_of, file_mode, \
        one_of, one_or_more, path, tolerant_dict, url

_file_attributes = [
    tolerant_dict({
        'content':  basestring,
        'source':   url,
        'target':   path,

        'mode':     file_mode,

        'owner':    basestring,
        'group':    basestring,
        'uid':      int,
        'gid':      int,
    }),
    at_most_one_of('content', 'source', 'target'),
    at_most_one_of('owner', 'uid'),
    at_most_one_of('group', 'gid'),
]

validator = one_or_more([
    tolerant_dict({ 'destination': absolute_path, }),
    _file_attributes,
    tolerant_dict({
        'files': one_or_more(
            one_of(
                basestring,
                [
                    _file_attributes,
                    tolerant_dict({ 'filename': path, }),