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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cdd1c0a2fb4f63c702cbe7b48a1af13eaeb1701e
4
- data.tar.gz: 85182685d9d2e7d09d1d630f8bf9a42ffc33c52a
3
+ metadata.gz: 992bc0922cc0f464cf77fd63fbe1af49d8494fbf
4
+ data.tar.gz: 55e51b7b64e813f571579e1442304844b766f926
5
5
  SHA512:
6
- metadata.gz: b1a2ca775eea60c56bfd60cf78e03d912ffcc6cef40fb7f967102abe3b28a31be374c4bb573c9d5c43697af5d9c0d05c0c1593e0b6445b331a676d6ed5a9cba8
7
- data.tar.gz: 1de9e41d68850a10d6b1cb4a2b0d596cacc8e6e9ec67d6a30f825e2b5282b6372b62451b861eddb30085654c5cd60f6f403ffab5b32ec953c95449ac52bd1111
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
- logger.debug(e.message)
29
- logger.debug(e.backtrace)
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)
@@ -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/task_id/delete',
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',
@@ -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 (a_new_result.to_i == STATUS[:skip]))
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))
@@ -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 get do
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
@@ -1,3 +1,3 @@
1
1
  module Mutx
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
@@ -73,7 +73,7 @@
73
73
  <center>
74
74
 
75
75
  <input type="submit" class="btn btn-success" value="Delete">&nbsp;
76
- <a class="btn btn-danger" href="/admin/tasks/list">Cancel</a>
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-{{ { success: 'success', warning: 'warning', critical: 'danger', unknown: 'primary' }[alert.status] }}"> {{ alert.status }} </span>
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
- <td/>
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>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mutx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Rodriguez