MuranoCLI 3.1.0.beta.2 → 3.1.0.beta.3
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/.rubocop.yml +1 -1
- data/MuranoCLI.gemspec +2 -11
- data/lib/MrMurano/commands/logs.rb +64 -65
- data/lib/MrMurano/makePretty.rb +19 -11
- data/lib/MrMurano/version.rb +1 -1
- data/spec/MakePretties_spec.rb +1 -3
- metadata +3 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25973070b3866a68896c64e0e6441c7074843861
|
4
|
+
data.tar.gz: ae58ca8833ece3921eb83bf8599af83fe4f1efbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43414685ea25b78957e864971c26c238883c59bf857bc06615d0bde21be57c8b40688ba44e1bf837bd4648042f18ccc6c0aa25d160e8f4b0e180a09966b02325
|
7
|
+
data.tar.gz: f7135347312c72ed57d579a53b6580fde26c4954fc570025b8e905b2c0c239a3fea4addbb06f6442ba03d3093d1dcfc52d39abc68027c97d19b686bbcb0bfe27
|
data/.rubocop.yml
CHANGED
data/MuranoCLI.gemspec
CHANGED
@@ -29,17 +29,8 @@ And so much more.
|
|
29
29
|
).strip
|
30
30
|
s.required_ruby_version = '~> 2.0'
|
31
31
|
|
32
|
-
#
|
33
|
-
s.post_install_message = %(
|
34
|
-
MuranoCLI v3.0 introduces backwards-incompatible changes.
|
35
|
-
|
36
|
-
If your business was created with MuranoCLI v2.x, you will
|
37
|
-
want to continue using the old gem, which you can run by
|
38
|
-
explicitly specifying the version. For instance,
|
39
|
-
|
40
|
-
murano _2.2.4_ --version
|
41
|
-
|
42
|
-
)
|
32
|
+
# If you want to print a message on Gem install, use the P.I.M., e.g.,:
|
33
|
+
# s.post_install_message = %(...)
|
43
34
|
|
44
35
|
s.files = `git ls-files`.split("\n")
|
45
36
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -81,60 +81,60 @@ class LogsCmd
|
|
81
81
|
|
82
82
|
def cmd_add_help(cmd)
|
83
83
|
cmd.description = %(
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
84
|
+
Get the logs for a solution.
|
85
|
+
|
86
|
+
Each log record contains a number of fields, including the following.
|
87
|
+
|
88
|
+
Severity
|
89
|
+
================================================================
|
90
|
+
The severity of the log message, as defined by rsyslog standard.
|
91
|
+
|
92
|
+
ID | Name | Description
|
93
|
+
-- | ------------- | -----------------------------------------
|
94
|
+
0 | Emergency | System is unusable
|
95
|
+
1 | Alert | Action must be taken immediately
|
96
|
+
2 | Critical | Critical conditions
|
97
|
+
3 | Error | Error conditions
|
98
|
+
4 | Warning | Warning conditions
|
99
|
+
5 | Notice | Normal but significant condition
|
100
|
+
6 | Informational | Informational messages
|
101
|
+
7 | Debug | Debug-level messages
|
102
|
+
|
103
|
+
Type
|
104
|
+
================================================================
|
105
|
+
The type (emitter system) of the message.
|
106
|
+
|
107
|
+
Name | Description
|
108
|
+
------- | ----------------------------------------------------
|
109
|
+
Script | Script Engine: When User Lua script calls `print()`
|
110
|
+
Call | Dispatcher: On service calls from Lua
|
111
|
+
Event | Dispatcher: On event trigger from services
|
112
|
+
Config | API: On solution configuration change, or
|
113
|
+
| used service deprecation warning
|
114
|
+
Service | Services generated & transmitted to Dispatcher
|
115
|
+
|
116
|
+
|
117
|
+
Message
|
118
|
+
================================================================
|
119
|
+
Message can be up to 64kb containing plain text describing a log
|
120
|
+
of the event.
|
121
|
+
|
122
|
+
Service
|
123
|
+
================================================================
|
124
|
+
The service via which the event name is coming or the service of
|
125
|
+
which the function is called.
|
126
|
+
|
127
|
+
Event
|
128
|
+
================================================================
|
129
|
+
Depending on the type:
|
130
|
+
|
131
|
+
Event, Script => Event name
|
132
|
+
Call => operationId
|
133
|
+
|
134
|
+
Tracking ID
|
135
|
+
================================================================
|
136
|
+
End to end Murano processing id.
|
137
|
+
Used to group logs together for one endpoint request.
|
138
138
|
).strip
|
139
139
|
end
|
140
140
|
|
@@ -277,16 +277,15 @@ class LogsCmd
|
|
277
277
|
end
|
278
278
|
|
279
279
|
def cmd_add_filter_options(cmd)
|
280
|
-
# Common log fields.
|
281
280
|
cmd_add_filter_option_severity(cmd)
|
282
281
|
cmd_add_filter_option_type(cmd)
|
283
282
|
cmd_add_filter_option_message(cmd)
|
284
283
|
cmd_add_filter_option_service(cmd)
|
285
284
|
cmd_add_filter_option_event(cmd)
|
285
|
+
# FIXME/2018-01-12: MUR-5446: Backend issue supporting endpoint query.
|
286
|
+
# cmd_add_filter_option_endpoint(cmd)
|
286
287
|
# Skipping: timestamp filter
|
287
288
|
# Skipping: tracking_id filter
|
288
|
-
# Type-specific fields in data.
|
289
|
-
cmd_add_filter_option_endpoint(cmd)
|
290
289
|
# Skipping: module filter
|
291
290
|
# Skipping: elapsed time filter (i.e., could do { elapsed: { $gt: 10 } })
|
292
291
|
end
|
@@ -295,9 +294,9 @@ class LogsCmd
|
|
295
294
|
cmd.option(
|
296
295
|
'-l', '--severity [NAME|LEVEL|RANGE[,NAME|LEVEL|RANGE...]]', Array,
|
297
296
|
%(
|
298
|
-
|
299
|
-
|
300
|
-
|
297
|
+
Only show log entries of this severity.
|
298
|
+
May be specified by name, value, or range, e.g., WARN, 3, 1-4.
|
299
|
+
#{LOG_SEVERITIES.map.with_index { |s, i| "#{s}(#{i})" }.join(' ')}
|
301
300
|
).strip
|
302
301
|
) do |value|
|
303
302
|
@filter_severity.push value
|
@@ -306,10 +305,10 @@ class LogsCmd
|
|
306
305
|
|
307
306
|
def cmd_add_filter_option_type(cmd)
|
308
307
|
emitter_type_help = %(
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
308
|
+
Filter log entries by type (emitter system) of message.
|
309
|
+
EMITTERS is 1 or more comma-separated types:
|
310
|
+
#{LOG_EMITTER_TYPES.map(&:to_s)}
|
311
|
+
Use a "#{INCLUDE_INDICATOR}" or "#{EXCLUDE_INDICATOR}" prefix to include or exclude types, respectively.
|
313
312
|
).strip
|
314
313
|
cmd.option('-T EMITTERS', '--types EMITTERS', Array, emitter_type_help) do |values|
|
315
314
|
# This seems a little roundabout, but rb-commander only keeps last value.
|
@@ -532,7 +531,7 @@ class LogsCmd
|
|
532
531
|
else
|
533
532
|
operator = '$nin'
|
534
533
|
end
|
535
|
-
query_parts[field] = {
|
534
|
+
query_parts[field] = { operator.to_s => resolved_terms }
|
536
535
|
end
|
537
536
|
|
538
537
|
def term_indicates_exclude?(term)
|
data/lib/MrMurano/makePretty.rb
CHANGED
@@ -216,7 +216,6 @@ module MrMurano
|
|
216
216
|
def self.log_pretty_assemble_body(line, options)
|
217
217
|
out = ''
|
218
218
|
return out if options.one_line
|
219
|
-
@body_prefix = options.indent && ' ' || ''
|
220
219
|
out += log_pretty_assemble_message(line, options)
|
221
220
|
return out if options.message_only
|
222
221
|
out += log_pretty_assemble_data(line, options)
|
@@ -224,9 +223,9 @@ module MrMurano
|
|
224
223
|
out + log_pretty_assemble_tracking_id(line, options)
|
225
224
|
end
|
226
225
|
|
227
|
-
def self.log_pretty_assemble_message(line,
|
226
|
+
def self.log_pretty_assemble_message(line, options)
|
228
227
|
return '' unless line.key?(:message) && !line[:message].to_s.empty?
|
229
|
-
|
228
|
+
body_prefix(options) + line[:message] + "\n"
|
230
229
|
end
|
231
230
|
|
232
231
|
def self.log_pretty_assemble_data(line, options)
|
@@ -244,8 +243,12 @@ module MrMurano
|
|
244
243
|
|
245
244
|
def self.log_pretty_emphasize_entry(entry, hash, options)
|
246
245
|
return '' unless hash.key?(entry) && !hash[entry].empty?
|
247
|
-
out =
|
248
|
-
out
|
246
|
+
out = body_prefix(options) + "---------\n" && options.separators || ''
|
247
|
+
out + log_pretty_entry_value(entry, hash, options)
|
248
|
+
end
|
249
|
+
|
250
|
+
def self.log_pretty_entry_value(entry, hash, options)
|
251
|
+
out = body_prefix(options) + "#{entry}: "
|
249
252
|
out += log_pretty_json(hash[entry], options)
|
250
253
|
out + "\n"
|
251
254
|
end
|
@@ -257,8 +260,8 @@ module MrMurano
|
|
257
260
|
]
|
258
261
|
data = data.reject { |key, _val| known_keys.include?(key) }
|
259
262
|
return '' if data.empty?
|
260
|
-
out = options.separators && (
|
261
|
-
out +
|
263
|
+
out = options.separators && (body_prefix(options) + "---------\n") || ''
|
264
|
+
out + body_prefix(options) + 'data: ' + log_pretty_json(data, options) + "\n"
|
262
265
|
end
|
263
266
|
|
264
267
|
def self.log_pretty_assemble_remainder(line, options)
|
@@ -274,21 +277,26 @@ module MrMurano
|
|
274
277
|
]
|
275
278
|
line = line.reject { |key, _val| known_keys.include?(key) }
|
276
279
|
return '' if line.empty?
|
277
|
-
|
280
|
+
body_prefix(options) + log_pretty_json(line, options) + "\n"
|
278
281
|
end
|
279
282
|
|
280
283
|
def self.log_pretty_assemble_tracking_id(line, options)
|
281
284
|
return '' unless options.tracking
|
282
|
-
|
285
|
+
log_pretty_entry_value(:tracking_id, line, options)
|
283
286
|
end
|
284
287
|
|
285
288
|
def self.log_pretty_json(hash, options)
|
286
289
|
return '' if hash.empty?
|
287
|
-
prefix =
|
290
|
+
prefix = body_prefix(options)
|
291
|
+
prefix = prefix.to_s.empty? && ' ' || prefix
|
288
292
|
makeJsonPretty(
|
289
|
-
hash, options, indent: prefix, object_nl: "\n" +
|
293
|
+
hash, options, indent: prefix, object_nl: "\n" + prefix
|
290
294
|
)
|
291
295
|
end
|
296
|
+
|
297
|
+
def self.body_prefix(options)
|
298
|
+
options.indent && ' ' || ''
|
299
|
+
end
|
292
300
|
end
|
293
301
|
end
|
294
302
|
|
data/lib/MrMurano/version.rb
CHANGED
@@ -26,7 +26,7 @@ module MrMurano
|
|
26
26
|
# '3.0.0-beta.2' is changed to '3.0.0.pre.beta.2'
|
27
27
|
# which breaks our build (which expects the version to match herein).
|
28
28
|
# So stick to using the '.pre.X' syntax, which ruby/gems knows.
|
29
|
-
VERSION = '3.1.0.beta.
|
29
|
+
VERSION = '3.1.0.beta.3'
|
30
30
|
EXE_NAME = File.basename($PROGRAM_NAME)
|
31
31
|
SIGN_UP_URL = 'https://exosite.com/signup/'
|
32
32
|
end
|
data/spec/MakePretties_spec.rb
CHANGED
@@ -60,9 +60,7 @@ RSpec.describe MrMurano::Pretties do
|
|
60
60
|
subject: 'websocket_websocket_info',
|
61
61
|
data: 'Script Error: ', }
|
62
62
|
ldt = Time.at(1_476_386_031).localtime.strftime('%Y-%m-%d %H:%M:%S')
|
63
|
-
|
64
|
-
hour_of_day = (local_user == 'travis') && '19' || '14'
|
65
|
-
str = "\e[36mDEBUG \e[0m\e[36m[websocket_websocket_info]\e[0m \e[34m2016-10-13 #{hour_of_day}:13:51\e[0m:\nScript Error: "
|
63
|
+
str = "\e[36mDEBUG \e[0m\e[36m[websocket_websocket_info]\e[0m \e[34m#{ldt}\e[0m:\nScript Error: "
|
66
64
|
@options[:localtime] = true
|
67
65
|
ret = MrMurano::Pretties.MakePrettyLogsV1(data, @options)
|
68
66
|
@options[:localtime] = false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: MuranoCLI
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.0.beta.
|
4
|
+
version: 3.1.0.beta.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Conrad Tadpol Tilstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: certified
|
@@ -640,16 +640,7 @@ homepage: https://github.com/exosite/MuranoCLI
|
|
640
640
|
licenses:
|
641
641
|
- MIT
|
642
642
|
metadata: {}
|
643
|
-
post_install_message:
|
644
|
-
|
645
|
-
MuranoCLI v3.0 introduces backwards-incompatible changes.
|
646
|
-
|
647
|
-
If your business was created with MuranoCLI v2.x, you will
|
648
|
-
want to continue using the old gem, which you can run by
|
649
|
-
explicitly specifying the version. For instance,
|
650
|
-
|
651
|
-
murano _2.2.4_ --version
|
652
|
-
|
643
|
+
post_install_message:
|
653
644
|
rdoc_options: []
|
654
645
|
require_paths:
|
655
646
|
- lib
|