kitchen_hooks 1.7.5 → 1.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +1 -0
- data/VERSION +1 -1
- data/lib/kitchen_hooks/app.rb +11 -8
- data/lib/kitchen_hooks/helpers/sync_servers.rb +2 -5
- data/lib/kitchen_hooks/helpers.rb +5 -2
- 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: ba6350e2e32bd9410d65d847737709e27864a974
|
4
|
+
data.tar.gz: f783adc4c5c19137fefb9969444891907be5475f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d547cd54fbda16065b833ed61bf06b5d3f3df8fb69e0d610bbbfd4ecbb505015c4d95a9998d107a201c02432dad483fc20c660e9a75aa4554ce2b46d58fc4e2b
|
7
|
+
data.tar.gz: b0f1be8e6013b8083d201647e0baf9d0d2465b84bef0b3cff1eee4fd8459e448506c097ef88f05692eb811c93b111d439dbda17c77cb02d11190dc317f4c6ce1
|
data/Readme.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.6
|
data/lib/kitchen_hooks/app.rb
CHANGED
@@ -18,7 +18,12 @@ module KitchenHooks
|
|
18
18
|
|
19
19
|
enable :sessions
|
20
20
|
|
21
|
-
def self.db! path
|
21
|
+
def self.db! path=@@db_path
|
22
|
+
if defined? @@db
|
23
|
+
@@db.flush
|
24
|
+
@@db.close
|
25
|
+
end
|
26
|
+
@@db_path = path
|
22
27
|
@@db = Daybreak::DB.new path
|
23
28
|
end
|
24
29
|
|
@@ -27,6 +32,7 @@ module KitchenHooks
|
|
27
32
|
def self.close!
|
28
33
|
@@sync_worker.kill
|
29
34
|
@@backlog_worker.kill
|
35
|
+
@@db.flush
|
30
36
|
@@db.close
|
31
37
|
end
|
32
38
|
|
@@ -134,7 +140,7 @@ module KitchenHooks
|
|
134
140
|
error = nil if error == true
|
135
141
|
entry = { type: type, event: event }
|
136
142
|
entry.merge!(error: error, type: 'failure') if error
|
137
|
-
db.
|
143
|
+
db.lock do
|
138
144
|
db[Time.now.to_f] = entry
|
139
145
|
end
|
140
146
|
db.flush
|
@@ -159,14 +165,11 @@ module KitchenHooks
|
|
159
165
|
db.set! 'meta_cached_nodes', sync_servers.cached_nodes
|
160
166
|
end
|
161
167
|
sync = sync_servers.status
|
162
|
-
|
163
|
-
|
164
|
-
mark "Couldn't sync Chef servers (unknown issue)", 'unsynced'
|
165
|
-
return
|
166
|
-
end
|
167
|
-
|
168
|
+
puts 'Sync completed'
|
169
|
+
db!
|
168
170
|
sync_tag = sync[:num_failures].zero? ? 'synced' : 'unsynced'
|
169
171
|
mark sync, sync_tag
|
172
|
+
db!
|
170
173
|
end
|
171
174
|
|
172
175
|
|
@@ -107,7 +107,7 @@ private
|
|
107
107
|
nodes.each do |n|
|
108
108
|
next if failures.include? n.name
|
109
109
|
@cached_nodes[n.name] = n.automatic.ohai_time.to_f
|
110
|
-
successes << n
|
110
|
+
successes << n.name
|
111
111
|
end
|
112
112
|
|
113
113
|
deleted.each do |n|
|
@@ -118,18 +118,15 @@ private
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
puts 'Sync completed'
|
122
121
|
return {
|
123
122
|
deleted: deleted,
|
124
123
|
failures: failures,
|
125
124
|
successes: successes,
|
126
|
-
num_successes:
|
125
|
+
num_successes: successes.length,
|
127
126
|
num_failures: failures.length,
|
128
127
|
num_deletions: deleted.length,
|
129
128
|
num_nodes: nodes.length
|
130
129
|
}
|
131
|
-
# rescue
|
132
|
-
# return nil
|
133
130
|
end
|
134
131
|
|
135
132
|
end
|
@@ -344,10 +344,13 @@ module KitchenHooks
|
|
344
344
|
if event.is_a? String
|
345
345
|
event
|
346
346
|
else
|
347
|
-
|
347
|
+
num_deletions = event[:num_deletions].to_i
|
348
|
+
deletions = '%s, ' % pluralize(num_deletions, 'deletion')
|
349
|
+
deletions = '' unless num_deletions > 0
|
350
|
+
'Synced <b>%d</b> of <b>%d</b> nodes (%s%s elapsed)' % [
|
348
351
|
event[:num_successes],
|
349
352
|
event[:num_nodes],
|
350
|
-
|
353
|
+
deletions,
|
351
354
|
humanize_seconds(event[:elapsed])
|
352
355
|
]
|
353
356
|
end
|