floatyhelper 1.0 → 1.1
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 +4 -4
- data/lib/floatyhelper.rb +18 -13
- data/lib/floatyhelper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ec4a8e272838f94aa48d2917739aa2c57396f25e9e156e12f98e6e210732b5c
|
4
|
+
data.tar.gz: 1af47c81157071dc4d72bcf48d62a726cb71f43c888048dab878b4ef6e1d93af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64d4f6adfd316a906db6a196afced6649892c03a119bb76d73367d0684122ae4fe7c52854ad497d254e4d7622a78eab58dcf690b4675a72b6e2cda1f2a95327e
|
7
|
+
data.tar.gz: 3f2f6b0bb5066b5b9a17f39c412160906da339a2d53b3792bb177e0a1edc94aca50689b297ad940cb88a29a4a8acbbffc2c52bb792376afb0d24079a8e913e8d
|
data/lib/floatyhelper.rb
CHANGED
@@ -41,7 +41,7 @@ class Floatyhelper
|
|
41
41
|
c.syntax = 'floatyhelper list'
|
42
42
|
c.summary = 'List all VMs and their associated tags'
|
43
43
|
c.description = 'This lists all VMs currently defined in the status.yaml file, added via the addhosts command, and their associated tags.'
|
44
|
-
c.option '--
|
44
|
+
c.option '--check', 'Check remaining lifetime of each VM'
|
45
45
|
c.action do |args, options|
|
46
46
|
data = Conf.load_data
|
47
47
|
if data['vms'].keys.length == 0
|
@@ -51,11 +51,11 @@ class Floatyhelper
|
|
51
51
|
puts "#{tag}:"
|
52
52
|
hosts.each do |host|
|
53
53
|
remaining = ''
|
54
|
-
|
54
|
+
if options.check
|
55
55
|
query = VM.query(host)
|
56
56
|
remaining = VM.alive(host, query) ? "#{query[host]['remaining']} hours remaining" : "Expired"
|
57
57
|
end
|
58
|
-
puts "
|
58
|
+
puts " %-15s %s" % [host, remaining]
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -274,20 +274,25 @@ class Floatyhelper
|
|
274
274
|
data = Conf.load_data
|
275
275
|
expired = false
|
276
276
|
data['vms'].each do |tag, hosts|
|
277
|
-
|
277
|
+
expired_hosts = []
|
278
278
|
hosts.each do |host|
|
279
|
-
|
279
|
+
expired_hosts << host unless VM.alive(host)
|
280
280
|
end
|
281
|
-
unless
|
281
|
+
unless expired_hosts.empty?
|
282
282
|
expired = true
|
283
|
-
if
|
284
|
-
answer = 'y'
|
283
|
+
if expired_hosts & hosts == hosts
|
284
|
+
answer = options.y ? 'y' : ask("All hosts in tag #{tag} have expired. Delete this tag? [Y/n] ".yellow)
|
285
|
+
if answer.empty? || answer.capitalize == 'Y'
|
286
|
+
Groups.delete_tag(tag)
|
287
|
+
puts "Tag #{tag} deleted".green
|
288
|
+
end
|
285
289
|
else
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
290
|
+
expired_hosts.each { |host| puts "#{host}".yellow } unless options.y
|
291
|
+
answer = options.y ? 'y' : ask("The above hosts in tag #{tag} have expired. Delete these hosts from the tag? [Y/n]".yellow)
|
292
|
+
if answer.empty? || answer.capitalize == 'Y'
|
293
|
+
Groups.removehosts(expired_hosts, tag)
|
294
|
+
puts "Expired hosts from #{tag} deleted".green
|
295
|
+
end
|
291
296
|
end
|
292
297
|
end
|
293
298
|
end
|
data/lib/floatyhelper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: floatyhelper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Burgan-Illig
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|