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,
'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'), 'snap-[a-fA-F0-9]*': xl.set_key('snapshot_id'), }), 'size':
'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'), 'snap-[a-fA-F0-9]*': xl.set_key('snapshot_id'), }), 'size': xl.set_key('size'), 'iops': [
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, }), ],