lib/cloudstack-cli/helper.rb in cloudstack-cli-0.11.2 vs lib/cloudstack-cli/helper.rb in cloudstack-cli-0.12.0
- old
+ new
@@ -1,11 +1,11 @@
module CloudstackCli
module Helper
def print_options(options, attr = 'name')
options.to_enum.with_index(1).each do |option, i|
puts "#{i}: #{option[attr]}"
- end
+ end
end
def ask_number(question)
number = ask(question).to_i - 1
number < 0 ? 0 : number
@@ -58,11 +58,12 @@
jobs.each_with_index do |job, i|
print "#{job[:name]} : job #{ASYNC_STATES[job[:status]]} "
puts job[:status] == 0 ? spinner.first : ""
end
t_elapsed = opts[:t_start] ? (Time.now - opts[:t_start]).round(1) : 0
- puts "Runtime: #{t_elapsed}s"
+ completed = jobs.select{|j| j[:status] == 1}.size
+ say "Completed: #{completed}/#{jobs.size} (#{t_elapsed}s)", :magenta
sleep opts[:sleeptime] || 0.1
spinner.push spinner.shift
spinner
end
@@ -117,11 +118,11 @@
ip_addr = frontendip ||= client.associate_ip_address(
server["nic"].first["networkid"]
)
end
port = pf_rule.split(":")[1]
- if async
+ if async
say "Create port forwarding rule #{ip_addr['ipaddress']}:#{port} for server #{server["name"]}.", :yellow
client.create_port_forwarding_rule(ip_addr["id"], port, 'TCP', port, server["id"])
return
else
jobs << client.create_port_forwarding_rule(
@@ -197,6 +198,6 @@
)
end
end
end
-end
\ No newline at end of file
+end