Class: CloudFormationTool::CLI::Compile

Inherits:
Clamp::Command
  • Object
show all
Includes:
ParamSupport
Defined in:
lib/cloud_formation_tool/cli/compile.rb

Instance Method Summary collapse

Methods included from ParamSupport

#get_params, included, #read_param_file

Instance Method Details

#executeObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cloud_formation_tool/cli/compile.rb', line 15

def execute
	$MAX_USER_DATA_SIZE = user_data_size
  if file.end_with? '.init'
    puts CloudInit.new(file).encode(false) # make sure cloud-init files obey AWS user-data restrictions, but are also printable
  else
    tpl = CloudFormation.parse(file)
    params = get_params
    data = tpl.compile(params)
    (data['Parameters'] || []).each do |name,param|
      param['Default'] = params[name] if params.has_key? name
    end
    puts data.to_yaml
  end
end