mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 13:28:42 -05:00
Merge pull request #134 from puppetlabs/DIO-1522
(DIO-1522) Show the VM state (running, destroyed) and colorize in red…
This commit is contained in:
commit
55ead89ab2
2 changed files with 21 additions and 5 deletions
|
|
@ -130,8 +130,13 @@ class Utils
|
|||
tag_pairs = []
|
||||
tag_pairs = host_data['tags'].map { |key, value| "#{key}: #{value}" } unless host_data['tags'].nil?
|
||||
duration = "#{host_data['running']}/#{host_data['lifetime']} hours"
|
||||
metadata = [host_data['template'], duration, *tag_pairs]
|
||||
output_target.puts "- #{hostname}.#{host_data['domain']} (#{metadata.join(', ')})".gsub(/^/, ' ' * indent)
|
||||
metadata = [host_data['state'], host_data['template'], duration, *tag_pairs]
|
||||
message = "- #{hostname}.#{host_data['domain']} (#{metadata.join(', ')})".gsub(/^/, ' ' * indent)
|
||||
if host_data['state'] && host_data['state'] == "destroyed"
|
||||
output_target.puts message.colorize(:red)
|
||||
else
|
||||
output_target.puts message
|
||||
end
|
||||
when 'NonstandardPooler'
|
||||
line = "- #{host_data['fqdn']} (#{host_data['os_triple']}"
|
||||
line += ", #{host_data['hours_left_on_reservation']}h remaining"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue