(maint) Include tags in host pretty printing when available

This commit is contained in:
Justin Stoller 2016-06-01 22:05:25 -07:00
parent 8111005c81
commit 1dd8230017
2 changed files with 64 additions and 1 deletions

View file

@ -51,6 +51,7 @@ class Utils
vms[host]['template'] = vm_info[host]['template']
vms[host]['lifetime'] = vm_info[host]['lifetime']
vms[host]['running'] = vm_info[host]['running']
vms[host]['tags'] = vm_info[host]['tags']
end
end
vms
@ -64,8 +65,13 @@ class Utils
template = info['template']
lifetime = info['lifetime']
running = info['running']
tags = info['tags'] || {}
puts "- #{vm}.#{domain} (#{template}, #{running}/#{lifetime} hours)"
tag_pairs = tags.map {|key,value| "#{key}: #{value}" }
duration = "#{running}/#{lifetime} hours"
metadata = [template, duration, *tag_pairs]
puts "- #{vm}.#{domain} (#{metadata.join(", ")})"
end
end
end