lib/cloudstack-cli/commands/stack.rb in cloudstack-cli-1.5.10 vs lib/cloudstack-cli/commands/stack.rb in cloudstack-cli-1.5.12

- old
+ new

@@ -6,10 +6,12 @@ option :skip_forwarding_rules, default: false, type: :boolean, aliases: '-s', desc: "Skip creation of port forwarding rules." option :concurrency, type: :numeric, default: 10, aliases: '-C', desc: "number of concurrent commands to execute" + option :assumeyes, type: :boolean, default: false, aliases: '-y', + desc: "answer yes for all questions" def create(stackfile) stack = parse_file(stackfile) project_id = find_project_by_name(stack["project"]) say "Create stack #{stack["name"]}...", :green @@ -81,16 +83,19 @@ end end end say "Finished.", :green - if successful_jobs > 0 && yes?("Display password(s) for VM(s)? [y/N]:", :yellow) - pw_table = jobs.select {|job| job[:status] == 1 && job[:result] }.map do |job| - if result = job[:result]["virtualmachine"] - ["#{result["name"]}:", result["password"] || "n/a"] + if successful_jobs > 0 + if options[:assumeyes] || yes?("Display password(s) for VM(s)? [y/N]:", :yellow) + pw_table = [%w(VM Password)] + jobs.select {|job| job[:status] == 1 && job[:result] }.each do |job| + if result = job[:result]["virtualmachine"] + pw_table << ["#{result["name"]}:", result["password"] || "n/a"] + end end + print_table(pw_table) if pw_table.size > 0 end - print_table(pw_table) if pw_table.size > 0 end end desc "destroy STACKFILE", "destroy a stack of VMs" option :force,