kennel 1.22.0 → 1.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kennel.rb +5 -0
- data/lib/kennel/models/screen.rb +1 -1
- data/lib/kennel/progress.rb +4 -4
- data/lib/kennel/syncer.rb +10 -10
- data/lib/kennel/unmuted_alerts.rb +5 -5
- data/lib/kennel/utils.rb +16 -16
- data/lib/kennel/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: 54f57edb8166bf98aad7e8e687623f601806795e76c02406ac33954c26a7f7c9
|
4
|
+
data.tar.gz: 3aec9e32679df1ef1d1623be7fd8f329bf05acfd2e73c741e574669a530694cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff156400117553d230a0a25045ede871e29411ad74f744a0d81260fd45bfac8446d68b687615a58f8ed0e788b99e34ff8c5f961ea9b30455adbdf7b3aeee3166
|
7
|
+
data.tar.gz: 2fd54886196b1308830e2717bac2e53b6265fb0dcc510bc4f633940961768a429413122f3358ea1d69d8a599d38792d31b67fba67315636b34dbf4da6989d47b
|
data/lib/kennel.rb
CHANGED
data/lib/kennel/models/screen.rb
CHANGED
@@ -157,7 +157,7 @@ module Kennel
|
|
157
157
|
monitor_path = (id_path.empty? ? widget : widget.dig(*id_path))
|
158
158
|
monitor_path[id_key] =
|
159
159
|
id_map[id] ||
|
160
|
-
|
160
|
+
Kennel.err.puts("Unable to find #{id} in existing monitors (they need to be created first to link them)")
|
161
161
|
end
|
162
162
|
|
163
163
|
def tracking_id?(id)
|
data/lib/kennel/progress.rb
CHANGED
@@ -5,7 +5,7 @@ module Kennel
|
|
5
5
|
class Progress
|
6
6
|
# print what we are doing and a spinner until it is done ... then show how long it took
|
7
7
|
def self.progress(name)
|
8
|
-
|
8
|
+
Kennel.err.print "#{name} ... "
|
9
9
|
|
10
10
|
animation = "-\\|/"
|
11
11
|
count = 0
|
@@ -15,9 +15,9 @@ module Kennel
|
|
15
15
|
spinner = Thread.new do
|
16
16
|
loop do
|
17
17
|
break if stop
|
18
|
-
|
18
|
+
Kennel.err.print animation[count % animation.size]
|
19
19
|
sleep 0.2
|
20
|
-
|
20
|
+
Kennel.err.print "\b"
|
21
21
|
count += 1
|
22
22
|
end
|
23
23
|
end
|
@@ -26,7 +26,7 @@ module Kennel
|
|
26
26
|
|
27
27
|
stop = true
|
28
28
|
spinner.join
|
29
|
-
|
29
|
+
Kennel.err.print "#{time.round(2)}s\n"
|
30
30
|
|
31
31
|
result
|
32
32
|
end
|
data/lib/kennel/syncer.rb
CHANGED
@@ -14,9 +14,9 @@ module Kennel
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def plan
|
17
|
-
puts "Plan:"
|
17
|
+
Kennel.out.puts "Plan:"
|
18
18
|
if noop?
|
19
|
-
puts Utils.color(:green, "Nothing to do")
|
19
|
+
Kennel.out.puts Utils.color(:green, "Nothing to do")
|
20
20
|
else
|
21
21
|
print_plan "Create", @create, :green
|
22
22
|
print_plan "Update", @update, :yellow
|
@@ -32,18 +32,18 @@ module Kennel
|
|
32
32
|
@create.each do |_, e|
|
33
33
|
reply = @api.create e.class.api_resource, e.as_json
|
34
34
|
reply = unnest(e.class.api_resource, reply)
|
35
|
-
puts "Created #{e.class.api_resource} #{tracking_id(e.as_json)} #{e.url(reply.fetch(:id))}"
|
35
|
+
Kennel.out.puts "Created #{e.class.api_resource} #{tracking_id(e.as_json)} #{e.url(reply.fetch(:id))}"
|
36
36
|
end
|
37
37
|
|
38
38
|
block_irreversible_partial_updates
|
39
39
|
@update.each do |id, e|
|
40
40
|
@api.update e.class.api_resource, id, e.as_json
|
41
|
-
puts "Updated #{e.class.api_resource} #{tracking_id(e.as_json)} #{e.url(id)}"
|
41
|
+
Kennel.out.puts "Updated #{e.class.api_resource} #{tracking_id(e.as_json)} #{e.url(id)}"
|
42
42
|
end
|
43
43
|
|
44
44
|
@delete.each do |id, _, a|
|
45
45
|
@api.delete a.fetch(:api_resource), id
|
46
|
-
puts "Deleted #{a.fetch(:api_resource)} #{tracking_id(a)} #{id}"
|
46
|
+
Kennel.out.puts "Deleted #{a.fetch(:api_resource)} #{tracking_id(a)} #{id}"
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -145,7 +145,7 @@ module Kennel
|
|
145
145
|
def print_plan(step, list, color)
|
146
146
|
return if list.empty?
|
147
147
|
list.each do |_, e, a, diff|
|
148
|
-
puts Utils.color(color, "#{step} #{tracking_id(e&.as_json || a)}")
|
148
|
+
Kennel.out.puts Utils.color(color, "#{step} #{tracking_id(e&.as_json || a)}")
|
149
149
|
print_diff(diff) if diff # only for update
|
150
150
|
end
|
151
151
|
end
|
@@ -162,11 +162,11 @@ module Kennel
|
|
162
162
|
end
|
163
163
|
|
164
164
|
if (old + new).size > 100
|
165
|
-
puts " #{type}#{field}"
|
166
|
-
puts " #{old} ->"
|
167
|
-
puts " #{new}"
|
165
|
+
Kennel.out.puts " #{type}#{field}"
|
166
|
+
Kennel.out.puts " #{old} ->"
|
167
|
+
Kennel.out.puts " #{new}"
|
168
168
|
else
|
169
|
-
puts " #{type}#{field} #{old} -> #{new}"
|
169
|
+
Kennel.out.puts " #{type}#{field} #{old} -> #{new}"
|
170
170
|
end
|
171
171
|
end
|
172
172
|
end
|
@@ -14,17 +14,17 @@ module Kennel
|
|
14
14
|
def print(api, tag)
|
15
15
|
monitors = filtered_monitors(api, tag)
|
16
16
|
if monitors.empty?
|
17
|
-
puts "No unmuted alerts found"
|
17
|
+
Kennel.out.puts "No unmuted alerts found"
|
18
18
|
else
|
19
19
|
monitors.each do |m|
|
20
|
-
puts m[:name]
|
21
|
-
puts Utils.path_to_url("/monitors/#{m[:id]}")
|
20
|
+
Kennel.out.puts m[:name]
|
21
|
+
Kennel.out.puts Utils.path_to_url("/monitors/#{m[:id]}")
|
22
22
|
m[:state][:groups].each do |g|
|
23
23
|
color = COLORS[g[:status]] || :default
|
24
24
|
since = "\t#{time_since(g[:last_triggered_ts])}"
|
25
|
-
puts "#{Kennel::Utils.color(color, g[:status])}\t#{g[:name]}#{since}"
|
25
|
+
Kennel.out.puts "#{Kennel::Utils.color(color, g[:status])}\t#{g[:name]}#{since}"
|
26
26
|
end
|
27
|
-
puts
|
27
|
+
Kennel.out.puts
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
data/lib/kennel/utils.rb
CHANGED
@@ -26,11 +26,11 @@ module Kennel
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def ask(question)
|
29
|
-
|
29
|
+
Kennel.err.printf color(:red, "#{question} - press 'y' to continue: ")
|
30
30
|
begin
|
31
31
|
STDIN.gets.chomp == "y"
|
32
32
|
rescue Interrupt # do not show a backtrace if user decides to Ctrl+C here
|
33
|
-
|
33
|
+
Kennel.err.print "\n"
|
34
34
|
exit 1
|
35
35
|
end
|
36
36
|
end
|
@@ -44,34 +44,34 @@ module Kennel
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def capture_stdout
|
47
|
-
old =
|
48
|
-
|
47
|
+
old = Kennel.out
|
48
|
+
Kennel.out = StringIO.new
|
49
49
|
yield
|
50
|
-
|
50
|
+
Kennel.out.string
|
51
51
|
ensure
|
52
|
-
|
52
|
+
Kennel.out = old
|
53
53
|
end
|
54
54
|
|
55
55
|
def capture_stderr
|
56
|
-
old =
|
57
|
-
|
56
|
+
old = Kennel.err
|
57
|
+
Kennel.err = StringIO.new
|
58
58
|
yield
|
59
|
-
|
59
|
+
Kennel.err.string
|
60
60
|
ensure
|
61
|
-
|
61
|
+
Kennel.err = old
|
62
62
|
end
|
63
63
|
|
64
64
|
def tee_output
|
65
|
-
old_stdout =
|
66
|
-
old_stderr =
|
65
|
+
old_stdout = Kennel.out
|
66
|
+
old_stderr = Kennel.err
|
67
67
|
capture = StringIO.new
|
68
|
-
|
69
|
-
|
68
|
+
Kennel.out = TeeIO.new([capture, Kennel.out])
|
69
|
+
Kennel.err = TeeIO.new([capture, Kennel.err])
|
70
70
|
yield
|
71
71
|
capture.string
|
72
72
|
ensure
|
73
|
-
|
74
|
-
|
73
|
+
Kennel.out = old_stdout
|
74
|
+
Kennel.err = old_stderr
|
75
75
|
end
|
76
76
|
|
77
77
|
def capture_sh(command)
|
data/lib/kennel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kennel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|