morpheus-cli 5.4.3.1 → 5.4.4
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 +8 -0
- data/lib/morpheus/api/catalog_item_types_interface.rb +9 -12
- data/lib/morpheus/api/clusters_interface.rb +12 -0
- data/lib/morpheus/api/credential_types_interface.rb +9 -0
- data/lib/morpheus/api/credentials_interface.rb +9 -0
- data/lib/morpheus/api/monitoring_apps_interface.rb +12 -4
- data/lib/morpheus/api/monitoring_checks_interface.rb +12 -4
- data/lib/morpheus/api/monitoring_groups_interface.rb +13 -5
- data/lib/morpheus/api/monitoring_incidents_interface.rb +12 -4
- data/lib/morpheus/api/options_interface.rb +8 -1
- data/lib/morpheus/api/power_schedules_interface.rb +2 -2
- data/lib/morpheus/api/service_plans_interface.rb +6 -0
- data/lib/morpheus/cli/cli_command.rb +10 -17
- data/lib/morpheus/cli/commands/catalog_item_types_command.rb +75 -8
- data/lib/morpheus/cli/commands/clusters.rb +119 -5
- data/lib/morpheus/cli/commands/credential_types_command.rb +36 -0
- data/lib/morpheus/cli/commands/credentials_command.rb +124 -0
- data/lib/morpheus/cli/commands/hosts.rb +20 -2
- data/lib/morpheus/cli/commands/instances.rb +5 -1
- data/lib/morpheus/cli/commands/monitoring_apps_command.rb +8 -8
- data/lib/morpheus/cli/commands/monitoring_checks_command.rb +8 -8
- data/lib/morpheus/cli/commands/monitoring_groups_command.rb +8 -8
- data/lib/morpheus/cli/commands/monitoring_incidents_command.rb +8 -8
- data/lib/morpheus/cli/commands/power_schedules_command.rb +189 -258
- data/lib/morpheus/cli/commands/service_plans_command.rb +51 -4
- data/lib/morpheus/cli/commands/storage_server_types.rb +0 -5
- data/lib/morpheus/cli/commands/storage_servers.rb +0 -6
- data/lib/morpheus/cli/commands/storage_volume_types.rb +0 -5
- data/lib/morpheus/cli/commands/storage_volumes.rb +0 -6
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +37 -27
- data/lib/morpheus/cli/mixins/rest_command.rb +20 -4
- data/lib/morpheus/cli/mixins/storage_servers_helper.rb +0 -63
- data/lib/morpheus/cli/mixins/storage_volumes_helper.rb +0 -43
- data/lib/morpheus/cli/option_types.rb +1 -0
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/routes.rb +13 -3
- metadata +11 -7
@@ -8,7 +8,7 @@ class Morpheus::Cli::Clusters
|
|
8
8
|
include Morpheus::Cli::AccountsHelper
|
9
9
|
|
10
10
|
register_subcommands :list, :count, :get, :view, :add, :update, :remove, :logs, :history, {:'history-details' => :history_details}, {:'history-event' => :history_event_details}
|
11
|
-
register_subcommands :list_workers, :add_worker
|
11
|
+
register_subcommands :list_workers, :add_worker, :remove_worker, :update_worker_count
|
12
12
|
register_subcommands :list_masters
|
13
13
|
register_subcommands :list_volumes, :remove_volume
|
14
14
|
register_subcommands :list_namespaces, :get_namespace, :add_namespace, :update_namespace, :remove_namespace
|
@@ -595,7 +595,7 @@ class Morpheus::Cli::Clusters
|
|
595
595
|
|
596
596
|
# Multi-disk / prompt for volumes
|
597
597
|
if provision_type['hasVolumes']
|
598
|
-
volumes = options[:volumes] || prompt_volumes(service_plan, options.merge({'defaultAddFirstDataVolume': true}), @api_client, api_params)
|
598
|
+
volumes = options[:volumes] || prompt_volumes(service_plan, provision_type, options.merge({'defaultAddFirstDataVolume': true}), @api_client, api_params)
|
599
599
|
if !volumes.empty?
|
600
600
|
server_payload['volumes'] = volumes
|
601
601
|
end
|
@@ -1177,7 +1177,9 @@ class Morpheus::Cli::Clusters
|
|
1177
1177
|
cloud = @clouds_interface.get(cloud_id)['zone']
|
1178
1178
|
cloud['zoneType'] = get_cloud_type(cloud['zoneType']['id'])
|
1179
1179
|
group = @groups_interface.get(cluster['site']['id'])['group']
|
1180
|
-
|
1180
|
+
provision_type = server_type['provisionType'] || {}
|
1181
|
+
provision_type = @provision_types_interface.get(provision_type['id'])['provisionType'] if !provision_type.nil?
|
1182
|
+
|
1181
1183
|
server_payload['cloud'] = {'id' => cloud_id}
|
1182
1184
|
service_plan = prompt_service_plan({zoneId: cloud_id, siteId: cluster['site']['id'], provisionTypeId: server_type['provisionType']['id'], groupTypeId: cluster_type['id'], }, options)
|
1183
1185
|
|
@@ -1190,7 +1192,7 @@ class Morpheus::Cli::Clusters
|
|
1190
1192
|
end
|
1191
1193
|
|
1192
1194
|
# Multi-disk / prompt for volumes
|
1193
|
-
volumes = options[:volumes] || prompt_volumes(service_plan, options.merge({'defaultAddFirstDataVolume': true}), @api_client, {zoneId: cloud['id'], siteId: group['id']})
|
1195
|
+
volumes = options[:volumes] || prompt_volumes(service_plan, provision_type, options.merge({'defaultAddFirstDataVolume': true}), @api_client, {zoneId: cloud['id'], siteId: group['id']})
|
1194
1196
|
|
1195
1197
|
if !volumes.empty?
|
1196
1198
|
server_payload['volumes'] = volumes
|
@@ -1198,7 +1200,6 @@ class Morpheus::Cli::Clusters
|
|
1198
1200
|
|
1199
1201
|
# Networks
|
1200
1202
|
# NOTE: You must choose subnets in the same availability zone
|
1201
|
-
provision_type = server_type['provisionType'] || {}
|
1202
1203
|
if provision_type && cloud['zoneType']['code'] != 'esxi'
|
1203
1204
|
server_payload['networkInterfaces'] = options[:networkInterfaces] || prompt_network_interfaces(cloud['id'], server_type['provisionType']['id'], (resource_pool['id'] rescue nil), options)
|
1204
1205
|
end
|
@@ -1274,6 +1275,90 @@ class Morpheus::Cli::Clusters
|
|
1274
1275
|
end
|
1275
1276
|
end
|
1276
1277
|
|
1278
|
+
def remove_worker(args)
|
1279
|
+
params = {}
|
1280
|
+
options = {}
|
1281
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1282
|
+
opts.banner = subcommand_usage("[cluster] [worker]")
|
1283
|
+
opts.on( '-f', '--force', "Force Delete" ) do
|
1284
|
+
params[:force] = 'on'
|
1285
|
+
end
|
1286
|
+
build_standard_remove_options(opts, options)
|
1287
|
+
opts.footer = "Delete a worker from a cluster.\n" +
|
1288
|
+
"[cluster] is required. This is the name or id of an existing cluster.\n" +
|
1289
|
+
"[worker] is required. This is the name or (server) id of an existing worker."
|
1290
|
+
end
|
1291
|
+
optparse.parse!(args)
|
1292
|
+
verify_args!(args:args, optparse:optparse, count:2)
|
1293
|
+
connect(options)
|
1294
|
+
params.merge!(parse_query_options(options))
|
1295
|
+
|
1296
|
+
cluster = find_cluster_by_name_or_id(args[0])
|
1297
|
+
return 1 if cluster.nil?
|
1298
|
+
|
1299
|
+
worker_id = args[1]
|
1300
|
+
if worker_id.empty?
|
1301
|
+
raise_command_error "missing required worker parameter"
|
1302
|
+
end
|
1303
|
+
|
1304
|
+
worker = find_worker_by_name_or_id(cluster['id'], worker_id)
|
1305
|
+
if worker.nil?
|
1306
|
+
print_red_alert "Worker not found for '#{worker_id}'"
|
1307
|
+
return 1
|
1308
|
+
end
|
1309
|
+
unless options[:yes] || ::Morpheus::Cli::OptionTypes::confirm("Are you sure you would like to remove the cluster worker '#{worker['name'] || worker['id']}'?", options)
|
1310
|
+
return 9, "aborted command"
|
1311
|
+
end
|
1312
|
+
|
1313
|
+
@clusters_interface.setopts(options)
|
1314
|
+
if options[:dry_run]
|
1315
|
+
print_dry_run @clusters_interface.dry.destroy_worker(cluster['id'], worker['id'], params)
|
1316
|
+
return
|
1317
|
+
end
|
1318
|
+
json_response = @clusters_interface.destroy_worker(cluster['id'], worker['id'], params)
|
1319
|
+
render_response(json_response, options) do
|
1320
|
+
print_green_success "Worker #{worker['name']} is being removed from cluster #{cluster['name']}..."
|
1321
|
+
end
|
1322
|
+
return 0, nil
|
1323
|
+
end
|
1324
|
+
|
1325
|
+
def update_worker_count(args)
|
1326
|
+
params = {}
|
1327
|
+
options = {}
|
1328
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
1329
|
+
opts.banner = subcommand_usage("[cluster] [worker_count]")
|
1330
|
+
build_standard_update_options(opts, options)
|
1331
|
+
opts.footer = "Resizes a cluster to the specified number of worker nodes.\n" +
|
1332
|
+
"[cluster] is required. This is the name or id of an existing cluster.\n" +
|
1333
|
+
"[worker_count] is required. This is the desired number of workers."
|
1334
|
+
end
|
1335
|
+
optparse.parse!(args)
|
1336
|
+
verify_args!(args:args, optparse:optparse, count:2)
|
1337
|
+
connect(options)
|
1338
|
+
|
1339
|
+
cluster = find_cluster_by_name_or_id(args[0])
|
1340
|
+
return 1 if cluster.nil?
|
1341
|
+
|
1342
|
+
worker_count = args[1]
|
1343
|
+
payload = {}
|
1344
|
+
if options[:payload]
|
1345
|
+
payload = options[:payload]
|
1346
|
+
payload.deep_merge!({'workerCount' => worker_count.to_i})
|
1347
|
+
else
|
1348
|
+
payload.deep_merge!({'workerCount' => worker_count.to_i})
|
1349
|
+
end
|
1350
|
+
@clusters_interface.setopts(options)
|
1351
|
+
if options[:dry_run]
|
1352
|
+
print_dry_run @clusters_interface.dry.update_worker_count(cluster['id'], payload)
|
1353
|
+
return
|
1354
|
+
end
|
1355
|
+
json_response = @clusters_interface.update_worker_count(cluster['id'], payload)
|
1356
|
+
render_response(json_response, options) do
|
1357
|
+
print_green_success "Cluster #{cluster['name']} is being resized to #{worker_count} worker nodes..."
|
1358
|
+
end
|
1359
|
+
return 0, nil
|
1360
|
+
end
|
1361
|
+
|
1277
1362
|
def list_masters(args)
|
1278
1363
|
options = {}
|
1279
1364
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
@@ -3479,6 +3564,35 @@ class Morpheus::Cli::Clusters
|
|
3479
3564
|
out
|
3480
3565
|
end
|
3481
3566
|
|
3567
|
+
def find_worker_by_name_or_id(cluster_id, val)
|
3568
|
+
if val.to_s =~ /\A\d{1,}\Z/
|
3569
|
+
find_worker_by_id(cluster_id, val.to_i)
|
3570
|
+
else
|
3571
|
+
find_worker_by_name(cluster_id, val)
|
3572
|
+
end
|
3573
|
+
|
3574
|
+
end
|
3575
|
+
|
3576
|
+
def find_worker_by_id(cluster_id, id)
|
3577
|
+
json_results = @clusters_interface.list_workers(cluster_id)
|
3578
|
+
filtered_results = json_results['workers'].select {|worker| worker['id'] == id}
|
3579
|
+
if filtered_results.empty? || filtered_results.count > 1
|
3580
|
+
print_red_alert "Worker not found by id #{id}"
|
3581
|
+
exit 1
|
3582
|
+
end
|
3583
|
+
filtered_results[0]
|
3584
|
+
end
|
3585
|
+
|
3586
|
+
def find_worker_by_name(cluster_id, name)
|
3587
|
+
params = {phrase: name}
|
3588
|
+
json_results = @clusters_interface.list_workers(cluster_id, params)
|
3589
|
+
if json_results['workers'].empty? || json_results['workers'].count > 1
|
3590
|
+
print_red_alert "Worker not found by name #{name}"
|
3591
|
+
exit 1
|
3592
|
+
end
|
3593
|
+
json_results['workers'][0]
|
3594
|
+
end
|
3595
|
+
|
3482
3596
|
def find_cluster_by_name_or_id(val)
|
3483
3597
|
if val.to_s =~ /\A\d{1,}\Z/
|
3484
3598
|
find_cluster_by_id(val)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
2
|
+
|
3
|
+
class Morpheus::Cli::CredentialTypesCommand
|
4
|
+
include Morpheus::Cli::CliCommand
|
5
|
+
include Morpheus::Cli::RestCommand
|
6
|
+
|
7
|
+
set_command_description "View credential types"
|
8
|
+
set_command_name :'credential-types'
|
9
|
+
register_subcommands :list, :get
|
10
|
+
|
11
|
+
# register_interfaces :credential_types
|
12
|
+
|
13
|
+
protected
|
14
|
+
|
15
|
+
def credential_type_list_column_definitions(options)
|
16
|
+
{
|
17
|
+
"ID" => 'id',
|
18
|
+
"Name" => 'name',
|
19
|
+
"Code" => 'code',
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def credential_type_column_definitions(options)
|
24
|
+
{
|
25
|
+
"ID" => 'id',
|
26
|
+
"Name" => 'name',
|
27
|
+
"Code" => 'code',
|
28
|
+
# "Description" => 'description',
|
29
|
+
"Enabled" => lambda {|it| format_boolean(it['enabled']) },
|
30
|
+
"Creatable" => lambda {|it| format_boolean(it['creatable']) },
|
31
|
+
"Editable" => lambda {|it| format_boolean(it['editable']) },
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
2
|
+
|
3
|
+
class Morpheus::Cli::CredentialsCommand
|
4
|
+
include Morpheus::Cli::CliCommand
|
5
|
+
include Morpheus::Cli::RestCommand
|
6
|
+
|
7
|
+
set_command_name :'credentials'
|
8
|
+
set_command_description "View and manage credentials."
|
9
|
+
register_subcommands :list, :get, :add, :update, :remove
|
10
|
+
|
11
|
+
# RestCommand settings
|
12
|
+
register_interfaces :credentials, :credential_types
|
13
|
+
set_rest_has_type true
|
14
|
+
# set_rest_type :credential_types
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
def render_response_for_get(json_response, options)
|
19
|
+
render_response(json_response, options, rest_object_key) do
|
20
|
+
record = json_response[rest_object_key]
|
21
|
+
print_h1 rest_label, [], options
|
22
|
+
print cyan
|
23
|
+
print_description_list(credential_column_definitions(options, record), record, options)
|
24
|
+
print reset,"\n"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def credential_list_column_definitions(options)
|
29
|
+
{
|
30
|
+
"ID" => 'id',
|
31
|
+
"Name" => 'name',
|
32
|
+
"Type" => lambda {|it| it['type'] ? it['type']['name'] : '' },
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def credential_column_definitions(options, credential)
|
37
|
+
columns = [
|
38
|
+
{"ID" => 'id' },
|
39
|
+
{"Credential Store" => lambda {|it| it['integration'] ? it['integration']['name'] : 'Internal'} },
|
40
|
+
{"Name" => 'name' },
|
41
|
+
{"Description" => 'description' },
|
42
|
+
{"Type" => lambda {|it| it['type'] ? it['type']['name'] : '' } },
|
43
|
+
{"Enabled" => lambda {|it| format_boolean(it['enabled']) } },
|
44
|
+
]
|
45
|
+
type_code = credential['type']['code']
|
46
|
+
if type_code == "access-key-secret"
|
47
|
+
columns += [
|
48
|
+
{"Access Key" => lambda {|it| it['username'] } },
|
49
|
+
{"Secret Key" => lambda {|it| it['password'] } },
|
50
|
+
]
|
51
|
+
elsif type_code == "client-id-secret"
|
52
|
+
columns += [
|
53
|
+
{"Client ID" => lambda {|it| it['username'] } },
|
54
|
+
{"Client Secret" => lambda {|it| it['password'] } },
|
55
|
+
]
|
56
|
+
elsif type_code == "email-private-key"
|
57
|
+
columns += [
|
58
|
+
{"Email" => lambda {|it| it['username'] } },
|
59
|
+
{"Private Key" => lambda {|it| it['authKey'] ? it['authKey']['name'] : '' } },
|
60
|
+
]
|
61
|
+
elsif type_code == "tenant-username-keypair" || type_code == "tenant-username-key"
|
62
|
+
columns += [
|
63
|
+
{"Tenant" => lambda {|it| it['authPath'] } },
|
64
|
+
{"Username" => lambda {|it| it['username'] } },
|
65
|
+
{"Private Key" => lambda {|it| it['authKey'] ? it['authKey']['name'] : '' } },
|
66
|
+
]
|
67
|
+
elsif type_code == "username-api-key"
|
68
|
+
columns += [
|
69
|
+
{"Username" => lambda {|it| it['username'] } },
|
70
|
+
{"API Key" => lambda {|it| it['password'] } },
|
71
|
+
]
|
72
|
+
elsif type_code == "username-keypair" || type_code == "username-key"
|
73
|
+
columns += [
|
74
|
+
{"Username" => lambda {|it| it['username'] } },
|
75
|
+
{"Private Key" => lambda {|it| it['authKey'] ? it['authKey']['name'] : '' } },
|
76
|
+
]
|
77
|
+
elsif type_code == "username-password"
|
78
|
+
columns += [
|
79
|
+
{"Username" => lambda {|it| it['username'] } },
|
80
|
+
{"Password" => lambda {|it| it['password'] } },
|
81
|
+
]
|
82
|
+
elsif type_code == "username-password-keypair" || type_code == "username-password-key"
|
83
|
+
columns += [
|
84
|
+
{"Username" => lambda {|it| it['username'] } },
|
85
|
+
{"Password" => lambda {|it| it['password'] } },
|
86
|
+
{"Private Key" => lambda {|it| it['authKey'] ? it['authKey']['name'] : '' } },
|
87
|
+
]
|
88
|
+
end
|
89
|
+
columns += [
|
90
|
+
{"Created" => lambda {|it| format_local_dt(it['dateCreated']) } },
|
91
|
+
{"Updated" => lambda {|it| format_local_dt(it['lastUpdated']) } },
|
92
|
+
]
|
93
|
+
return columns
|
94
|
+
end
|
95
|
+
|
96
|
+
def add_credential_option_types()
|
97
|
+
[
|
98
|
+
{'shorthand' => '-t', 'fieldName' => 'type', 'fieldLabel' => 'Credential Type', 'type' => 'select', 'optionSource' => lambda {|api_client, api_params|
|
99
|
+
api_client.credential_types.list({max:10000})['credentialTypes'].collect { |it| {"name" => it["name"], "value" => it["code"]} }
|
100
|
+
}, 'required' => true},
|
101
|
+
{'fieldName' => 'integration.id', 'fieldLabel' => 'Credential Store', 'type' => 'select', 'optionSource' => 'credentialIntegrations'},
|
102
|
+
{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true},
|
103
|
+
{'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text', 'required' => false},
|
104
|
+
{'fieldName' => 'enabled', 'fieldLabel' => 'Enabled', 'type' => 'checkbox', 'required' => false, 'defaultValue' => true},
|
105
|
+
]
|
106
|
+
end
|
107
|
+
|
108
|
+
def add_credential_advanced_option_types()
|
109
|
+
[]
|
110
|
+
end
|
111
|
+
|
112
|
+
def update_credential_option_types()
|
113
|
+
[
|
114
|
+
{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text'},
|
115
|
+
{'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text'},
|
116
|
+
{'fieldName' => 'enabled', 'fieldLabel' => 'Enabled', 'type' => 'checkbox'},
|
117
|
+
]
|
118
|
+
end
|
119
|
+
|
120
|
+
def update_credential_advanced_option_types()
|
121
|
+
add_credential_advanced_option_types()
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
@@ -29,6 +29,7 @@ class Morpheus::Cli::Hosts
|
|
29
29
|
@task_sets_interface = @api_client.task_sets
|
30
30
|
@servers_interface = @api_client.servers
|
31
31
|
@server_types_interface = @api_client.server_types
|
32
|
+
@provision_types_interface = @api_client.provision_types
|
32
33
|
@logs_interface = @api_client.logs
|
33
34
|
@accounts_interface = @api_client.accounts
|
34
35
|
@active_group_id = Morpheus::Cli::Groups.active_groups[@appliance_name]
|
@@ -854,6 +855,19 @@ class Morpheus::Cli::Hosts
|
|
854
855
|
# remove cpu and memory option types, which now come from the plan
|
855
856
|
option_type_list = reject_service_plan_option_types(option_type_list)
|
856
857
|
|
858
|
+
# need to GET provision type for optionTypes, and other settings...
|
859
|
+
provision_type_code = server_type["provisionType"] ? server_type["provisionType"]["code"] : nil
|
860
|
+
provision_type = nil
|
861
|
+
if provision_type_code
|
862
|
+
provision_type = provision_types_interface.list({code:provision_type_code})['provisionTypes'][0]
|
863
|
+
if provision_type.nil?
|
864
|
+
print_red_alert "Provision Type not found by code #{provision_type_code}"
|
865
|
+
exit 1
|
866
|
+
end
|
867
|
+
else
|
868
|
+
provision_type = get_provision_type_for_zone_type(cloud['zoneType']['id'])
|
869
|
+
end
|
870
|
+
|
857
871
|
# prompt for resource pool
|
858
872
|
pool_id = nil
|
859
873
|
has_zone_pools = server_type["provisionType"] && server_type["provisionType"]["hasZonePools"]
|
@@ -873,7 +887,7 @@ class Morpheus::Cli::Hosts
|
|
873
887
|
end
|
874
888
|
|
875
889
|
# prompt for volumes
|
876
|
-
volumes = prompt_volumes(service_plan, options, @api_client, {zoneId: cloud_id, serverTypeId: server_type['id'], siteId: group_id})
|
890
|
+
volumes = prompt_volumes(service_plan, provision_type, options, @api_client, {zoneId: cloud_id, serverTypeId: server_type['id'], siteId: group_id})
|
877
891
|
if !volumes.empty?
|
878
892
|
payload['volumes'] = volumes
|
879
893
|
end
|
@@ -1226,6 +1240,10 @@ class Morpheus::Cli::Hosts
|
|
1226
1240
|
:server => {:id => server["id"]}
|
1227
1241
|
}
|
1228
1242
|
|
1243
|
+
# need to GET provision type for some settings...
|
1244
|
+
server_type = @server_types_interface.get(server_type_id)['serverType']
|
1245
|
+
provision_type = @provision_types_interface.get(server_type['provisionType']['id'])['provisionType']
|
1246
|
+
|
1229
1247
|
# avoid 500 error
|
1230
1248
|
# payload[:servicePlanOptions] = {}
|
1231
1249
|
unless options[:no_prompt]
|
@@ -1253,7 +1271,7 @@ class Morpheus::Cli::Hosts
|
|
1253
1271
|
current_volumes = volumes_response['volumes'].sort {|x,y| x['displayOrder'] <=> y['displayOrder'] }
|
1254
1272
|
|
1255
1273
|
# prompt for volumes
|
1256
|
-
volumes = prompt_resize_volumes(current_volumes, service_plan, options)
|
1274
|
+
volumes = prompt_resize_volumes(current_volumes, service_plan, provision_type, options)
|
1257
1275
|
if !volumes.empty?
|
1258
1276
|
payload[:volumes] = volumes
|
1259
1277
|
end
|
@@ -2694,6 +2694,10 @@ class Morpheus::Cli::Instances
|
|
2694
2694
|
layout_id = instance['layout']['id']
|
2695
2695
|
plan_id = instance['plan']['id']
|
2696
2696
|
current_plan_name = instance['plan']['name']
|
2697
|
+
|
2698
|
+
# need to GET provision type for some settings...
|
2699
|
+
provision_type = @provision_types_interface.get(instance['layout']['provisionTypeId'])['provisionType']
|
2700
|
+
|
2697
2701
|
# prompt for service plan
|
2698
2702
|
service_plans_json = @instances_interface.service_plans({zoneId: cloud_id, siteId: group_id, layoutId: layout_id})
|
2699
2703
|
service_plans = service_plans_json["plans"]
|
@@ -2715,7 +2719,7 @@ class Morpheus::Cli::Instances
|
|
2715
2719
|
current_volumes = volumes_response['volumes'].sort {|x,y| x['displayOrder'] <=> y['displayOrder'] }
|
2716
2720
|
|
2717
2721
|
# prompt for volumes
|
2718
|
-
volumes = prompt_resize_volumes(current_volumes, service_plan, options)
|
2722
|
+
volumes = prompt_resize_volumes(current_volumes, service_plan, provision_type, options)
|
2719
2723
|
if !volumes.empty?
|
2720
2724
|
payload["volumes"] = volumes
|
2721
2725
|
end
|
@@ -509,10 +509,10 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
509
509
|
end
|
510
510
|
@monitoring_apps_interface.setopts(options)
|
511
511
|
if options[:dry_run]
|
512
|
-
print_dry_run @monitoring_apps_interface.dry.
|
512
|
+
print_dry_run @monitoring_apps_interface.dry.mute(monitor_app["id"], payload)
|
513
513
|
return 0
|
514
514
|
end
|
515
|
-
json_response = @monitoring_apps_interface.
|
515
|
+
json_response = @monitoring_apps_interface.mute(monitor_app["id"], payload)
|
516
516
|
if options[:json]
|
517
517
|
puts as_json(json_response, options)
|
518
518
|
elsif !options[:quiet]
|
@@ -557,10 +557,10 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
557
557
|
end
|
558
558
|
@monitoring_apps_interface.setopts(options)
|
559
559
|
if options[:dry_run]
|
560
|
-
print_dry_run @monitoring_apps_interface.dry.
|
560
|
+
print_dry_run @monitoring_apps_interface.dry.mute(monitor_app["id"], payload)
|
561
561
|
return 0
|
562
562
|
end
|
563
|
-
json_response = @monitoring_apps_interface.
|
563
|
+
json_response = @monitoring_apps_interface.mute(monitor_app["id"], payload)
|
564
564
|
if options[:json]
|
565
565
|
puts as_json(json_response, options)
|
566
566
|
elsif !options[:quiet]
|
@@ -602,10 +602,10 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
602
602
|
end
|
603
603
|
@monitoring_apps_interface.setopts(options)
|
604
604
|
if options[:dry_run]
|
605
|
-
print_dry_run @monitoring_apps_interface.dry.
|
605
|
+
print_dry_run @monitoring_apps_interface.dry.mute_all(payload)
|
606
606
|
return 0
|
607
607
|
end
|
608
|
-
json_response = @monitoring_apps_interface.
|
608
|
+
json_response = @monitoring_apps_interface.mute_all(payload)
|
609
609
|
if options[:json]
|
610
610
|
puts as_json(json_response, options)
|
611
611
|
elsif !options[:quiet]
|
@@ -648,10 +648,10 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
648
648
|
end
|
649
649
|
@monitoring_apps_interface.setopts(options)
|
650
650
|
if options[:dry_run]
|
651
|
-
print_dry_run @monitoring_apps_interface.dry.
|
651
|
+
print_dry_run @monitoring_apps_interface.dry.mute_all(payload)
|
652
652
|
return 0
|
653
653
|
end
|
654
|
-
json_response = @monitoring_apps_interface.
|
654
|
+
json_response = @monitoring_apps_interface.mute_all(payload)
|
655
655
|
if options[:json]
|
656
656
|
puts as_json(json_response, options)
|
657
657
|
elsif !options[:quiet]
|
@@ -507,10 +507,10 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
507
507
|
end
|
508
508
|
@monitoring_checks_interface.setopts(options)
|
509
509
|
if options[:dry_run]
|
510
|
-
print_dry_run @monitoring_checks_interface.dry.
|
510
|
+
print_dry_run @monitoring_checks_interface.dry.mute(check["id"], payload)
|
511
511
|
return 0
|
512
512
|
end
|
513
|
-
json_response = @monitoring_checks_interface.
|
513
|
+
json_response = @monitoring_checks_interface.mute(check["id"], payload)
|
514
514
|
if options[:json]
|
515
515
|
puts as_json(json_response, options)
|
516
516
|
elsif !options[:quiet]
|
@@ -555,10 +555,10 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
555
555
|
end
|
556
556
|
@monitoring_checks_interface.setopts(options)
|
557
557
|
if options[:dry_run]
|
558
|
-
print_dry_run @monitoring_checks_interface.dry.
|
558
|
+
print_dry_run @monitoring_checks_interface.dry.mute(check["id"], payload)
|
559
559
|
return 0
|
560
560
|
end
|
561
|
-
json_response = @monitoring_checks_interface.
|
561
|
+
json_response = @monitoring_checks_interface.mute(check["id"], payload)
|
562
562
|
if options[:json]
|
563
563
|
puts as_json(json_response, options)
|
564
564
|
elsif !options[:quiet]
|
@@ -600,10 +600,10 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
600
600
|
end
|
601
601
|
@monitoring_checks_interface.setopts(options)
|
602
602
|
if options[:dry_run]
|
603
|
-
print_dry_run @monitoring_checks_interface.dry.
|
603
|
+
print_dry_run @monitoring_checks_interface.dry.mute_all(payload)
|
604
604
|
return 0
|
605
605
|
end
|
606
|
-
json_response = @monitoring_checks_interface.
|
606
|
+
json_response = @monitoring_checks_interface.mute_all(payload)
|
607
607
|
if options[:json]
|
608
608
|
puts as_json(json_response, options)
|
609
609
|
elsif !options[:quiet]
|
@@ -646,10 +646,10 @@ class Morpheus::Cli::MonitoringChecksCommand
|
|
646
646
|
end
|
647
647
|
@monitoring_checks_interface.setopts(options)
|
648
648
|
if options[:dry_run]
|
649
|
-
print_dry_run @monitoring_checks_interface.dry.
|
649
|
+
print_dry_run @monitoring_checks_interface.dry.mute_all(payload)
|
650
650
|
return 0
|
651
651
|
end
|
652
|
-
json_response = @monitoring_checks_interface.
|
652
|
+
json_response = @monitoring_checks_interface.mute_all(payload)
|
653
653
|
if options[:json]
|
654
654
|
puts as_json(json_response, options)
|
655
655
|
elsif !options[:quiet]
|
@@ -467,10 +467,10 @@ class Morpheus::Cli::MonitoringGroupsCommand
|
|
467
467
|
end
|
468
468
|
@monitoring_groups_interface.setopts(options)
|
469
469
|
if options[:dry_run]
|
470
|
-
print_dry_run @monitoring_groups_interface.dry.
|
470
|
+
print_dry_run @monitoring_groups_interface.dry.mute(check_group["id"], payload)
|
471
471
|
return 0
|
472
472
|
end
|
473
|
-
json_response = @monitoring_groups_interface.
|
473
|
+
json_response = @monitoring_groups_interface.mute(check_group["id"], payload)
|
474
474
|
if options[:json]
|
475
475
|
puts as_json(json_response, options)
|
476
476
|
elsif !options[:quiet]
|
@@ -515,10 +515,10 @@ class Morpheus::Cli::MonitoringGroupsCommand
|
|
515
515
|
end
|
516
516
|
@monitoring_groups_interface.setopts(options)
|
517
517
|
if options[:dry_run]
|
518
|
-
print_dry_run @monitoring_groups_interface.dry.
|
518
|
+
print_dry_run @monitoring_groups_interface.dry.mute(check_group["id"], payload)
|
519
519
|
return 0
|
520
520
|
end
|
521
|
-
json_response = @monitoring_groups_interface.
|
521
|
+
json_response = @monitoring_groups_interface.mute(check_group["id"], payload)
|
522
522
|
if options[:json]
|
523
523
|
puts as_json(json_response, options)
|
524
524
|
elsif !options[:quiet]
|
@@ -560,10 +560,10 @@ class Morpheus::Cli::MonitoringGroupsCommand
|
|
560
560
|
end
|
561
561
|
@monitoring_groups_interface.setopts(options)
|
562
562
|
if options[:dry_run]
|
563
|
-
print_dry_run @monitoring_groups_interface.dry.
|
563
|
+
print_dry_run @monitoring_groups_interface.dry.mute_all(payload)
|
564
564
|
return 0
|
565
565
|
end
|
566
|
-
json_response = @monitoring_groups_interface.
|
566
|
+
json_response = @monitoring_groups_interface.mute_all(payload)
|
567
567
|
if options[:json]
|
568
568
|
puts as_json(json_response, options)
|
569
569
|
elsif !options[:quiet]
|
@@ -606,10 +606,10 @@ class Morpheus::Cli::MonitoringGroupsCommand
|
|
606
606
|
end
|
607
607
|
@monitoring_groups_interface.setopts(options)
|
608
608
|
if options[:dry_run]
|
609
|
-
print_dry_run @monitoring_groups_interface.dry.
|
609
|
+
print_dry_run @monitoring_groups_interface.dry.mute_all(payload)
|
610
610
|
return 0
|
611
611
|
end
|
612
|
-
json_response = @monitoring_groups_interface.
|
612
|
+
json_response = @monitoring_groups_interface.mute_all(payload)
|
613
613
|
if options[:json]
|
614
614
|
puts as_json(json_response, options)
|
615
615
|
elsif !options[:quiet]
|
@@ -579,10 +579,10 @@ class Morpheus::Cli::MonitoringIncidentsCommand
|
|
579
579
|
end
|
580
580
|
@monitoring_incidents_interface.setopts(options)
|
581
581
|
if options[:dry_run]
|
582
|
-
print_dry_run @monitoring_incidents_interface.dry.
|
582
|
+
print_dry_run @monitoring_incidents_interface.dry.mute(incident["id"], payload)
|
583
583
|
return 0
|
584
584
|
end
|
585
|
-
json_response = @monitoring_incidents_interface.
|
585
|
+
json_response = @monitoring_incidents_interface.mute(incident["id"], payload)
|
586
586
|
if options[:json]
|
587
587
|
puts as_json(json_response, options)
|
588
588
|
elsif !options[:quiet]
|
@@ -627,10 +627,10 @@ class Morpheus::Cli::MonitoringIncidentsCommand
|
|
627
627
|
end
|
628
628
|
@monitoring_incidents_interface.setopts(options)
|
629
629
|
if options[:dry_run]
|
630
|
-
print_dry_run @monitoring_incidents_interface.dry.
|
630
|
+
print_dry_run @monitoring_incidents_interface.dry.mute(incident["id"], payload)
|
631
631
|
return 0
|
632
632
|
end
|
633
|
-
json_response = @monitoring_incidents_interface.
|
633
|
+
json_response = @monitoring_incidents_interface.mute(incident["id"], payload)
|
634
634
|
if options[:json]
|
635
635
|
puts as_json(json_response, options)
|
636
636
|
elsif !options[:quiet]
|
@@ -672,10 +672,10 @@ class Morpheus::Cli::MonitoringIncidentsCommand
|
|
672
672
|
end
|
673
673
|
@monitoring_incidents_interface.setopts(options)
|
674
674
|
if options[:dry_run]
|
675
|
-
print_dry_run @monitoring_incidents_interface.dry.
|
675
|
+
print_dry_run @monitoring_incidents_interface.dry.mute_all(payload)
|
676
676
|
return 0
|
677
677
|
end
|
678
|
-
json_response = @monitoring_incidents_interface.
|
678
|
+
json_response = @monitoring_incidents_interface.mute_all(payload)
|
679
679
|
if options[:json]
|
680
680
|
puts as_json(json_response, options)
|
681
681
|
elsif !options[:quiet]
|
@@ -718,10 +718,10 @@ class Morpheus::Cli::MonitoringIncidentsCommand
|
|
718
718
|
end
|
719
719
|
@monitoring_incidents_interface.setopts(options)
|
720
720
|
if options[:dry_run]
|
721
|
-
print_dry_run @monitoring_incidents_interface.dry.
|
721
|
+
print_dry_run @monitoring_incidents_interface.dry.mute_all(payload)
|
722
722
|
return 0
|
723
723
|
end
|
724
|
-
json_response = @monitoring_incidents_interface.
|
724
|
+
json_response = @monitoring_incidents_interface.mute_all(payload)
|
725
725
|
if options[:json]
|
726
726
|
puts as_json(json_response, options)
|
727
727
|
elsif !options[:quiet]
|