vmfloaty 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d229737ed9cb959ec725227d7c344ad56c1af7fcd7a53a59502fdb5bf7c0c696
4
- data.tar.gz: 4625d46bc08dc61e806beff43237adac120d509ae704c437b47d56a4ef5413bf
3
+ metadata.gz: 3250656d33ed86eadaeded7da8f91b1c320f38ee9e8637d657273b43dab897f4
4
+ data.tar.gz: 1b78092a62379ee36ce7c78dc52a0f7920366dc15e3795edc4c2be3a33a53f15
5
5
  SHA512:
6
- metadata.gz: 8763f1c3849bfa0ab7ad2f45cae9737ab16c4f96c7aa9ff9545126979bc7ab611cc40db1c5ace88d812a1dc7004eafa8b27210df92cbe316aff07480db9fe80a
7
- data.tar.gz: eb5691d5fc84dc667abb0609c6ed9ce1222838e07cc3a5818c5d7294c888e869d28b8fd89300787e4691cfbf691b12356d01c2528d6c2235d832e7245b220dc3
6
+ metadata.gz: 3f0bab1c9aeda1ecc76b0246faac85267528ae2cc9708bf9ca430134e1535af701d565be9a1a4f32566d4d07d21d6a02e73d4d9f3188183206a6bbcb1274796d
7
+ data.tar.gz: 020e1ffbc61da0d7784e453229e82c737939ff864d0c9a7a36d4ed563827a01a2328681d5832a808f0dd0613e26fd4f07b81f9769df3be72a5dd85111cd4505f
@@ -130,8 +130,13 @@ class Utils
130
130
  tag_pairs = []
131
131
  tag_pairs = host_data['tags'].map { |key, value| "#{key}: #{value}" } unless host_data['tags'].nil?
132
132
  duration = "#{host_data['running']}/#{host_data['lifetime']} hours"
133
- metadata = [host_data['template'], duration, *tag_pairs]
134
- output_target.puts "- #{hostname}.#{host_data['domain']} (#{metadata.join(', ')})".gsub(/^/, ' ' * indent)
133
+ metadata = [host_data['state'], host_data['template'], duration, *tag_pairs]
134
+ message = "- #{hostname}.#{host_data['domain']} (#{metadata.join(', ')})".gsub(/^/, ' ' * indent)
135
+ if host_data['state'] && host_data['state'] == "destroyed"
136
+ output_target.puts message.colorize(:red)
137
+ else
138
+ output_target.puts message
139
+ end
135
140
  when 'NonstandardPooler'
136
141
  line = "- #{host_data['fqdn']} (#{host_data['os_triple']}"
137
142
  line += ", #{host_data['hours_left_on_reservation']}h remaining"
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Vmfloaty
4
- VERSION = '1.2.0'
4
+ VERSION = '1.3.0'
5
5
  end
6
6
 
@@ -283,7 +283,7 @@ describe Utils do
283
283
  }
284
284
  end
285
285
 
286
- let(:default_output) { "- #{fqdn} (ubuntu-1604-x86_64, 9.66/12 hours)" }
286
+ let(:default_output) { "- #{fqdn} (running, ubuntu-1604-x86_64, 9.66/12 hours)" }
287
287
 
288
288
  it 'prints output with host fqdn, template and duration info' do
289
289
  expect(STDOUT).to receive(:puts).with(default_output)
@@ -311,7 +311,7 @@ describe Utils do
311
311
  end
312
312
 
313
313
  it 'prints output with host fqdn, template, duration info, and tags' do
314
- output = "- #{fqdn} (redhat-7-x86_64, 7.67/48 hours, user: bob, role: agent)"
314
+ output = "- #{fqdn} (running, redhat-7-x86_64, 7.67/48 hours, user: bob, role: agent)"
315
315
 
316
316
  expect(STDOUT).to receive(:puts).with(output)
317
317
 
@@ -458,13 +458,24 @@ describe Utils do
458
458
  it 'prints more information when vmpooler_fallback is set output with job id, host, template, lifetime, user and role' do
459
459
  fallback = {'vmpooler_fallback' => 'vmpooler'}
460
460
  service.config.merge! fallback
461
- default_output_second_line=" - #{fqdn} (#{template}, 7.67/48 hours, user: bob, role: agent)"
461
+ default_output_second_line=" - #{fqdn} (running, #{template}, 7.67/48 hours, user: bob, role: agent)"
462
462
  expect(STDOUT).to receive(:puts).with(default_output_first_line)
463
463
  expect(STDOUT).to receive(:puts).with(default_output_second_line)
464
464
 
465
465
  subject
466
466
  end
467
467
 
468
+ it 'prints in red when destroyed' do
469
+ fallback = {'vmpooler_fallback' => 'vmpooler'}
470
+ service.config.merge! fallback
471
+ response_body_vmpooler[fqdn_hostname]['state'] = "destroyed"
472
+ default_output_second_line_red=" - #{fqdn} (destroyed, #{template}, 7.67/48 hours, user: bob, role: agent)".red
473
+ expect(STDOUT).to receive(:puts).with(default_output_first_line)
474
+ expect(STDOUT).to receive(:puts).with(default_output_second_line_red)
475
+
476
+ subject
477
+ end
478
+
468
479
  context 'when print_to_stderr option is true' do
469
480
  let(:print_to_stderr) { true }
470
481
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmfloaty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Cain
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-02-11 00:00:00.000000000 Z
12
+ date: 2021-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize