hotdog 0.18.2 → 0.18.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hotdog/commands.rb +4 -1
- data/lib/hotdog/commands/down.rb +5 -5
- data/lib/hotdog/commands/tag.rb +10 -10
- data/lib/hotdog/commands/untag.rb +15 -15
- data/lib/hotdog/commands/up.rb +1 -0
- data/lib/hotdog/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1028a5f20aa3186fb10d14ea6442de32afd7f23
|
4
|
+
data.tar.gz: 5737e3411463b9be5d49646995b269d6f0c68d94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8ff94f92bfd4bfb3816a24715ece125ba0d61a162ae35e436ed9ad793e8bd52387daa45d2fed3dd7fd1dabd420c10f8671d841aafbbea279dc7ad7d9d3faf3f
|
7
|
+
data.tar.gz: e09c12120df40d689603e7b087e5c38686080347da012ae91d406eaf9b9be8d060101925794ebeaea04db65aaeef1dba279a0045a67cb5fb305b07fd226b1d98
|
data/lib/hotdog/commands.rb
CHANGED
@@ -219,6 +219,9 @@ module Hotdog
|
|
219
219
|
persistent_db = SQLite3::Database.new(persistent)
|
220
220
|
persistent_db.execute("SELECT hosts_tags.host_id FROM hosts_tags INNER JOIN hosts ON hosts_tags.host_id = hosts.id INNER JOIN tags ON hosts_tags.tag_id = tags.id LIMIT 1;")
|
221
221
|
@db = persistent_db
|
222
|
+
rescue SQLite3::BusyException
|
223
|
+
sleep(rand) # FIXME: configurable retry interval
|
224
|
+
retry
|
222
225
|
rescue SQLite3::SQLException
|
223
226
|
if options[:offline]
|
224
227
|
raise(RuntimeError.new("no database available on offline mode"))
|
@@ -391,7 +394,7 @@ module Hotdog
|
|
391
394
|
end
|
392
395
|
|
393
396
|
def with_retry(options={}, &block)
|
394
|
-
(options[:retry] ||
|
397
|
+
(options[:retry] || 3).times do |i|
|
395
398
|
begin
|
396
399
|
return yield
|
397
400
|
rescue => error
|
data/lib/hotdog/commands/down.rb
CHANGED
@@ -31,11 +31,6 @@ module Hotdog
|
|
31
31
|
arg
|
32
32
|
end
|
33
33
|
}
|
34
|
-
scopes.each do |scope|
|
35
|
-
with_retry(options) do
|
36
|
-
schedule_downtime(scope, options)
|
37
|
-
end
|
38
|
-
end
|
39
34
|
hosts = scopes.select { |scope| scope.start_with?("host:") }.map { |scope|
|
40
35
|
scope.slice("host:".length, scope.length)
|
41
36
|
}
|
@@ -51,6 +46,11 @@ module Hotdog
|
|
51
46
|
end
|
52
47
|
end
|
53
48
|
end
|
49
|
+
scopes.each do |scope|
|
50
|
+
with_retry(options) do
|
51
|
+
schedule_downtime(scope, options)
|
52
|
+
end
|
53
|
+
end
|
54
54
|
end
|
55
55
|
|
56
56
|
private
|
data/lib/hotdog/commands/tag.rb
CHANGED
@@ -27,16 +27,6 @@ module Hotdog
|
|
27
27
|
hosts = args.map { |arg|
|
28
28
|
arg.sub(/\Ahost:/, "")
|
29
29
|
}
|
30
|
-
hosts.each do |host|
|
31
|
-
if options[:tags].empty?
|
32
|
-
# nop
|
33
|
-
else
|
34
|
-
# add all as user tags
|
35
|
-
with_retry(options) do
|
36
|
-
add_tags(host, options[:tags], source=options[:tag_source])
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
30
|
if open_db
|
41
31
|
with_retry do
|
42
32
|
@db.transaction do
|
@@ -47,6 +37,16 @@ module Hotdog
|
|
47
37
|
end
|
48
38
|
end
|
49
39
|
end
|
40
|
+
hosts.each do |host|
|
41
|
+
if options[:tags].empty?
|
42
|
+
# nop
|
43
|
+
else
|
44
|
+
# add all as user tags
|
45
|
+
with_retry(options) do
|
46
|
+
add_tags(host, options[:tags], source=options[:tag_source])
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
50
|
end
|
51
51
|
|
52
52
|
private
|
@@ -28,6 +28,21 @@ module Hotdog
|
|
28
28
|
arg.sub(/\Ahost:/, "")
|
29
29
|
}
|
30
30
|
|
31
|
+
if options[:tags].empty?
|
32
|
+
# refresh all persistent.db since there is no way to identify user tags
|
33
|
+
remove_db
|
34
|
+
else
|
35
|
+
if open_db
|
36
|
+
with_retry do
|
37
|
+
@db.transaction do
|
38
|
+
options[:tags].each do |tag|
|
39
|
+
disassociate_tag_hosts(@db, tag, hosts)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
31
46
|
hosts.each do |host|
|
32
47
|
if options[:tags].empty?
|
33
48
|
# delete all user tags
|
@@ -47,21 +62,6 @@ module Hotdog
|
|
47
62
|
end
|
48
63
|
end
|
49
64
|
end
|
50
|
-
|
51
|
-
if options[:tags].empty?
|
52
|
-
# refresh all persistent.db since there is no way to identify user tags
|
53
|
-
remove_db
|
54
|
-
else
|
55
|
-
if open_db
|
56
|
-
with_retry do
|
57
|
-
@db.transaction do
|
58
|
-
options[:tags].each do |tag|
|
59
|
-
disassociate_tag_hosts(@db, tag, hosts)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
65
|
end
|
66
66
|
|
67
67
|
private
|
data/lib/hotdog/commands/up.rb
CHANGED
data/lib/hotdog/version.rb
CHANGED