Make query request before printing all vm information

This commit is contained in:
Brian Cain 2015-11-21 13:43:30 -08:00
parent 19255bb3ba
commit 56924fa811
3 changed files with 24 additions and 11 deletions

View file

@ -41,18 +41,31 @@ class Utils
os_types
end
def self.get_vm_info(hosts, verbose, url)
vms = {}
hosts.each do |host|
vm_info = Pooler.query(verbose, url, host)
if vm_info['ok']
vms[host] = {}
vms[host]['domain'] = vm_info[host]['domain']
vms[host]['template'] = vm_info[host]['template']
vms[host]['lifetime'] = vm_info[host]['lifetime']
vms[host]['running'] = vm_info[host]['running']
end
end
vms
end
def self.prettyprint_hosts(hosts, verbose, url)
puts "Running VMs:"
hosts.each do |vm|
vm_info = Pooler.query(verbose, url, vm)
if vm_info['ok']
domain = vm_info[vm]['domain']
template = vm_info[vm]['template']
lifetime = vm_info[vm]['lifetime']
running = vm_info[vm]['running']
vm_info = get_vm_info(hosts, verbose, url)
vm_info.each do |vm,info|
domain = info['domain']
template = info['template']
lifetime = info['lifetime']
running = info['running']
puts "- #{vm}.#{domain} (#{template}, #{running}/#{lifetime} hours)"
end
puts "- #{vm}.#{domain} (#{template}, #{running}/#{lifetime} hours)"
end
end
end

View file

@ -1,6 +1,6 @@
class Version
@version = '0.2.18'
@version = '0.2.19'
def self.get
@version