mutx 0.2.4 → 0.2.5
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/mutx/background_jobs/workers/alerts_worker.rb +6 -4
- data/lib/mutx/lib/paths.rb +2 -1
- data/lib/mutx/models/alert.rb +8 -2
- data/lib/mutx/routes.rb +3 -1
- data/lib/mutx/routes/alerts_routes.rb +7 -0
- data/lib/mutx/version.rb +1 -1
- data/lib/mutx/view/admin/tasks/_delete_form.mote +1 -1
- data/lib/mutx/view/alerts/_alert.mote +13 -4
- 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: 992bc0922cc0f464cf77fd63fbe1af49d8494fbf
|
4
|
+
data.tar.gz: 55e51b7b64e813f571579e1442304844b766f926
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbfd95ff0feea70db207711e9c9806b7f1f57f91f8c8c0a252b4e2fa1ec4354e74cfdfbe1a0602f2bd87958952b945bd3b4de3118d6a49ee995b3565ca004b06
|
7
|
+
data.tar.gz: 53f56bff5a5f3db0e725b9b3bb7466388118e478199eaa5b822b2c3c152b314124bfd52b5619a000a6ea6a6ca8eb642b5a541d29d82be3250732738e85b1a9a0
|
@@ -18,15 +18,17 @@ module Mutx
|
|
18
18
|
stdout.each do |line|
|
19
19
|
stringio.puts line
|
20
20
|
end
|
21
|
-
rescue Errno::EIO
|
21
|
+
rescue Errno::EIO => e
|
22
|
+
stringio.puts e.message
|
23
|
+
stringio.puts e.backtrace
|
22
24
|
ensure
|
23
25
|
Process.wait pid
|
24
26
|
status = $?.exitstatus
|
25
27
|
end
|
26
|
-
end
|
28
|
+
end
|
27
29
|
rescue => e
|
28
|
-
|
29
|
-
|
30
|
+
stringio.puts e.message
|
31
|
+
stringio.puts e.backtrace
|
30
32
|
raise e
|
31
33
|
ensure
|
32
34
|
@alert.update_status(status, info: stringio.string)
|
data/lib/mutx/lib/paths.rb
CHANGED
@@ -18,7 +18,7 @@ module Mutx
|
|
18
18
|
admin_tasks_delete: '/admin/tasks/:task_id/delete',
|
19
19
|
admin_tasks_create: '/admin/tasks',
|
20
20
|
admin_tasks_update: '/admin/tasks/:task_id',
|
21
|
-
admin_tasks_destroy: '/admin/tasks
|
21
|
+
admin_tasks_destroy: '/admin/tasks/:task_id/delete',
|
22
22
|
|
23
23
|
admin_custom_params_index: '/admin/custom-params',
|
24
24
|
admin_custom_params_new: '/admin/custom-params/new',
|
@@ -60,6 +60,7 @@ module Mutx
|
|
60
60
|
alerts_show: '/alerts/:alert_name',
|
61
61
|
alerts_on: '/alerts/:alert_name/run',
|
62
62
|
alerts_off: '/alerts/:alert_name/stop',
|
63
|
+
alerts_clear: '/alerts/:alert_name/clear',
|
63
64
|
|
64
65
|
features_index: '/features',
|
65
66
|
features_file: '/features/file',
|
data/lib/mutx/models/alert.rb
CHANGED
@@ -115,9 +115,9 @@ module Mutx
|
|
115
115
|
|
116
116
|
def update_status(a_new_status, info: nil)
|
117
117
|
last_result = self.result
|
118
|
-
return if ((last_result.to_s == a_new_status.to_s) or (
|
118
|
+
return if ((last_result.to_s == a_new_status.to_s) or (a_new_status.to_i == STATUS[:skip]))
|
119
119
|
self.result = a_new_status
|
120
|
-
notify(info) if last_result
|
120
|
+
notify(info) if last_result || a_new_status.to_i == STATUS[:unknown]
|
121
121
|
end
|
122
122
|
|
123
123
|
def result
|
@@ -132,6 +132,12 @@ module Mutx
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
+
def clear
|
136
|
+
Sidekiq.redis do |redis|
|
137
|
+
redis.del("alerts:#{name}")
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
135
141
|
private
|
136
142
|
def extract_info
|
137
143
|
content = File.read(File.join(ALERT_FOLDER, filename))
|
data/lib/mutx/routes.rb
CHANGED
@@ -48,13 +48,15 @@ module Mutx
|
|
48
48
|
on('message') { run Mutx::Routes::Message::Routes }
|
49
49
|
on('help') { run Mutx::Routes::Help::Routes }
|
50
50
|
|
51
|
-
on
|
51
|
+
on post do
|
52
52
|
on "pull" do
|
53
53
|
#Check for updates on the branch and make a pull if its outdated
|
54
54
|
Mutx::Support::Git.pull unless Mutx::Support::Git.up_to_date?
|
55
55
|
res.redirect "/tasks"
|
56
56
|
end
|
57
|
+
end
|
57
58
|
|
59
|
+
on get do
|
58
60
|
on "logout" do
|
59
61
|
$result = nil
|
60
62
|
$result = false
|
@@ -32,6 +32,13 @@ module Mutx
|
|
32
32
|
flash[:info] = "Alert off success"
|
33
33
|
res.redirect path_for(:alerts_index)
|
34
34
|
end
|
35
|
+
|
36
|
+
on ':alert_name/clear' do |alert_name|
|
37
|
+
alert = Alert.find(name: alert_name)
|
38
|
+
alert.clear
|
39
|
+
flash[:info] = "Alert clear success"
|
40
|
+
res.redirect path_for(:alerts_index)
|
41
|
+
end
|
35
42
|
end
|
36
43
|
end
|
37
44
|
end
|
data/lib/mutx/version.rb
CHANGED
@@ -73,7 +73,7 @@
|
|
73
73
|
<center>
|
74
74
|
|
75
75
|
<input type="submit" class="btn btn-success" value="Delete">
|
76
|
-
<a class="btn btn-danger" href="
|
76
|
+
<a class="btn btn-danger" href="{{ path_for(:admin_tasks_index) }}">Cancel</a>
|
77
77
|
</center>
|
78
78
|
</div>
|
79
79
|
</td>
|
@@ -17,11 +17,13 @@
|
|
17
17
|
|
18
18
|
<td>
|
19
19
|
{{ alert.last_enqueue.strftime("at %I:%M%p") if alert.last_enqueue }}
|
20
|
+
<form name="{{ alert.name }}" method="POST" action="{{ path_for(:alerts_clear, alert_name: alert.name)}}" >
|
21
|
+
<button type="submit">Clear</button>
|
22
|
+
</form>
|
20
23
|
</td>
|
21
24
|
|
22
25
|
<td>
|
23
|
-
<span class="label label-{{ {
|
24
|
-
|
26
|
+
<span class="label label-{{ { ok: 'success', warning: 'warning', critical: 'danger', unknown: 'primary' }[alert.status] }}"> {{ alert.status.upcase }} </span>
|
25
27
|
</td>
|
26
28
|
|
27
29
|
<td>
|
@@ -35,8 +37,15 @@
|
|
35
37
|
<span class="label label-danger"> Stopped </span>
|
36
38
|
</td>
|
37
39
|
|
38
|
-
<td
|
39
|
-
|
40
|
+
<td>
|
41
|
+
{{ alert.last_enqueue.strftime("at %I:%M%p") if alert.last_enqueue }}
|
42
|
+
<form name="{{ alert.name }}" method="POST" action="{{ path_for(:alerts_clear, alert_name: alert.name)}}" >
|
43
|
+
<button type="submit">Clear</button>
|
44
|
+
</form>
|
45
|
+
</td>
|
46
|
+
<td>
|
47
|
+
<span class="label label-{{ { ok: 'success', warning: 'warning', critical: 'danger', unknown: 'primary' }[alert.status] }}"> {{ alert.status.upcase }} </span>
|
48
|
+
</td>
|
40
49
|
<td>
|
41
50
|
<form name="{{ alert.name }}" method="POST" action="{{ path_for(:alerts_on, alert_name: alert.name)}}" >
|
42
51
|
<button type="submit">{{ Mutx::View.icon_for("on") }}</button>
|