13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/vcloud/converter.rb', line 13
def self.convert_vcloud_net_launcher(file_path)
begin
vcloud_config = YAML.load_file(file_path)
rescue Psych::SyntaxError
puts "Your YAML file had a syntax error!"
exit
else
name = vcloud_config.first.first
vcloud_config[name].each do |machine|
vdc_name = machine["vdc_name"]
edge_gateway = machine["edge_gateway"]
gateway = machine["gateway"]
netmask = machine["netmask"]
dns1 = machine["dns1"]
dns2 = machine["dns2"]
dns_suffix = machine["dns_suffix"]
start_address = machine["ip_ranges"][0]["start_address"]
end_address = machine["ip_ranges"][0]["end_address"]
puts ERB.new(File.read("./templates/vcd_networks.tf.erb")).result(binding)
end
end
end
|