mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-25 21:28:40 -05:00
(DIO-1522) Show the VM state (running, destroyed) and colorize in red when it has been deleted
the ABS system does not have a real sense of the current state of the resources it has allocated. When running list --active it can list VMs that have been deleted or reaped after their lifetime expired. This change enables to show more information when a vmpooler_fallback service is provided to ABS, and will show the state (running, destroyed) and colorize in red when the VM is destroyed.
This commit is contained in:
parent
4192631d70
commit
8143641f83
2 changed files with 21 additions and 5 deletions
|
|
@ -283,7 +283,7 @@ describe Utils do
|
|||
}
|
||||
end
|
||||
|
||||
let(:default_output) { "- #{fqdn} (ubuntu-1604-x86_64, 9.66/12 hours)" }
|
||||
let(:default_output) { "- #{fqdn} (running, ubuntu-1604-x86_64, 9.66/12 hours)" }
|
||||
|
||||
it 'prints output with host fqdn, template and duration info' do
|
||||
expect(STDOUT).to receive(:puts).with(default_output)
|
||||
|
|
@ -311,7 +311,7 @@ describe Utils do
|
|||
end
|
||||
|
||||
it 'prints output with host fqdn, template, duration info, and tags' do
|
||||
output = "- #{fqdn} (redhat-7-x86_64, 7.67/48 hours, user: bob, role: agent)"
|
||||
output = "- #{fqdn} (running, redhat-7-x86_64, 7.67/48 hours, user: bob, role: agent)"
|
||||
|
||||
expect(STDOUT).to receive(:puts).with(output)
|
||||
|
||||
|
|
@ -458,13 +458,24 @@ describe Utils do
|
|||
it 'prints more information when vmpooler_fallback is set output with job id, host, template, lifetime, user and role' do
|
||||
fallback = {'vmpooler_fallback' => 'vmpooler'}
|
||||
service.config.merge! fallback
|
||||
default_output_second_line=" - #{fqdn} (#{template}, 7.67/48 hours, user: bob, role: agent)"
|
||||
default_output_second_line=" - #{fqdn} (running, #{template}, 7.67/48 hours, user: bob, role: agent)"
|
||||
expect(STDOUT).to receive(:puts).with(default_output_first_line)
|
||||
expect(STDOUT).to receive(:puts).with(default_output_second_line)
|
||||
|
||||
subject
|
||||
end
|
||||
|
||||
it 'prints in red when destroyed' do
|
||||
fallback = {'vmpooler_fallback' => 'vmpooler'}
|
||||
service.config.merge! fallback
|
||||
response_body_vmpooler[fqdn_hostname]['state'] = "destroyed"
|
||||
default_output_second_line_red=" - #{fqdn} (destroyed, #{template}, 7.67/48 hours, user: bob, role: agent)".red
|
||||
expect(STDOUT).to receive(:puts).with(default_output_first_line)
|
||||
expect(STDOUT).to receive(:puts).with(default_output_second_line_red)
|
||||
|
||||
subject
|
||||
end
|
||||
|
||||
context 'when print_to_stderr option is true' do
|
||||
let(:print_to_stderr) { true }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue