lib/cloudstack-cli/commands/stack.rb in cloudstack-cli-0.3.3 vs lib/cloudstack-cli/commands/stack.rb in cloudstack-cli-0.3.4
- old
+ new
@@ -13,12 +13,12 @@
displayname: server["decription"],
zone: server["zone"] || stack["zone"],
template: server["template"],
iso: server["iso"] ,
offering: server["offering"],
- networks: server["networks"] ? server["networks"].split(', ') : nil,
- port_rules: server["port_rules"] ? server["port_rules"].split(', ') : nil,
+ networks: string_to_array(server["networks"]),
+ port_rules: string_to_array(server["port_rules"]),
project: stack["project"],
disk_offering: server["disk_offering"],
disk_size: server["disk_size"],
group: server["group"] || stack["group"],
keypair: server["keypair"] || stack["keypair"]
@@ -54,9 +54,13 @@
$stderr.puts "Can't find the stack file #{stackfile}."
rescue JSON::ParserError => e
$stderr.puts "Error parsing json file.\n#{e.message}."
exit
end
+ end
+
+ def string_to_array(string)
+ string ? string.gsub(', ', ',').split(', ') : nil
end
end
end
\ No newline at end of file