morpheus-cli 4.2.12 → 4.2.13
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/Dockerfile +1 -1
- data/lib/morpheus/cli/apps.rb +2 -1
- data/lib/morpheus/cli/cli_registry.rb +7 -1
- data/lib/morpheus/cli/clusters.rb +2 -1
- data/lib/morpheus/cli/containers_command.rb +2 -1
- data/lib/morpheus/cli/health_command.rb +4 -3
- data/lib/morpheus/cli/hosts.rb +2 -1
- data/lib/morpheus/cli/instances.rb +2 -1
- data/lib/morpheus/cli/logs_command.rb +3 -2
- data/lib/morpheus/cli/mixins/logs_helper.rb +18 -9
- data/lib/morpheus/cli/remote.rb +5 -8
- data/lib/morpheus/cli/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: 2788d4682a38deca42b716fa364b76fa58b81bc4dd0d9e0d61088029462684f9
|
4
|
+
data.tar.gz: 68fa32a490908ba747a7ea4ce63e34a6894e7e0398592a7a53e01fa688f237de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25a714b9505f60ad3c71da4b1af361f32112efe774ec08f1fb85c162f59e62150410127ed3b34f37de23a71ebc2857b112cf68b9d0501478bf401d348553473c
|
7
|
+
data.tar.gz: 6ec182c42b61ebf359e3ea9158c63e109b3a5369bc4242e5cad80355dd6093b82e6593d26c7968683e55903ee184791187b0db5f470ff0b100b16fdaeb5ba2b3
|
data/Dockerfile
CHANGED
data/lib/morpheus/cli/apps.rb
CHANGED
@@ -1303,7 +1303,7 @@ EOT
|
|
1303
1303
|
# options[:interval] = parse_time(val).utc.iso8601
|
1304
1304
|
# end
|
1305
1305
|
opts.on('--level VALUE', String, "Log Level. DEBUG,INFO,WARN,ERROR") do |val|
|
1306
|
-
params['level'] = params['level'] ? [params['level'], val].flatten : val
|
1306
|
+
params['level'] = params['level'] ? [params['level'], val].flatten : [val]
|
1307
1307
|
end
|
1308
1308
|
opts.on('--table', '--table', "Format ouput as a table.") do
|
1309
1309
|
options[:table] = true
|
@@ -1346,6 +1346,7 @@ EOT
|
|
1346
1346
|
end
|
1347
1347
|
end
|
1348
1348
|
params = {}
|
1349
|
+
params['level'] = params['level'].collect {|it| it.to_s.upcase }.join('|') if params['level'] # api works with INFO|WARN
|
1349
1350
|
params.merge!(parse_list_options(options))
|
1350
1351
|
params['query'] = params.delete('phrase') if params['phrase']
|
1351
1352
|
params['order'] = params['direction'] unless params['direction'].nil? # old api version expects order instead of direction
|
@@ -128,6 +128,11 @@ module Morpheus
|
|
128
128
|
previous_command_result = nil
|
129
129
|
current_operator = nil
|
130
130
|
still_executing = true
|
131
|
+
# need to error before executing anything, could be dangerous otherwise!
|
132
|
+
# also maybe only pass flow commands if they have a space on either side..
|
133
|
+
if flow.include?("|")
|
134
|
+
raise Morpheus::Cli::ExpressionParser::InvalidExpression.new "The PIPE (|) operator is not yet supported. You can wrap your arguments in quotations."
|
135
|
+
end
|
131
136
|
flow.each do |flow_cmd|
|
132
137
|
if still_executing
|
133
138
|
if flow_cmd == '&&'
|
@@ -144,7 +149,8 @@ module Morpheus
|
|
144
149
|
still_executing = false
|
145
150
|
end
|
146
151
|
elsif flow_cmd == '|' # or with previous command
|
147
|
-
|
152
|
+
# todo, handle pipe!
|
153
|
+
raise Morpheus::Cli::ExpressionParser::InvalidExpression.new "The PIPE (|) operator is not yet supported. You can wrap your arguments in quotations."
|
148
154
|
previous_command_result = nil
|
149
155
|
still_executing = false
|
150
156
|
# or just continue?
|
@@ -836,7 +836,7 @@ class Morpheus::Cli::Clusters
|
|
836
836
|
options[:end] = parse_time(val) #.utc.iso8601
|
837
837
|
end
|
838
838
|
opts.on('--level VALUE', String, "Log Level. DEBUG,INFO,WARN,ERROR") do |val|
|
839
|
-
params['level'] = params['level'] ? [params['level'], val].flatten : val
|
839
|
+
params['level'] = params['level'] ? [params['level'], val].flatten : [val]
|
840
840
|
end
|
841
841
|
opts.on('--table', '--table', "Format ouput as a table.") do
|
842
842
|
options[:table] = true
|
@@ -854,6 +854,7 @@ class Morpheus::Cli::Clusters
|
|
854
854
|
begin
|
855
855
|
cluster = find_cluster_by_name_or_id(args[0])
|
856
856
|
params = {}
|
857
|
+
params['level'] = params['level'].collect {|it| it.to_s.upcase }.join('|') if params['level'] # api works with INFO|WARN
|
857
858
|
params.merge!(parse_list_options(options))
|
858
859
|
params['query'] = params.delete('phrase') if params['phrase']
|
859
860
|
params['startMs'] = (options[:start].to_i * 1000) if options[:start]
|
@@ -519,7 +519,7 @@ class Morpheus::Cli::ContainersCommand
|
|
519
519
|
options[:end] = parse_time(val) #.utc.iso8601
|
520
520
|
end
|
521
521
|
opts.on('--level VALUE', String, "Log Level. DEBUG,INFO,WARN,ERROR") do |val|
|
522
|
-
params['level'] = params['level'] ? [params['level'], val].flatten : val
|
522
|
+
params['level'] = params['level'] ? [params['level'], val].flatten : [val]
|
523
523
|
end
|
524
524
|
opts.on('--table', '--table', "Format ouput as a table.") do
|
525
525
|
options[:table] = true
|
@@ -541,6 +541,7 @@ class Morpheus::Cli::ContainersCommand
|
|
541
541
|
id_list = parse_id_list(args)
|
542
542
|
begin
|
543
543
|
containers = id_list # heh
|
544
|
+
params['level'] = params['level'].collect {|it| it.to_s.upcase }.join('|') if params['level'] # api works with INFO|WARN
|
544
545
|
params.merge!(parse_list_options(options))
|
545
546
|
params['query'] = params.delete('phrase') if params['phrase']
|
546
547
|
params[:order] = params[:direction] unless params[:direction].nil? # old api version expects order instead of direction
|
@@ -457,7 +457,7 @@ class Morpheus::Cli::HealthCommand
|
|
457
457
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
458
458
|
opts.banner = subcommand_usage()
|
459
459
|
opts.on('--level VALUE', String, "Log Level. DEBUG,INFO,WARN,ERROR") do |val|
|
460
|
-
params['level'] = params['level'] ? [params['level'], val].flatten : val
|
460
|
+
params['level'] = params['level'] ? [params['level'], val].flatten : [val]
|
461
461
|
end
|
462
462
|
opts.on('--start TIMESTAMP','--start TIMESTAMP', "Start timestamp. Default is 30 days ago.") do |val|
|
463
463
|
start_date = parse_time(val) #.utc.iso8601
|
@@ -465,7 +465,7 @@ class Morpheus::Cli::HealthCommand
|
|
465
465
|
opts.on('--end TIMESTAMP','--end TIMESTAMP', "End timestamp. Default is now.") do |val|
|
466
466
|
end_date = parse_time(val) #.utc.iso8601
|
467
467
|
end
|
468
|
-
opts.on('
|
468
|
+
opts.on('-t', '--table', "Format output as a table.") do
|
469
469
|
options[:table] = true
|
470
470
|
end
|
471
471
|
opts.on('-a', '--all', "Display all details: entire message." ) do
|
@@ -484,6 +484,7 @@ class Morpheus::Cli::HealthCommand
|
|
484
484
|
# params['endDate'] = end_date.utc.iso8601 if end_date
|
485
485
|
params['startMs'] = (start_date.to_i * 1000) if start_date
|
486
486
|
params['endMs'] = (end_date.to_i * 1000) if end_date
|
487
|
+
params['level'] = params['level'].collect {|it| it.to_s.upcase }.join('|') if params['level'] # api works with INFO|WARN
|
487
488
|
params.merge!(parse_list_options(options))
|
488
489
|
@health_interface.setopts(options)
|
489
490
|
if options[:dry_run]
|
@@ -497,7 +498,7 @@ class Morpheus::Cli::HealthCommand
|
|
497
498
|
title = "Morpheus Health Logs"
|
498
499
|
subtitles = []
|
499
500
|
if params['level']
|
500
|
-
subtitles << "Level: #{params['level']}"
|
501
|
+
subtitles << "Level: #{[params['level']].flatten.join(',')}"
|
501
502
|
end
|
502
503
|
if start_date
|
503
504
|
subtitles << "Start: #{start_date}"
|
data/lib/morpheus/cli/hosts.rb
CHANGED
@@ -582,7 +582,7 @@ class Morpheus::Cli::Hosts
|
|
582
582
|
options[:end] = parse_time(val) #.utc.iso8601
|
583
583
|
end
|
584
584
|
opts.on('--level VALUE', String, "Log Level. DEBUG,INFO,WARN,ERROR") do |val|
|
585
|
-
params['level'] = params['level'] ? [params['level'], val].flatten : val
|
585
|
+
params['level'] = params['level'] ? [params['level'], val].flatten : [val]
|
586
586
|
end
|
587
587
|
opts.on('--table', '--table', "Format ouput as a table.") do
|
588
588
|
options[:table] = true
|
@@ -600,6 +600,7 @@ class Morpheus::Cli::Hosts
|
|
600
600
|
connect(options)
|
601
601
|
begin
|
602
602
|
server = find_host_by_name_or_id(args[0])
|
603
|
+
params['level'] = params['level'].collect {|it| it.to_s.upcase }.join('|') if params['level'] # api works with INFO|WARN
|
603
604
|
params.merge!(parse_list_options(options))
|
604
605
|
params['query'] = params.delete('phrase') if params['phrase']
|
605
606
|
params['order'] = params['direction'] unless params['direction'].nil? # old api version expects order instead of direction
|
@@ -1009,7 +1009,7 @@ class Morpheus::Cli::Instances
|
|
1009
1009
|
# options[:interval] = parse_time(val).utc.iso8601
|
1010
1010
|
# end
|
1011
1011
|
opts.on('--level VALUE', String, "Log Level. DEBUG,INFO,WARN,ERROR") do |val|
|
1012
|
-
params['level'] = params['level'] ? [params['level'], val].flatten : val
|
1012
|
+
params['level'] = params['level'] ? [params['level'], val].flatten : [val]
|
1013
1013
|
end
|
1014
1014
|
opts.on('--table', '--table', "Format ouput as a table.") do
|
1015
1015
|
options[:table] = true
|
@@ -1036,6 +1036,7 @@ class Morpheus::Cli::Instances
|
|
1036
1036
|
return 1
|
1037
1037
|
end
|
1038
1038
|
end
|
1039
|
+
params['level'] = params['level'].collect {|it| it.to_s.upcase }.join('|') if params['level'] # api works with INFO|WARN
|
1039
1040
|
params.merge!(parse_list_options(options))
|
1040
1041
|
params['query'] = params.delete('phrase') if params['phrase']
|
1041
1042
|
params['order'] = params['direction'] unless params['direction'].nil? # old api version expects order instead of direction
|
@@ -63,9 +63,9 @@ class Morpheus::Cli::LogsCommand
|
|
63
63
|
# options[:interval] = parse_time(val).utc.iso8601
|
64
64
|
# end
|
65
65
|
opts.on('--level VALUE', String, "Log Level. DEBUG,INFO,WARN,ERROR") do |val|
|
66
|
-
params['level'] = params['level'] ? [params['level'], val].flatten : val
|
66
|
+
params['level'] = params['level'] ? [params['level'], val].flatten : [val]
|
67
67
|
end
|
68
|
-
opts.on('
|
68
|
+
opts.on('-t', '--table', "Format ouput as a table.") do
|
69
69
|
options[:table] = true
|
70
70
|
end
|
71
71
|
opts.on('-a', '--all', "Display all details: entire message." ) do
|
@@ -81,6 +81,7 @@ class Morpheus::Cli::LogsCommand
|
|
81
81
|
end
|
82
82
|
connect(options)
|
83
83
|
begin
|
84
|
+
params['level'] = params['level'].collect {|it| it.to_s.upcase }.join('|') if params['level'] # api works with INFO|WARN
|
84
85
|
params.merge!(parse_list_options(options))
|
85
86
|
params['query'] = params.delete('phrase') if params['phrase']
|
86
87
|
params['order'] = params['direction'] unless params['direction'].nil? # old api version expects order instead of direction
|
@@ -45,6 +45,8 @@ module Morpheus::Cli::LogsHelper
|
|
45
45
|
end
|
46
46
|
out = ""
|
47
47
|
table_color = options.key?(:color) ? options[:color] : cyan
|
48
|
+
term_width = current_terminal_width()
|
49
|
+
message_col_width = current_terminal_width() - (show_object ? 56 : 36)
|
48
50
|
log_records.each do |log_entry|
|
49
51
|
log_level = format_log_level(log_entry['level'], table_color, 6)
|
50
52
|
out << table_color if table_color
|
@@ -52,15 +54,20 @@ module Morpheus::Cli::LogsHelper
|
|
52
54
|
out << "#{log_level} "
|
53
55
|
out << "[#{log_entry['ts']}] "
|
54
56
|
if show_object
|
55
|
-
|
57
|
+
log_src = "#{log_entry['typeCode']} #{log_entry['objectId']}"
|
58
|
+
if options[:details] || options[:all]
|
59
|
+
# log_src = "#{log_entry['typeCode']} #{log_entry['objectId']}"
|
60
|
+
else
|
61
|
+
log_src = truncate_string(log_src, 20)
|
62
|
+
end
|
63
|
+
out << "(#{log_src}) "
|
56
64
|
end
|
57
65
|
log_msg = ""
|
58
66
|
if options[:details] || options[:all]
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
end
|
67
|
+
log_msg = log_entry['message'].to_s.strip
|
68
|
+
else
|
69
|
+
log_msg = truncate_string(log_entry['message'].to_s.strip.gsub(/\r?\n/, " "), message_col_width)
|
70
|
+
end
|
64
71
|
out << "- #{log_msg}"
|
65
72
|
out << table_color if table_color
|
66
73
|
out << "\n"
|
@@ -71,15 +78,17 @@ module Morpheus::Cli::LogsHelper
|
|
71
78
|
def format_log_table(logs, options={}, show_object=true)
|
72
79
|
out = ""
|
73
80
|
table_color = options.key?(:color) ? options[:color] : cyan
|
81
|
+
term_width = current_terminal_width()
|
82
|
+
message_col_width = current_terminal_width() - (show_object ? 56 : 36)
|
74
83
|
log_columns = [
|
75
84
|
{"LEVEL" => lambda {|log_entry| format_log_level(log_entry['level'], table_color) } },
|
76
85
|
{"DATE" => lambda {|log_entry| log_entry['ts'] } },
|
77
86
|
{"SOURCE" => lambda {|log_entry| "#{log_entry['typeCode']} #{log_entry['objectId']}" } },
|
78
87
|
{"MESSAGE" => lambda {|log_entry|
|
79
88
|
if options[:details] || options[:all]
|
80
|
-
log_entry['message'].to_s
|
89
|
+
log_entry['message'].to_s.strip
|
81
90
|
else
|
82
|
-
truncate_string(log_entry['message'].to_s.
|
91
|
+
truncate_string(log_entry['message'].to_s.strip.gsub(/\r?\n/, " "), message_col_width)
|
83
92
|
end
|
84
93
|
} }
|
85
94
|
]
|
@@ -89,7 +98,7 @@ module Morpheus::Cli::LogsHelper
|
|
89
98
|
# if options[:include_fields]
|
90
99
|
# columns = options[:include_fields]
|
91
100
|
# end
|
92
|
-
out << as_pretty_table(logs, log_columns, options.merge(
|
101
|
+
out << as_pretty_table(logs, log_columns, options.merge(wrap:true))
|
93
102
|
# out << "\n"
|
94
103
|
return out
|
95
104
|
end
|
data/lib/morpheus/cli/remote.rb
CHANGED
@@ -302,15 +302,12 @@ EOT
|
|
302
302
|
# secure is the default,
|
303
303
|
# try to only store insecure:false in the appliances config
|
304
304
|
if url.to_s =~ /^https\:/ && secure.nil?
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
#v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'secure', 'fieldLabel' => 'Secure', 'type' => 'checkbox', 'required' => false, 'defaultValue' => true, 'description' => 'Prevent insecure HTTPS communication, respect SSL errors.'}], options[:options])
|
309
|
-
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'insecure', 'fieldLabel' => 'Insecure (Ignore SSL Errors)', 'type' => 'checkbox', 'required' => false, 'defaultValue' => false, 'description' => 'Allow insecure HTTPS communication, ignore SSL errors.'}], options[:options])
|
310
|
-
if v_prompt['insecure'].to_s == 'true' || v_prompt['insecure'].to_s == 'on'
|
311
|
-
new_appliance_map[:insecure] = true
|
312
|
-
end
|
305
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'insecure', 'fieldLabel' => 'Insecure (Ignore SSL Errors)', 'type' => 'checkbox', 'required' => false, 'defaultValue' => false, 'description' => 'Allow insecure HTTPS communication, ignore SSL errors.'}], options[:options])
|
306
|
+
if v_prompt['insecure'].to_s == 'true' || v_prompt['insecure'].to_s == 'on'
|
307
|
+
new_appliance_map[:insecure] = true
|
313
308
|
end
|
309
|
+
elsif secure != nil
|
310
|
+
new_appliance_map[:insecure] = !secure
|
314
311
|
end
|
315
312
|
|
316
313
|
# --use
|
data/lib/morpheus/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: morpheus-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Estes
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-05-
|
14
|
+
date: 2020-05-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|