morpheus-cli 5.4.2 → 5.4.4
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/api/api_client.rb +12 -1
- data/lib/morpheus/api/catalog_item_types_interface.rb +17 -0
- 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/instances_interface.rb +28 -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/ping_interface.rb +2 -0
- data/lib/morpheus/api/power_schedules_interface.rb +2 -2
- data/lib/morpheus/api/service_plans_interface.rb +6 -0
- data/lib/morpheus/api/setup_interface.rb +4 -0
- data/lib/morpheus/api/snapshots_interface.rb +19 -0
- data/lib/morpheus/cli/cli_command.rb +10 -17
- data/lib/morpheus/cli/commands/catalog_item_types_command.rb +156 -1
- data/lib/morpheus/cli/commands/clusters.rb +177 -50
- 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 +32 -2
- data/lib/morpheus/cli/commands/instances.rb +255 -2
- data/lib/morpheus/cli/commands/library_instance_types_command.rb +3 -0
- 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/network_static_routes_command.rb +5 -0
- data/lib/morpheus/cli/commands/networks_command.rb +2 -2
- data/lib/morpheus/cli/commands/ping.rb +3 -5
- data/lib/morpheus/cli/commands/policies_command.rb +1 -1
- data/lib/morpheus/cli/commands/power_schedules_command.rb +189 -258
- data/lib/morpheus/cli/commands/provisioning_settings_command.rb +1 -0
- data/lib/morpheus/cli/commands/remote.rb +16 -10
- data/lib/morpheus/cli/commands/security_groups.rb +2 -2
- data/lib/morpheus/cli/commands/service_plans_command.rb +52 -5
- data/lib/morpheus/cli/commands/setup.rb +1 -1
- data/lib/morpheus/cli/commands/snapshots.rb +139 -0
- 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/commands/tasks.rb +5 -5
- data/lib/morpheus/cli/commands/user_settings_command.rb +1 -1
- data/lib/morpheus/cli/commands/virtual_images.rb +4 -1
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +117 -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 +27 -11
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/routes.rb +13 -3
- metadata +13 -7
@@ -17,7 +17,8 @@ class Morpheus::Cli::Instances
|
|
17
17
|
:logs, :stats, :stop, :start, :restart, :actions, :action, :suspend, :eject, :stop_service, :start_service, :restart_service,
|
18
18
|
:backup, :backups, :resize, :clone, :envs, :setenv, :delenv,
|
19
19
|
:lock, :unlock, :clone_image,
|
20
|
-
:security_groups, :apply_security_groups, :run_workflow,
|
20
|
+
:security_groups, :apply_security_groups, :run_workflow,
|
21
|
+
:import_snapshot, :snapshot, :snapshots, :revert_to_snapshot, :remove_all_snapshots, :remove_all_container_snapshots, :create_linked_clone,
|
21
22
|
:console, :status_check, {:containers => :list_containers},
|
22
23
|
:scaling, {:'scaling-update' => :scaling_update},
|
23
24
|
:wiki, :update_wiki,
|
@@ -52,6 +53,7 @@ class Morpheus::Cli::Instances
|
|
52
53
|
@execution_request_interface = @api_client.execution_request
|
53
54
|
@deploy_interface = @api_client.deploy
|
54
55
|
@deployments_interface = @api_client.deployments
|
56
|
+
@snapshots_interface = @api_client.snapshots
|
55
57
|
end
|
56
58
|
|
57
59
|
def handle(args)
|
@@ -2692,6 +2694,10 @@ class Morpheus::Cli::Instances
|
|
2692
2694
|
layout_id = instance['layout']['id']
|
2693
2695
|
plan_id = instance['plan']['id']
|
2694
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
|
+
|
2695
2701
|
# prompt for service plan
|
2696
2702
|
service_plans_json = @instances_interface.service_plans({zoneId: cloud_id, siteId: group_id, layoutId: layout_id})
|
2697
2703
|
service_plans = service_plans_json["plans"]
|
@@ -2713,11 +2719,17 @@ class Morpheus::Cli::Instances
|
|
2713
2719
|
current_volumes = volumes_response['volumes'].sort {|x,y| x['displayOrder'] <=> y['displayOrder'] }
|
2714
2720
|
|
2715
2721
|
# prompt for volumes
|
2716
|
-
volumes = prompt_resize_volumes(current_volumes, service_plan, options)
|
2722
|
+
volumes = prompt_resize_volumes(current_volumes, service_plan, provision_type, options)
|
2717
2723
|
if !volumes.empty?
|
2718
2724
|
payload["volumes"] = volumes
|
2719
2725
|
end
|
2720
2726
|
|
2727
|
+
# plan customizations
|
2728
|
+
plan_opts = prompt_service_plan_options(service_plan, options, @api_client, {}, instance)
|
2729
|
+
if plan_opts && !plan_opts.empty?
|
2730
|
+
payload['servicePlanOptions'] = plan_opts
|
2731
|
+
end
|
2732
|
+
|
2721
2733
|
# only amazon supports this option
|
2722
2734
|
# for now, always do this
|
2723
2735
|
payload["deleteOriginalVolumes"] = true
|
@@ -3361,6 +3373,223 @@ EOT
|
|
3361
3373
|
end
|
3362
3374
|
end
|
3363
3375
|
|
3376
|
+
def revert_to_snapshot(args)
|
3377
|
+
options = {}
|
3378
|
+
instance = nil
|
3379
|
+
snapshot_id = nil
|
3380
|
+
|
3381
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
3382
|
+
opts.banner = subcommand_usage("[instance]")
|
3383
|
+
opts.on("--snapshot ID", String, "Optional snapshot") do |val|
|
3384
|
+
snapshot_id = val
|
3385
|
+
end
|
3386
|
+
build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
|
3387
|
+
build_standard_add_options(opts, options) #, [:options, :payload, :json, :dry_run, :remote, :quiet])
|
3388
|
+
opts.footer = "Revert an Instance to saved Snapshot previously made." + "\n" +
|
3389
|
+
"[snapshotId] is required. This is the id of the snapshot to replace the current instance."
|
3390
|
+
end
|
3391
|
+
|
3392
|
+
optparse.parse!(args)
|
3393
|
+
if args.count != 1
|
3394
|
+
raise_command_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.join(' ')}\n#{optparse}"
|
3395
|
+
end
|
3396
|
+
connect(options)
|
3397
|
+
begin
|
3398
|
+
instance = find_instance_by_name_or_id(args[0])
|
3399
|
+
unless options[:yes] || ::Morpheus::Cli::OptionTypes::confirm("Are you sure you would like to revert instance '#{instance['name']}'?", options)
|
3400
|
+
exit 1
|
3401
|
+
end
|
3402
|
+
options[:options]['instanceId'] = instance['id']
|
3403
|
+
begin
|
3404
|
+
snapshot_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'snapshotId', 'type' => 'select', 'fieldLabel' => 'Snapshot', 'optionSource' => 'instanceSnapshots', 'required' => true, 'description' => 'Select Snapshot.'}], {}, @api_client, options[:options])
|
3405
|
+
|
3406
|
+
if !snapshot_prompt['snapshotId'].to_s.empty?
|
3407
|
+
snapshot_id = snapshot_prompt['snapshotId']
|
3408
|
+
end
|
3409
|
+
rescue RestClient::Exception => e
|
3410
|
+
puts "Failed to load instance snapshots"
|
3411
|
+
end
|
3412
|
+
|
3413
|
+
@instances_interface.setopts(options)
|
3414
|
+
|
3415
|
+
payload = {}
|
3416
|
+
if options[:dry_run]
|
3417
|
+
print_dry_run @instances_interface.dry.revert_to_snapshot(instance['id'], snapshot_id, payload)
|
3418
|
+
return
|
3419
|
+
end
|
3420
|
+
|
3421
|
+
json_response = @instances_interface.revert_to_snapshot(instance['id'], snapshot_id, payload)
|
3422
|
+
if options[:json]
|
3423
|
+
puts as_json(json_response, options)
|
3424
|
+
else
|
3425
|
+
print_green_success "Snapshot revert initiated."
|
3426
|
+
end
|
3427
|
+
return 0
|
3428
|
+
|
3429
|
+
rescue RestClient::Exception => e
|
3430
|
+
print_rest_exception(e, options)
|
3431
|
+
exit 1
|
3432
|
+
end
|
3433
|
+
end
|
3434
|
+
|
3435
|
+
def remove_all_container_snapshots(args)
|
3436
|
+
options = {}
|
3437
|
+
instance = nil
|
3438
|
+
container_id = nil
|
3439
|
+
|
3440
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
3441
|
+
opts.banner = subcommand_usage("[instance]")
|
3442
|
+
opts.on("--container ID", String, "Required container") do |val|
|
3443
|
+
container_id = val
|
3444
|
+
end
|
3445
|
+
build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
|
3446
|
+
opts.footer = "Remove all snapshots attached to an instances container." + "\n" +
|
3447
|
+
"[containerId] is required. This is the id of the container which removes all attached snapshots."
|
3448
|
+
end
|
3449
|
+
|
3450
|
+
optparse.parse!(args)
|
3451
|
+
if args.count != 1
|
3452
|
+
raise_command_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.join(' ')}\n#{optparse}"
|
3453
|
+
end
|
3454
|
+
connect(options)
|
3455
|
+
begin
|
3456
|
+
instance = find_instance_by_name_or_id(args[0])
|
3457
|
+
unless options[:yes] || ::Morpheus::Cli::OptionTypes::confirm("Are you sure you would like to remove all snapshots for a container?", options)
|
3458
|
+
exit 1
|
3459
|
+
end
|
3460
|
+
options[:options]['instanceId'] = instance['id']
|
3461
|
+
begin
|
3462
|
+
container_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'containerId', 'type' => 'select', 'fieldLabel' => 'Container', 'optionSource' => 'instanceContainers', 'required' => true, 'description' => 'Select Container.'}], {}, @api_client, options[:options])
|
3463
|
+
|
3464
|
+
if !container_prompt['containerId'].to_s.empty?
|
3465
|
+
container_id = container_prompt['containerId']
|
3466
|
+
end
|
3467
|
+
rescue RestClient::Exception => e
|
3468
|
+
puts "Failed to load instance containers"
|
3469
|
+
end
|
3470
|
+
|
3471
|
+
@instances_interface.setopts(options)
|
3472
|
+
|
3473
|
+
payload = {}
|
3474
|
+
if options[:dry_run]
|
3475
|
+
print_dry_run @instances_interface.dry.remove_all_container_snapshots(instance['id'], container_id, payload)
|
3476
|
+
return
|
3477
|
+
end
|
3478
|
+
|
3479
|
+
json_response = @instances_interface.remove_all_container_snapshots(instance['id'], container_id, payload)
|
3480
|
+
if options[:json]
|
3481
|
+
puts as_json(json_response, options)
|
3482
|
+
else
|
3483
|
+
print_green_success "Snapshot delete initiated."
|
3484
|
+
end
|
3485
|
+
return 0
|
3486
|
+
|
3487
|
+
rescue RestClient::Exception => e
|
3488
|
+
print_rest_exception(e, options)
|
3489
|
+
exit 1
|
3490
|
+
end
|
3491
|
+
end
|
3492
|
+
|
3493
|
+
def remove_all_snapshots(args)
|
3494
|
+
options = {}
|
3495
|
+
instance = nil
|
3496
|
+
|
3497
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
3498
|
+
opts.banner = subcommand_usage("[instance]")
|
3499
|
+
build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
|
3500
|
+
opts.footer = "Remove all snapshots attached to an instance." + "\n" +
|
3501
|
+
"Warning: This will remove all snapshots across all containers of an instance."
|
3502
|
+
end
|
3503
|
+
|
3504
|
+
optparse.parse!(args)
|
3505
|
+
if args.count != 1
|
3506
|
+
raise_command_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.join(' ')}\n#{optparse}"
|
3507
|
+
end
|
3508
|
+
connect(options)
|
3509
|
+
begin
|
3510
|
+
instance = find_instance_by_name_or_id(args[0])
|
3511
|
+
unless options[:yes] || ::Morpheus::Cli::OptionTypes::confirm("Are you sure you would like to remove all snapshots for this instance?", options)
|
3512
|
+
exit 1
|
3513
|
+
end
|
3514
|
+
options[:options]['instanceId'] = instance['id']
|
3515
|
+
|
3516
|
+
@instances_interface.setopts(options)
|
3517
|
+
|
3518
|
+
payload = {}
|
3519
|
+
if options[:dry_run]
|
3520
|
+
print_dry_run @instances_interface.dry.remove_all_instance_snapshots(instance['id'], payload)
|
3521
|
+
return
|
3522
|
+
end
|
3523
|
+
|
3524
|
+
json_response = @instances_interface.remove_all_instance_snapshots(instance['id'], payload)
|
3525
|
+
if options[:json]
|
3526
|
+
puts as_json(json_response, options)
|
3527
|
+
else
|
3528
|
+
print_green_success "Snapshots attaced to instance #{instance['name']} queued for deletion."
|
3529
|
+
end
|
3530
|
+
return 0
|
3531
|
+
|
3532
|
+
rescue RestClient::Exception => e
|
3533
|
+
print_rest_exception(e, options)
|
3534
|
+
exit 1
|
3535
|
+
end
|
3536
|
+
end
|
3537
|
+
|
3538
|
+
def create_linked_clone(args)
|
3539
|
+
options = {}
|
3540
|
+
instance = nil
|
3541
|
+
snapshot_id = nil
|
3542
|
+
|
3543
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
3544
|
+
opts.banner = subcommand_usage("[instance]")
|
3545
|
+
opts.on("--snapshot ID", String, "Optional snapshot") do |val|
|
3546
|
+
snapshot_id = val
|
3547
|
+
end
|
3548
|
+
build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
|
3549
|
+
opts.footer = "Create a linked clone using the selected snapshot of an Instance." + "\n" +
|
3550
|
+
"[snapshotId] is required. This is the id of the snapshot which the clone will refer to."
|
3551
|
+
end
|
3552
|
+
|
3553
|
+
optparse.parse!(args)
|
3554
|
+
if args.count != 1
|
3555
|
+
raise_command_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.join(' ')}\n#{optparse}"
|
3556
|
+
end
|
3557
|
+
connect(options)
|
3558
|
+
begin
|
3559
|
+
instance = find_instance_by_name_or_id(args[0])
|
3560
|
+
options[:options]['instanceId'] = instance['id']
|
3561
|
+
begin
|
3562
|
+
snapshot_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'snapshotId', 'type' => 'select', 'fieldLabel' => 'Snapshot', 'optionSource' => 'instanceSnapshots', 'required' => true, 'description' => 'Select Snapshot.'}], {}, @api_client, options[:options])
|
3563
|
+
|
3564
|
+
if !snapshot_prompt['snapshotId'].to_s.empty?
|
3565
|
+
snapshot_id = snapshot_prompt['snapshotId']
|
3566
|
+
end
|
3567
|
+
rescue RestClient::Exception => e
|
3568
|
+
puts "Failed to load instance snapshots"
|
3569
|
+
end
|
3570
|
+
|
3571
|
+
@instances_interface.setopts(options)
|
3572
|
+
|
3573
|
+
payload = {}
|
3574
|
+
if options[:dry_run]
|
3575
|
+
print_dry_run @instances_interface.dry.create_linked_clone(instance['id'], snapshot_id, payload)
|
3576
|
+
return
|
3577
|
+
end
|
3578
|
+
|
3579
|
+
json_response = @instances_interface.create_linked_clone(instance['id'], snapshot_id, payload)
|
3580
|
+
if options[:json]
|
3581
|
+
puts as_json(json_response, options)
|
3582
|
+
else
|
3583
|
+
print_green_success "Linked Clone creation initiated."
|
3584
|
+
end
|
3585
|
+
return 0
|
3586
|
+
|
3587
|
+
rescue RestClient::Exception => e
|
3588
|
+
print_rest_exception(e, options)
|
3589
|
+
exit 1
|
3590
|
+
end
|
3591
|
+
end
|
3592
|
+
|
3364
3593
|
|
3365
3594
|
def scaling(args)
|
3366
3595
|
options = {}
|
@@ -4133,6 +4362,9 @@ EOT
|
|
4133
4362
|
opts.on( '--name VALUE', String, "Image Name (Template Name). Default is server name + timestamp" ) do |val|
|
4134
4363
|
options[:options]['templateName'] = val
|
4135
4364
|
end
|
4365
|
+
opts.on( '--folder VALUE', String, "Folder externalId or '/' to use the root folder" ) do |val|
|
4366
|
+
options[:options]['zoneFolder'] = val
|
4367
|
+
end
|
4136
4368
|
build_standard_update_options(opts, options)
|
4137
4369
|
opts.footer = <<-EOT
|
4138
4370
|
Clone to image (template) for an instance
|
@@ -4144,6 +4376,18 @@ EOT
|
|
4144
4376
|
connect(options)
|
4145
4377
|
instance = find_instance_by_name_or_id(args[0])
|
4146
4378
|
return 1 if instance.nil?
|
4379
|
+
# need to GET provision type for hasFolders
|
4380
|
+
provision_type_code = instance['layout']['provisionTypeCode'] rescue nil
|
4381
|
+
provision_type = nil
|
4382
|
+
if provision_type_code
|
4383
|
+
provision_type = provision_types_interface.list({code:provision_type_code})['provisionTypes'][0]
|
4384
|
+
if provision_type.nil?
|
4385
|
+
print_red_alert "Provision Type not found by code #{provision_type_code}"
|
4386
|
+
exit 1
|
4387
|
+
end
|
4388
|
+
else
|
4389
|
+
provision_type = get_provision_type_for_zone_type(cloud['zoneType']['id'])
|
4390
|
+
end
|
4147
4391
|
payload = {}
|
4148
4392
|
if options[:payload]
|
4149
4393
|
payload = options[:payload]
|
@@ -4156,6 +4400,15 @@ EOT
|
|
4156
4400
|
payload['templateName'] = v_prompt['templateName']
|
4157
4401
|
end
|
4158
4402
|
end
|
4403
|
+
#if instance['layout']['provisionTypeCode'] == 'vmware'
|
4404
|
+
if provision_type && provision_type["hasFolders"]
|
4405
|
+
if payload['zoneFolder'].nil?
|
4406
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'zoneFolder', 'type' => 'select', 'optionSource' => 'vmwareFolders', 'fieldLabel' => 'Folder', 'description' => "Folder externalId or '/' to use the root folder", 'required' => true}], options[:options], @api_client, {siteId: instance['group']['id'], zoneId: instance['cloud']['id']})
|
4407
|
+
if v_prompt['zoneFolder'].to_s != ''
|
4408
|
+
payload['zoneFolder'] = v_prompt['zoneFolder']
|
4409
|
+
end
|
4410
|
+
end
|
4411
|
+
end
|
4159
4412
|
end
|
4160
4413
|
@instances_interface.setopts(options)
|
4161
4414
|
if options[:dry_run]
|
@@ -39,6 +39,9 @@ class Morpheus::Cli::LibraryInstanceTypesCommand
|
|
39
39
|
opts.on('--technology VALUE', String, "Filter by technology") do |val|
|
40
40
|
params['provisionTypeCode'] = val
|
41
41
|
end
|
42
|
+
opts.on('--featured [true|false]',String, "Filter by featured.") do |val|
|
43
|
+
params['featured'] = (val.to_s.downcase != 'false' && val.to_s.downcase != 'off')
|
44
|
+
end
|
42
45
|
build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
43
46
|
opts.footer = "List instance types."
|
44
47
|
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]
|
@@ -149,6 +149,11 @@ class Morpheus::Cli::NetworkStaticRoutesCommand
|
|
149
149
|
return 1
|
150
150
|
end
|
151
151
|
|
152
|
+
if !network_type['hasStaticRoutes']
|
153
|
+
print_red_alert "Static routes not supported for #{network_type['name']}"
|
154
|
+
return 1
|
155
|
+
end
|
156
|
+
|
152
157
|
payload = nil
|
153
158
|
if options[:payload]
|
154
159
|
payload = options[:payload]
|
@@ -189,7 +189,7 @@ class Morpheus::Cli::NetworksCommand
|
|
189
189
|
print cyan
|
190
190
|
description_cols = {
|
191
191
|
"ID" => 'id',
|
192
|
-
"Name" => 'name',
|
192
|
+
"Name" => lambda {|it| it['displayName'] ? it['displayName'] : it['name'] },
|
193
193
|
"Description" => 'description',
|
194
194
|
"Type" => lambda {|it| it['type'] ? it['type']['name'] : '' },
|
195
195
|
"Group" => lambda {|it| it['group'] ? it['group']['name'] : 'Shared' },
|
@@ -242,7 +242,7 @@ class Morpheus::Cli::NetworksCommand
|
|
242
242
|
subnet_rows = subnets.collect { |subnet|
|
243
243
|
{
|
244
244
|
id: subnet['id'],
|
245
|
-
name: " #{subnet['name']}",
|
245
|
+
name: " #{subnet['displayName'] || subnet['name']}",
|
246
246
|
# type: subnet['type'] ? subnet['type']['name'] : '',
|
247
247
|
type: "Subnet",
|
248
248
|
cloud: network['zone'] ? network['zone']['name'] : '',
|
@@ -106,14 +106,12 @@ EOT
|
|
106
106
|
if json_response['applianceUrl']
|
107
107
|
appliance[:appliance_url] = json_response['applianceUrl']
|
108
108
|
end
|
109
|
-
#
|
110
|
-
if appliance[:build_version] && appliance[:status].nil?
|
111
|
-
appliance[:status] = 'ready'
|
112
|
-
end
|
113
|
-
# update setupNeeded?
|
109
|
+
# setupNeeded?
|
114
110
|
if json_response['setupNeeded'] == true
|
115
111
|
# appliance[:setup_needed] = true
|
116
112
|
appliance[:status] = 'fresh'
|
113
|
+
else
|
114
|
+
appliance[:status] = 'ready'
|
117
115
|
end
|
118
116
|
# if took_sec
|
119
117
|
# appliance[:last_check] ||= {}
|
@@ -511,7 +511,7 @@ class Morpheus::Cli::PoliciesCommand
|
|
511
511
|
policy_type_option_types = policy_type['optionTypes']
|
512
512
|
# puts "POLICY OPTION TYPES:\n #{policy_type_option_types.inspect}"
|
513
513
|
if policy_type_option_types
|
514
|
-
config_prompt = Morpheus::Cli::OptionTypes.prompt(policy_type_option_types, options, @api_client)
|
514
|
+
config_prompt = Morpheus::Cli::OptionTypes.prompt(policy_type_option_types, options, @api_client, {}, false, true, true)
|
515
515
|
# everything should be under fieldContext:'config'
|
516
516
|
# payload['policy'].deep_merge!(config_prompt)
|
517
517
|
if config_prompt['config']
|