morpheus-cli 5.5.3 → 5.5.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/lib/morpheus/api/api_client.rb +12 -0
- data/lib/morpheus/api/appliance_settings_interface.rb +15 -0
- data/lib/morpheus/api/cypher_interface.rb +1 -2
- data/lib/morpheus/api/guidance_settings_interface.rb +17 -0
- data/lib/morpheus/api/monitoring_settings_interface.rb +25 -0
- data/lib/morpheus/api/network_server_groups_interface.rb +7 -0
- data/lib/morpheus/cli/cli_command.rb +10 -1
- data/lib/morpheus/cli/commands/appliance_settings_command.rb +57 -2
- data/lib/morpheus/cli/commands/backup_settings_command.rb +1 -1
- data/lib/morpheus/cli/commands/catalog_item_types_command.rb +6 -1
- data/lib/morpheus/cli/commands/cypher_command.rb +3 -0
- data/lib/morpheus/cli/commands/guidance_command.rb +2 -2
- data/lib/morpheus/cli/commands/guidance_settings.rb +148 -0
- data/lib/morpheus/cli/commands/log_settings_command.rb +1 -1
- data/lib/morpheus/cli/commands/monitoring_settings.rb +228 -0
- data/lib/morpheus/cli/commands/network_server_groups_command.rb +222 -0
- data/lib/morpheus/cli/commands/provisioning_settings_command.rb +1 -1
- data/lib/morpheus/cli/commands/reports_command.rb +10 -0
- data/lib/morpheus/cli/commands/service_catalog_command.rb +36 -2
- data/lib/morpheus/cli/commands/whitelabel_settings_command.rb +1 -1
- data/lib/morpheus/cli/credentials.rb +2 -1
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +14 -12
- data/lib/morpheus/cli/mixins/rest_command.rb +5 -1
- data/lib/morpheus/cli/mixins/secondary_rest_command.rb +35 -12
- data/lib/morpheus/cli/option_types.rb +14 -7
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli.rb +13 -0
- data/lib/morpheus/ext/string.rb +6 -4
- data/lib/morpheus/routes.rb +39 -7
- data/test/test_case.rb +3 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f25e2109b97f86a74285c68d93483095a810007259c98248f3764f047763826
|
4
|
+
data.tar.gz: 703c64d291cebb65e2457c38f43c2fb304881db0cf334c6b86cc3317afd2c543
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e1ca2c4b984cf3b4f27cd3f8348b8ce7155fac65be974962a4a3d543bc6ab35efca1e6e938f6c39617e71dab1d510d87a785a4952eb6c113bbc03a9d6d77173
|
7
|
+
data.tar.gz: 7e00d09edce06f1d099228770835254fde5110f38e4f033529acda0c060f433e55babc72eda319bc79035e5080110ae24b6c4f4eb6600049a99c64aa3699d988
|
data/Dockerfile
CHANGED
@@ -798,10 +798,18 @@ class Morpheus::APIClient
|
|
798
798
|
Morpheus::BackupSettingsInterface.new(common_interface_options).setopts(@options)
|
799
799
|
end
|
800
800
|
|
801
|
+
def guidance_settings
|
802
|
+
Morpheus::GuidanceSettingsInterface.new(common_interface_options).setopts(@options)
|
803
|
+
end
|
804
|
+
|
801
805
|
def log_settings
|
802
806
|
Morpheus::LogSettingsInterface.new(common_interface_options).setopts(@options)
|
803
807
|
end
|
804
808
|
|
809
|
+
def monitoring_settings
|
810
|
+
Morpheus::MonitoringSettingsInterface.new(common_interface_options).setopts(@options)
|
811
|
+
end
|
812
|
+
|
805
813
|
def whitelabel_settings
|
806
814
|
Morpheus::WhitelabelSettingsInterface.new(common_interface_options).setopts(@options)
|
807
815
|
end
|
@@ -894,6 +902,10 @@ class Morpheus::APIClient
|
|
894
902
|
Morpheus::NetworkServersInterface.new(common_interface_options).setopts(@options)
|
895
903
|
end
|
896
904
|
|
905
|
+
def network_server_groups
|
906
|
+
Morpheus::NetworkServerGroupsInterface.new(common_interface_options).setopts(@options)
|
907
|
+
end
|
908
|
+
|
897
909
|
def network_edge_clusters
|
898
910
|
Morpheus::NetworkEdgeClustersInterface.new(common_interface_options).setopts(@options)
|
899
911
|
end
|
@@ -24,4 +24,19 @@ class Morpheus::ApplianceSettingsInterface < Morpheus::APIClient
|
|
24
24
|
opts = {method: :get, url: url, headers: headers}
|
25
25
|
execute(opts)
|
26
26
|
end
|
27
|
+
|
28
|
+
def maintenance(params={}, payload={})
|
29
|
+
url = "#{base_path}/maintenance"
|
30
|
+
headers = { params: params, authorization: "Bearer #{@access_token}" }
|
31
|
+
opts = {method: :post, url: url, headers: headers, payload: payload}
|
32
|
+
execute(opts)
|
33
|
+
end
|
34
|
+
|
35
|
+
def reindex(params={}, payload={})
|
36
|
+
url = "#{base_path}/reindex"
|
37
|
+
headers = { params: params, authorization: "Bearer #{@access_token}" }
|
38
|
+
opts = {method: :post, url: url, headers: headers, payload: payload}
|
39
|
+
execute(opts)
|
40
|
+
end
|
41
|
+
|
27
42
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'morpheus/api/api_client'
|
2
|
+
|
3
|
+
class Morpheus::GuidanceSettingsInterface < Morpheus::APIClient
|
4
|
+
|
5
|
+
def base_path
|
6
|
+
"/api/guidance-settings"
|
7
|
+
end
|
8
|
+
|
9
|
+
def get(params={}, headers={})
|
10
|
+
execute(method: :get, url: "#{base_path}", params: params, headers: headers)
|
11
|
+
end
|
12
|
+
|
13
|
+
def update(payload, params={}, headers={})
|
14
|
+
execute(method: :put, url: "#{base_path}", payload: payload, params: params, headers: headers)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'morpheus/api/api_client'
|
2
|
+
|
3
|
+
class Morpheus::MonitoringSettingsInterface < Morpheus::APIClient
|
4
|
+
|
5
|
+
def base_path
|
6
|
+
"/api/monitoring-settings"
|
7
|
+
end
|
8
|
+
|
9
|
+
def get(params={}, headers={})
|
10
|
+
execute(method: :get, url: "#{base_path}", params: params, headers: headers)
|
11
|
+
end
|
12
|
+
|
13
|
+
def update(payload, params={}, headers={})
|
14
|
+
execute(method: :put, url: "#{base_path}", payload: payload, params: params, headers: headers)
|
15
|
+
end
|
16
|
+
|
17
|
+
def update_service_now(payload, params={}, headers={})
|
18
|
+
execute(method: :put, url: "#{base_path}/service-now", payload: payload, params: params, headers: headers)
|
19
|
+
end
|
20
|
+
|
21
|
+
def update_new_relic(payload, params={}, headers={})
|
22
|
+
execute(method: :put, url: "#{base_path}/new-relic", payload: payload, params: params, headers: headers)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -1614,7 +1614,16 @@ module Morpheus
|
|
1614
1614
|
interface_name = "@#{type.pluralize}_interface"
|
1615
1615
|
interface = instance_variable_get(interface_name)
|
1616
1616
|
if interface.nil?
|
1617
|
-
|
1617
|
+
api_client = instance_variable_get("@api_client")
|
1618
|
+
if api_client
|
1619
|
+
if api_client.respond_to?(type.pluralize)
|
1620
|
+
interface = api_client.send(type.pluralize)
|
1621
|
+
else
|
1622
|
+
raise "@api_client.#{type.pluralize} is not a recognized interface"
|
1623
|
+
end
|
1624
|
+
else
|
1625
|
+
raise "#{self.class} has not defined interface #{interface_name} or @api_client"
|
1626
|
+
end
|
1618
1627
|
end
|
1619
1628
|
begin
|
1620
1629
|
json_response = interface.get(*ids)
|
@@ -6,7 +6,7 @@ class Morpheus::Cli::ApplianceSettingsCommand
|
|
6
6
|
|
7
7
|
set_command_name :'appliance-settings'
|
8
8
|
|
9
|
-
register_subcommands :get, :update
|
9
|
+
register_subcommands :get, :update, :toggle_maintenance, :'reindex'
|
10
10
|
|
11
11
|
set_default_subcommand :get
|
12
12
|
|
@@ -103,7 +103,7 @@ class Morpheus::Cli::ApplianceSettingsCommand
|
|
103
103
|
print cyan
|
104
104
|
print enabled_zone_types.collect {|it| it['name']}.join(', ')
|
105
105
|
end
|
106
|
-
print reset "\n"
|
106
|
+
print reset, "\n"
|
107
107
|
return 0
|
108
108
|
rescue RestClient::Exception => e
|
109
109
|
print_rest_exception(e, options)
|
@@ -307,6 +307,61 @@ class Morpheus::Cli::ApplianceSettingsCommand
|
|
307
307
|
end
|
308
308
|
end
|
309
309
|
|
310
|
+
def toggle_maintenance(args)
|
311
|
+
params = {}
|
312
|
+
options = {}
|
313
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
314
|
+
opts.banner = opts.banner = subcommand_usage()
|
315
|
+
opts.on("--enabled [on|off]", String, "Enabled (on) or Disabled (off)") do |val|
|
316
|
+
params['enabled'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == '1' || val.to_s == ''
|
317
|
+
end
|
318
|
+
build_standard_update_options(opts, options, [:auto_confirm], [:payload, :options])
|
319
|
+
opts.footer = "Toggle maintenance mode."
|
320
|
+
end
|
321
|
+
optparse.parse!(args)
|
322
|
+
connect(options)
|
323
|
+
verify_args!(args:args, optparse:optparse, count:0)
|
324
|
+
if params['enabled'].nil?
|
325
|
+
confirm!("Are you sure you would like to toggle maintenance mode?", options)
|
326
|
+
else
|
327
|
+
confirm!("Are you sure you would like to toggle maintenance mode: #{params['enabled'] ? 'on' : 'off'}?", options)
|
328
|
+
end
|
329
|
+
@appliance_settings_interface.setopts(options)
|
330
|
+
if options[:dry_run]
|
331
|
+
print_dry_run @appliance_settings_interface.dry.maintenance(params)
|
332
|
+
return
|
333
|
+
end
|
334
|
+
json_response = @appliance_settings_interface.maintenance(params)
|
335
|
+
render_response(json_response, options) do
|
336
|
+
print_green_success "Toggled maintenance mode: '#{params['enabled'] ? 'on' : 'off'}'"
|
337
|
+
end
|
338
|
+
return 0, nil
|
339
|
+
end
|
340
|
+
|
341
|
+
def reindex(args)
|
342
|
+
params = {}
|
343
|
+
options = {}
|
344
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
345
|
+
opts.banner = opts.banner = subcommand_usage()
|
346
|
+
build_standard_update_options(opts, options, [:auto_confirm], [:payload, :options])
|
347
|
+
opts.footer = "Reindex all search data."
|
348
|
+
end
|
349
|
+
optparse.parse!(args)
|
350
|
+
connect(options)
|
351
|
+
verify_args!(args:args, optparse:optparse, count:0)
|
352
|
+
confirm!("Are you sure you would like reindex all search data?", options)
|
353
|
+
@appliance_settings_interface.setopts(options)
|
354
|
+
if options[:dry_run]
|
355
|
+
print_dry_run @appliance_settings_interface.dry.reindex(params)
|
356
|
+
return
|
357
|
+
end
|
358
|
+
json_response = @appliance_settings_interface.reindex(params)
|
359
|
+
render_response(json_response, options) do
|
360
|
+
print_green_success "Reindexing all search data..."
|
361
|
+
end
|
362
|
+
return 0, nil
|
363
|
+
end
|
364
|
+
|
310
365
|
private
|
311
366
|
|
312
367
|
def format_days(days)
|
@@ -66,7 +66,7 @@ class Morpheus::Cli::BackupSettingsCommand
|
|
66
66
|
"Backup Retention Count" => lambda {|it| it['retentionCount'] }
|
67
67
|
}
|
68
68
|
print_description_list(description_cols, backup_settings)
|
69
|
-
print reset "\n"
|
69
|
+
print reset, "\n"
|
70
70
|
return 0
|
71
71
|
rescue RestClient::Exception => e
|
72
72
|
print_rest_exception(e, options)
|
@@ -660,6 +660,8 @@ EOT
|
|
660
660
|
"Labels" => lambda {|it| format_list(it['labels'], '', 3) },
|
661
661
|
"Description" => 'description',
|
662
662
|
"Type" => lambda {|it| format_catalog_type(it) },
|
663
|
+
"Visibility" => 'visibility',
|
664
|
+
"Layout Code" => 'layoutCode',
|
663
665
|
"Blueprint" => lambda {|it| it['blueprint'] ? it['blueprint']['name'] : nil },
|
664
666
|
"Workflow" => lambda {|it| it['workflow'] ? it['workflow']['name'] : nil },
|
665
667
|
"Context" => lambda {|it| it['context'] },
|
@@ -679,6 +681,8 @@ EOT
|
|
679
681
|
"Labels" => lambda {|it| format_list(it['labels']) },
|
680
682
|
"Description" => 'description',
|
681
683
|
"Type" => lambda {|it| format_catalog_type(it) },
|
684
|
+
"Visibility" => 'visibility',
|
685
|
+
"Layout Code" => 'layoutCode',
|
682
686
|
"Blueprint" => lambda {|it| it['blueprint'] ? it['blueprint']['name'] : nil },
|
683
687
|
"Workflow" => lambda {|it| it['workflow'] ? it['workflow']['name'] : nil },
|
684
688
|
"Context" => lambda {|it| it['context'] },
|
@@ -725,7 +729,8 @@ EOT
|
|
725
729
|
{'fieldName' => 'enabled', 'fieldLabel' => 'Enabled', 'type' => 'checkbox', 'defaultValue' => true, 'displayOrder' => 4},
|
726
730
|
{'fieldName' => 'featured', 'fieldLabel' => 'Featured', 'type' => 'checkbox', 'defaultValue' => false, 'displayOrder' => 5},
|
727
731
|
{'fieldName' => 'visibility', 'fieldLabel' => 'Visibility', 'type' => 'select', 'selectOptions' => [{'name' => 'Private', 'value' => 'private'}, {'name' => 'Public', 'value' => 'public'}], 'defaultValue' => 'private', 'required' => true, 'displayOrder' => 6},
|
728
|
-
{'fieldName' => '
|
732
|
+
{'fieldName' => 'layoutCode', 'fieldLabel' => 'Layout Code', 'type' => 'text', 'required' => false, 'displayOrder' => 7},
|
733
|
+
{'fieldName' => 'iconPath', 'fieldLabel' => 'Logo', 'type' => 'select', 'optionSource' => 'iconList', 'displayOrder' => 8},
|
729
734
|
#{'fieldName' => 'optionTypes', 'fieldLabel' => 'Option Types', 'type' => 'text', 'description' => 'Option Types to include, comma separated list of names or IDs.', 'displayOrder' => 8},
|
730
735
|
{'dependsOnCode' => 'catalogItemType.type:instance', 'fieldName' => 'config', 'fieldLabel' => 'Config', 'type' => 'code-editor', 'description' => 'JSON or YAML', 'required' => true, 'displayOrder' => 9},
|
731
736
|
{'dependsOnCode' => 'catalogItemType.type:blueprint', 'fieldName' => 'blueprint', 'fieldLabel' => 'Blueprint', 'type' => 'select', 'optionSource' => 'blueprints', 'description' => 'Choose a blueprint to apply to the catalog item.', 'required' => true, 'noParams' => true, 'displayOrder' => 10},
|
@@ -274,6 +274,9 @@ EOT
|
|
274
274
|
ttl = val
|
275
275
|
end
|
276
276
|
end
|
277
|
+
opts.on( '--type string|object', "The type of data being stored: string or object." ) do |val|
|
278
|
+
params['type'] = val
|
279
|
+
end
|
277
280
|
# opts.on( '--no-overwrite', '--no-overwrite', "Do not overwrite existing keys. Existing keys are overwritten by default." ) do
|
278
281
|
# params['overwrite'] = false
|
279
282
|
# end
|
@@ -73,7 +73,7 @@ class Morpheus::Cli::GuidanceCommand
|
|
73
73
|
print "#{cyan}#{level.capitalize}".rjust(14, ' ') + ": " + stats['type'][level].to_s.ljust(10, ' ')
|
74
74
|
println generate_usage_bar(stats['type'][level], stats['type'].collect{|k, v| v}.reduce(:+), {:max_bars => 20, :bar_color => color})
|
75
75
|
end
|
76
|
-
print reset "\n"
|
76
|
+
print reset, "\n"
|
77
77
|
return 0
|
78
78
|
rescue RestClient::Exception => e
|
79
79
|
print_rest_exception(e, options)
|
@@ -126,7 +126,7 @@ class Morpheus::Cli::GuidanceCommand
|
|
126
126
|
{"CODE" => lambda {|it| it['code']}}
|
127
127
|
];
|
128
128
|
print as_pretty_table(types, cols, options)
|
129
|
-
print reset "\n"
|
129
|
+
print reset, "\n"
|
130
130
|
return 0
|
131
131
|
rescue RestClient::Exception => e
|
132
132
|
print_rest_exception(e, options)
|
@@ -0,0 +1,148 @@
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
2
|
+
|
3
|
+
class Morpheus::Cli::GuidanceSettings
|
4
|
+
include Morpheus::Cli::CliCommand
|
5
|
+
include Morpheus::Cli::AccountsHelper
|
6
|
+
|
7
|
+
set_command_name :'guidance-settings'
|
8
|
+
set_command_description "View and manage guidance settings"
|
9
|
+
register_subcommands :get, :update
|
10
|
+
|
11
|
+
def connect(opts)
|
12
|
+
@api_client = establish_remote_appliance_connection(opts)
|
13
|
+
@guidance_settings_interface = @api_client.guidance_settings
|
14
|
+
@options_interface = @api_client.options
|
15
|
+
end
|
16
|
+
|
17
|
+
def handle(args)
|
18
|
+
handle_subcommand(args)
|
19
|
+
end
|
20
|
+
|
21
|
+
def get(args)
|
22
|
+
params = {}
|
23
|
+
options = {}
|
24
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
25
|
+
opts.banner = subcommand_usage()
|
26
|
+
build_standard_get_options(opts, options)
|
27
|
+
opts.footer = "Get guidance settings."
|
28
|
+
end
|
29
|
+
optparse.parse!(args)
|
30
|
+
connect(options)
|
31
|
+
verify_args!(args:args, optparse:optparse, count:0)
|
32
|
+
params.merge!(parse_query_options(options))
|
33
|
+
@guidance_settings_interface.setopts(options)
|
34
|
+
if options[:dry_run]
|
35
|
+
print_dry_run @guidance_settings_interface.dry.get(options)
|
36
|
+
return
|
37
|
+
end
|
38
|
+
json_response = @guidance_settings_interface.get(options)
|
39
|
+
render_response(json_response, options, object_key) do
|
40
|
+
guidance_settings = json_response[object_key]
|
41
|
+
print_h1 "Guidance Settings", options
|
42
|
+
print_h2 "Power Settings", options.merge(:border_style => :thin)
|
43
|
+
#Power shutdown will be suggested when all of the following baseline thresholds are exceeded for a resource
|
44
|
+
print_description_list({
|
45
|
+
"Average CPU (%)" => lambda {|it| it['cpuAvgCutoffPower'] }, # #Lower limit for average CPU usage
|
46
|
+
"Maximum CPU (%)" => lambda {|it| it['cpuMaxCutoffPower'] }, #Lower limit for peak CPU usage
|
47
|
+
"Network threshold (bytes)" => lambda {|it| it['networkCutoffPower'] }, #Lower limit for average network bandwidth
|
48
|
+
}, guidance_settings, options)
|
49
|
+
#print reset, "\n"
|
50
|
+
|
51
|
+
print_h2 "CPU Up-size Settings", options.merge(:border_style => :thin)
|
52
|
+
#Up-size will be suggested when all of the following baseline thresholds are exceeded for a resource
|
53
|
+
print_description_list({
|
54
|
+
"Average CPU (%)" => lambda {|it| it['cpuUpAvgStandardCutoffRightSize'] }, #Upper limit for CPU usage
|
55
|
+
"Maximum CPU (%)" => lambda {|it| it['cpuUpMaxStandardCutoffRightSize'] }, #Upper limit for peak CPU usage
|
56
|
+
}, guidance_settings, options)
|
57
|
+
#print reset, "\n"
|
58
|
+
|
59
|
+
print_h2 "Memory Up-size Settings", options.merge(:border_style => :thin)
|
60
|
+
#Up-size is suggested when all of the following baseline thresholds are exceeded for a resource
|
61
|
+
print_description_list({
|
62
|
+
"Minimum Free Memory (%)" => lambda {|it| it['memoryUpAvgStandardCutoffRightSize'] }, #Lower limit for average free memory usage
|
63
|
+
}, guidance_settings, options)
|
64
|
+
#print reset, "\n"
|
65
|
+
|
66
|
+
print_h2 "Memory Down-size Settings", options.merge(:border_style => :thin)
|
67
|
+
#Down-size is suggested when all of the following baseline thresholds are exceeded for a resource
|
68
|
+
print_description_list({
|
69
|
+
#Upper limit for average free memory
|
70
|
+
"Average Free Memory (%)" => lambda {|it| it['memoryDownAvgStandardCutoffRightSize'] },
|
71
|
+
#Upper limit for peak memory usage
|
72
|
+
"Maximum Free Memory (%)" => lambda {|it| it['memoryDownMaxStandardCutoffRightSize'] },
|
73
|
+
}, guidance_settings, options)
|
74
|
+
print reset, "\n"
|
75
|
+
end
|
76
|
+
return 0, nil
|
77
|
+
end
|
78
|
+
|
79
|
+
def update(args)
|
80
|
+
params = {}
|
81
|
+
options = {}
|
82
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
83
|
+
opts.banner = opts.banner = subcommand_usage()
|
84
|
+
opts.on('--power-cpu-avg PERCENT', String, "Power Shutdown Average CPU (%). Lower limit for average CPU usage") do |val|
|
85
|
+
params['cpuAvgCutoffPower'] = val.to_i
|
86
|
+
end
|
87
|
+
opts.on('--power-cpu-max PERCENT', String, "Power Shutdown Maximum CPU (%). Lower limit for peak CPU usage") do |val|
|
88
|
+
params['cpuMaxCutoffPower'] = val.to_i
|
89
|
+
end
|
90
|
+
opts.on('--power-network BYTES', String, "Power Shutdown Network threshold (bytes). Lower limit for average network bandwidth") do |val|
|
91
|
+
params['networkCutoffPower'] = val.to_i
|
92
|
+
end
|
93
|
+
opts.on('--cpu-up-avg PERCENT', String, "CPU Up-size Average CPU (%). Upper limit for CPU usage") do |val|
|
94
|
+
params['cpuUpAvgStandardCutoffRightSize'] = val.to_i
|
95
|
+
end
|
96
|
+
opts.on('--cpu-up-max PERCENT', String, "CPU Up-size Maximum CPU (%). Upper limit for peak CPU usage") do |val|
|
97
|
+
params['cpuUpMaxStandardCutoffRightSize'] = val.to_i
|
98
|
+
end
|
99
|
+
opts.on('--memory-up-avg PERCENT', String, "Memory Up-size Minimum Free Memory (%). Lower limit for average free memory usage") do |val|
|
100
|
+
params['memoryUpAvgStandardCutoffRightSize'] = val.to_i
|
101
|
+
end
|
102
|
+
opts.on('--memory-down-avg PERCENT', String, "Memory Down-size Maximum Free Memory (%). Upper limit for average free memory") do |val|
|
103
|
+
params['memoryDownAvgStandardCutoffRightSize'] = val.to_i
|
104
|
+
end
|
105
|
+
opts.on('--memory-down-max PERCENT', String, "Memory Down-size Maximum Free Memory (%). Upper limit for peak memory usage") do |val|
|
106
|
+
params['memoryDownMaxStandardCutoffRightSize'] = val.to_i
|
107
|
+
end
|
108
|
+
build_standard_update_options(opts, options)
|
109
|
+
opts.footer = "Update guidance settings."
|
110
|
+
end
|
111
|
+
optparse.parse!(args)
|
112
|
+
connect(options)
|
113
|
+
verify_args!(args:args, optparse:optparse, count:0)
|
114
|
+
payload = parse_payload(options)
|
115
|
+
if !payload
|
116
|
+
payload = {}
|
117
|
+
payload.deep_merge!({object_key => parse_passed_options(options)}) # inject options passed with -O foo=bar
|
118
|
+
payload.deep_merge!({object_key => params}) # inject options --foo bar
|
119
|
+
end
|
120
|
+
if payload[object_key].empty?
|
121
|
+
raise_command_error "Specify at least one option to update.\n#{optparse}"
|
122
|
+
end
|
123
|
+
@guidance_settings_interface.setopts(options)
|
124
|
+
if options[:dry_run]
|
125
|
+
print_dry_run @guidance_settings_interface.dry.update(payload)
|
126
|
+
return
|
127
|
+
end
|
128
|
+
json_response = @guidance_settings_interface.update(payload)
|
129
|
+
exit_code, err = 0, nil
|
130
|
+
render_response(json_response, options, object_key) do
|
131
|
+
if json_response['success']
|
132
|
+
print_green_success "Updated guidance settings"
|
133
|
+
get([] + (options[:remote] ? ["-r",options[:remote]] : []))
|
134
|
+
else
|
135
|
+
exit_code, err = 1, "Error updating guidance settings: #{json_response['msg'] || json_response['errors']}"
|
136
|
+
print_rest_errors(json_response)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
return exit_code, err
|
140
|
+
end
|
141
|
+
|
142
|
+
private
|
143
|
+
|
144
|
+
def object_key
|
145
|
+
'guidanceSettings'
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
@@ -78,7 +78,7 @@ class Morpheus::Cli::LogSettingsCommand
|
|
78
78
|
print cyan
|
79
79
|
print as_pretty_table(log_settings['integrations'], [:name, :enabled, :host, :port])
|
80
80
|
end
|
81
|
-
print reset "\n"
|
81
|
+
print reset, "\n"
|
82
82
|
return 0
|
83
83
|
rescue RestClient::Exception => e
|
84
84
|
print_rest_exception(e, options)
|