marty 1.0.51 → 1.0.52
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/Gemfile.lock +1 -1
- data/app/components/marty/script_form.rb +12 -14
- data/app/controllers/marty/diagnostic_controller.rb +20 -10
- data/app/controllers/marty/rpc_controller.rb +9 -12
- data/app/views/marty/diagnostic/op.html.erb +1 -0
- data/lib/marty/util.rb +11 -0
- data/lib/marty/version.rb +1 -1
- data/spec/controllers/diagnostic_controller_spec.rb +12 -12
- data/spec/controllers/rpc_controller_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e71e2648231c978b93c862ad779fa0df575f2d63
|
4
|
+
data.tar.gz: 2f4298094bc075059572563c6bd2b50b28592ed7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6540246a26e8de445e57613206a53f15d755848e2a8e3fe0a0ddd2259a5d158fe9402174e87d91aa251313f1d6809102e55f750e4c44ac1b589dc7a427b12e6a
|
7
|
+
data.tar.gz: 1466a7f5b8d6f05c83efd822a6ed47ca0a4698e4ccaae5b68b1326c5cf28b5820120fb995b85a915aeff343fb92460e8ce41d0c452968c9c28b76345e6a756a8
|
data/Gemfile.lock
CHANGED
@@ -59,10 +59,9 @@ class Marty::ScriptForm < Marty::Form
|
|
59
59
|
}
|
60
60
|
JS
|
61
61
|
|
62
|
-
c.
|
63
|
-
function(
|
64
|
-
|
65
|
-
window.location = "#{Marty::Util.marty_path}/job/download?job_id=" + jid;
|
62
|
+
c.get_report = l(<<-JS)
|
63
|
+
function(report_path) {
|
64
|
+
window.location = report_path;
|
66
65
|
}
|
67
66
|
JS
|
68
67
|
end
|
@@ -175,16 +174,15 @@ class Marty::ScriptForm < Marty::Form
|
|
175
174
|
return client.netzke_notify("bad script") unless script
|
176
175
|
|
177
176
|
begin
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
client.download_report job_id
|
177
|
+
rep_params = {
|
178
|
+
script_id: script.id,
|
179
|
+
title: script.name
|
180
|
+
}
|
181
|
+
|
182
|
+
path = Marty::Util.gen_report_path("ScriptReport",
|
183
|
+
"PrettyScript",
|
184
|
+
rep_params)
|
185
|
+
client.get_report(path)
|
188
186
|
rescue => exc
|
189
187
|
return client.netzke_notify "ERROR: #{exc}"
|
190
188
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
+
include ActionView::Helpers::TextHelper
|
1
2
|
require 'erb'
|
3
|
+
|
2
4
|
module Marty
|
3
5
|
class DiagnosticController < ActionController::Base
|
4
6
|
layout false
|
@@ -80,7 +82,7 @@ module Marty
|
|
80
82
|
end
|
81
83
|
|
82
84
|
def self.error message
|
83
|
-
"Failure:
|
85
|
+
"Failure: #{message}"
|
84
86
|
end
|
85
87
|
|
86
88
|
def self.display data, type='nodal'
|
@@ -104,7 +106,7 @@ module Marty
|
|
104
106
|
<tr class="<%=is_failure?(value) ? 'failed' :
|
105
107
|
'passed' %>">
|
106
108
|
<td><%=name%></td>
|
107
|
-
<td class="overflow"><%=value%></td>
|
109
|
+
<td class="overflow"><%=simple_format(value.to_s)%></td>
|
108
110
|
</tr>
|
109
111
|
<% end %>
|
110
112
|
</table>
|
@@ -181,8 +183,8 @@ module Marty
|
|
181
183
|
|
182
184
|
def self.db_version
|
183
185
|
begin
|
184
|
-
|
185
|
-
|
186
|
+
message = ActiveRecord::Base.connection.
|
187
|
+
execute('SELECT VERSION();')[0]['version']
|
186
188
|
rescue => e
|
187
189
|
return error(message)
|
188
190
|
end
|
@@ -191,11 +193,13 @@ module Marty
|
|
191
193
|
|
192
194
|
def self.db_schema
|
193
195
|
begin
|
194
|
-
|
196
|
+
current = ActiveRecord::Migrator.current_version
|
197
|
+
needs_migration = ActiveRecord::Migrator.needs_migration?
|
195
198
|
rescue => e
|
196
199
|
return error(e.message)
|
197
200
|
end
|
198
|
-
|
201
|
+
needs_migration ? error("Migration is needed.\n"\
|
202
|
+
"Current Version: #{current}") : current
|
199
203
|
end
|
200
204
|
end
|
201
205
|
|
@@ -217,11 +221,17 @@ module Marty
|
|
217
221
|
|
218
222
|
class Nodes < Base
|
219
223
|
def self.generate
|
220
|
-
|
224
|
+
begin
|
225
|
+
a_nodes = AwsInstanceInfo.new.nodes.sort if AwsInstanceInfo.is_aws?
|
226
|
+
rescue => e
|
227
|
+
a_nodes = [e.message]
|
228
|
+
end
|
221
229
|
pg_nodes = get_nodes.sort
|
222
|
-
message = pg_nodes == a_nodes ? pg_nodes.join(
|
223
|
-
error("
|
224
|
-
"
|
230
|
+
message = a_nodes.nil? || pg_nodes == a_nodes ? pg_nodes.join("\n") :
|
231
|
+
error("There is a discrepancy between nodes connected to "\
|
232
|
+
"Postgres and those discovered through AWS EC2.\n"\
|
233
|
+
"Postgres: \n#{pg_nodes.join("\n")}\n"\
|
234
|
+
"AWS: \n#{a_nodes.join("\n")}")
|
225
235
|
{"PG/AWS" => message}
|
226
236
|
end
|
227
237
|
end
|
@@ -82,18 +82,15 @@ class Marty::RpcController < ActionController::Base
|
|
82
82
|
end
|
83
83
|
|
84
84
|
return {error: "Malformed params"} unless params.is_a?(Hash)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
opt
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
to_append = {"\$schema" => Marty::JsonSchema::RAW_URI}
|
96
|
-
validation_error = nil
|
85
|
+
need_log,
|
86
|
+
need_input_validate,
|
87
|
+
need_output_validate,
|
88
|
+
need_strict_validate = Marty::ApiConfig.lookup(sname, node, attr)
|
89
|
+
opt = {validate_schema: true,
|
90
|
+
errors_as_objects: true,
|
91
|
+
version: Marty::JsonSchema::RAW_URI }
|
92
|
+
to_append = {"\$schema" => Marty::JsonSchema::RAW_URI}
|
93
|
+
validation_error = nil
|
97
94
|
|
98
95
|
if need_input_validate
|
99
96
|
begin
|
data/lib/marty/util.rb
CHANGED
@@ -121,4 +121,15 @@ module Marty::Util
|
|
121
121
|
|
122
122
|
promise_id
|
123
123
|
end
|
124
|
+
|
125
|
+
# generates the report path to report described by script, node, and params
|
126
|
+
def self.gen_report_path(script, node, params = {})
|
127
|
+
engine = Marty::ScriptSet.new.get_engine(script)
|
128
|
+
format = engine.evaluate(node, 'format')
|
129
|
+
title = params.delete(:title) || engine.evaluate(node, 'title')
|
130
|
+
data = ({selected_script_name: script,
|
131
|
+
selected_node: node} + params).to_json
|
132
|
+
URI.encode("#{Marty::Util.marty_path}/report?data=#{data}"\
|
133
|
+
"&reptitle=#{title}&format=#{format}")
|
134
|
+
end
|
124
135
|
end
|
data/lib/marty/version.rb
CHANGED
@@ -43,19 +43,19 @@ module Marty
|
|
43
43
|
<th colspan="2" class=""><small>consistent</small></th>
|
44
44
|
<tr class="passed">
|
45
45
|
<td>Marty</td>
|
46
|
-
<td class="overflow">#{Marty::VERSION}</td>
|
46
|
+
<td class="overflow"><p>#{Marty::VERSION}</p></td>
|
47
47
|
</tr>
|
48
48
|
<tr class="passed">
|
49
49
|
<td>Delorean</td>
|
50
|
-
<td class="overflow">#{Delorean::VERSION}</td>
|
50
|
+
<td class="overflow"><p>#{Delorean::VERSION}</p></td>
|
51
51
|
</tr>
|
52
52
|
<tr class="passed">
|
53
53
|
<td>Mcfly</td>
|
54
|
-
<td class="overflow">#{Mcfly::VERSION}</td>
|
54
|
+
<td class="overflow"><p>#{Mcfly::VERSION}</p></td>
|
55
55
|
</tr>
|
56
56
|
<tr class="passed">
|
57
57
|
<td>Git</td>
|
58
|
-
<td class="overflow">#{git}</td>
|
58
|
+
<td class="overflow"><p>#{git}</p></td>
|
59
59
|
</tr>
|
60
60
|
</table>
|
61
61
|
</div>
|
@@ -71,38 +71,38 @@ module Marty
|
|
71
71
|
<th colspan="2" class="error"><small>node1</small></th>
|
72
72
|
<tr class="passed">
|
73
73
|
<td>Marty</td>
|
74
|
-
<td class="overflow">#{Marty::VERSION}</td>
|
74
|
+
<td class="overflow"><p>#{Marty::VERSION}</p></td>
|
75
75
|
</tr>
|
76
76
|
<tr class="passed">
|
77
77
|
<td>Delorean</td>
|
78
|
-
<td class="overflow">#{Delorean::VERSION}</td>
|
78
|
+
<td class="overflow"><p>#{Delorean::VERSION}</p></td>
|
79
79
|
</tr>
|
80
80
|
<tr class="passed">
|
81
81
|
<td>Mcfly</td>
|
82
|
-
<td class="overflow">#{Mcfly::VERSION}</td>
|
82
|
+
<td class="overflow"><p>#{Mcfly::VERSION}</p></td>
|
83
83
|
</tr>
|
84
84
|
<tr class="passed">
|
85
85
|
<td>Git</td>
|
86
|
-
<td class="overflow">#{git}</td>
|
86
|
+
<td class="overflow"><p>#{git}</p></td>
|
87
87
|
</tr>
|
88
88
|
</table>
|
89
89
|
<table>
|
90
90
|
<th colspan="2" class="error"><small>node2</small></th>
|
91
91
|
<tr class="passed">
|
92
92
|
<td>Marty</td>
|
93
|
-
<td class="overflow">#{val}</td>
|
93
|
+
<td class="overflow"><p>#{val}</p></td>
|
94
94
|
</tr>
|
95
95
|
<tr class="passed">
|
96
96
|
<td>Delorean</td>
|
97
|
-
<td class="overflow">#{Delorean::VERSION}</td>
|
97
|
+
<td class="overflow"><p>#{Delorean::VERSION}</p></td>
|
98
98
|
</tr>
|
99
99
|
<tr class="passed">
|
100
100
|
<td>Mcfly</td>
|
101
|
-
<td class="overflow">#{Mcfly::VERSION}</td>
|
101
|
+
<td class="overflow"><p>#{Mcfly::VERSION}</p></td>
|
102
102
|
</tr>
|
103
103
|
<tr class="passed">
|
104
104
|
<td>Git</td>
|
105
|
-
<td class="overflow">#{git}</td>
|
105
|
+
<td class="overflow"><p>#{git}</p></td>
|
106
106
|
</tr>
|
107
107
|
</table>
|
108
108
|
</div>
|
@@ -1191,7 +1191,7 @@ describe Marty::RpcController do
|
|
1191
1191
|
].each do
|
1192
1192
|
|a, exp|
|
1193
1193
|
do_call(*a)
|
1194
|
-
res = JSON.parse(response.body)
|
1194
|
+
res = JSON.parse(response.body) rescue response.body
|
1195
1195
|
expect(res.is_a?(Hash) ? res['error'] : res).to include(exp)
|
1196
1196
|
end
|
1197
1197
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.52
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arman Bostani
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2017-11-
|
17
|
+
date: 2017-11-17 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: pg
|