morpheus-cli 5.5.3.2 → 6.0.0
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/cloud_resource_pools_interface.rb +28 -3
- data/lib/morpheus/api/containers_interface.rb +10 -0
- data/lib/morpheus/api/doc_interface.rb +1 -10
- data/lib/morpheus/api/key_pairs_interface.rb +9 -0
- data/lib/morpheus/api/network_floating_ips_interface.rb +37 -0
- data/lib/morpheus/api/resource_pool_groups_interface.rb +51 -0
- data/lib/morpheus/cli/cli_command.rb +17 -11
- data/lib/morpheus/cli/commands/appliance_settings_command.rb +5 -0
- data/lib/morpheus/cli/commands/apps.rb +11 -5
- data/lib/morpheus/cli/commands/catalog_item_types_command.rb +42 -12
- data/lib/morpheus/cli/commands/clusters.rb +23 -2
- data/lib/morpheus/cli/commands/containers_command.rb +129 -4
- data/lib/morpheus/cli/commands/doc.rb +14 -13
- data/lib/morpheus/cli/commands/hosts.rb +2 -0
- data/lib/morpheus/cli/commands/instances.rb +8 -2
- data/lib/morpheus/cli/commands/key_pairs.rb +94 -33
- data/lib/morpheus/cli/commands/network_floating_ips.rb +109 -0
- data/lib/morpheus/cli/commands/reports_command.rb +8 -1
- data/lib/morpheus/cli/commands/resource_pool_groups_command.rb +586 -0
- data/lib/morpheus/cli/commands/roles.rb +10 -10
- data/lib/morpheus/cli/commands/service_catalog_command.rb +8 -0
- data/lib/morpheus/cli/commands/tasks.rb +1 -1
- data/lib/morpheus/cli/commands/workflows.rb +1 -1
- data/lib/morpheus/cli/mixins/infrastructure_helper.rb +148 -0
- data/lib/morpheus/cli/option_types.rb +1 -1
- data/lib/morpheus/cli/version.rb +1 -1
- data/test/cli/doc_test.rb +1 -1
- metadata +6 -2
@@ -902,7 +902,7 @@ class Morpheus::Cli::Tasks
|
|
902
902
|
opts.on(nil, '--no-refresh', "Do not refresh" ) do
|
903
903
|
options[:no_refresh] = true
|
904
904
|
end
|
905
|
-
|
905
|
+
build_standard_post_options(opts, options)
|
906
906
|
end
|
907
907
|
optparse.parse!(args)
|
908
908
|
if args.count != 1
|
@@ -593,7 +593,7 @@ class Morpheus::Cli::Workflows
|
|
593
593
|
opts.on(nil, '--no-refresh', "Do not refresh" ) do
|
594
594
|
options[:no_refresh] = true
|
595
595
|
end
|
596
|
-
|
596
|
+
build_standard_post_options(opts, options)
|
597
597
|
end
|
598
598
|
optparse.parse!(args)
|
599
599
|
if args.count != 1
|
@@ -39,6 +39,18 @@ module Morpheus::Cli::InfrastructureHelper
|
|
39
39
|
@network_groups_interface
|
40
40
|
end
|
41
41
|
|
42
|
+
def resource_pool_groups_interface
|
43
|
+
# @api_client.resource_pool_groups
|
44
|
+
raise "#{self.class} has not defined @resource_pool_groups_interface" if @resource_pool_groups_interface.nil?
|
45
|
+
@resource_pool_groups_interface
|
46
|
+
end
|
47
|
+
|
48
|
+
def resource_pools_interface
|
49
|
+
# @api_client.resource_pool_groups
|
50
|
+
raise "#{self.class} has not defined @cloud_resource_pools_interface" if @cloud_resource_pools_interface.nil?
|
51
|
+
@cloud_resource_pools_interface
|
52
|
+
end
|
53
|
+
|
42
54
|
def network_types_interface
|
43
55
|
# @api_client.network_types
|
44
56
|
raise "#{self.class} has not defined @network_types_interface" if @network_types_interface.nil?
|
@@ -343,6 +355,86 @@ module Morpheus::Cli::InfrastructureHelper
|
|
343
355
|
end
|
344
356
|
end
|
345
357
|
|
358
|
+
def find_resource_pool_by_name_or_id(val)
|
359
|
+
if val.to_s =~ /\A\d{1,}\Z/
|
360
|
+
return find_resource_pool_by_id(val)
|
361
|
+
else
|
362
|
+
return find_resource_pool_by_name(val)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
def find_resource_pool_by_id(id)
|
367
|
+
begin
|
368
|
+
json_response = resource_pools_interface.get_without_cloud(id.to_i)
|
369
|
+
return json_response['resourcePool']
|
370
|
+
rescue RestClient::Exception => e
|
371
|
+
if e.response && e.response.code == 404
|
372
|
+
print_red_alert "Resource Pool not found by id #{id}"
|
373
|
+
return nil
|
374
|
+
else
|
375
|
+
raise e
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
380
|
+
def find_resource_pool_by_name(name)
|
381
|
+
json_response = resource_pools_interface.list_without_cloud({name: name.to_s})
|
382
|
+
resource_pools = json_response['resourcePools']
|
383
|
+
if resource_pools.empty?
|
384
|
+
print_red_alert "Resource Pool not found by name #{name}"
|
385
|
+
return nil
|
386
|
+
elsif resource_pools.size > 1
|
387
|
+
print_red_alert "#{resource_pools.size} resource pools found by name #{name}"
|
388
|
+
rows = resource_pools.collect do |it|
|
389
|
+
{id: it['id'], name: it['name']}
|
390
|
+
end
|
391
|
+
puts as_pretty_table(rows, [:id, :name], {color:red})
|
392
|
+
return nil
|
393
|
+
else
|
394
|
+
return resource_pools[0]
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
def find_resource_pool_group_by_name_or_id(val)
|
399
|
+
if val.to_s =~ /\A\d{1,}\Z/
|
400
|
+
return find_resource_pool_group_by_id(val)
|
401
|
+
else
|
402
|
+
return find_resource_pool_group_by_name(val)
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
def find_resource_pool_group_by_id(id)
|
407
|
+
begin
|
408
|
+
json_response = resource_pool_groups_interface.get(id.to_i)
|
409
|
+
return json_response['resourcePoolGroup']
|
410
|
+
rescue RestClient::Exception => e
|
411
|
+
if e.response && e.response.code == 404
|
412
|
+
print_red_alert "Resource Pool Group not found by id #{id}"
|
413
|
+
return nil
|
414
|
+
else
|
415
|
+
raise e
|
416
|
+
end
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
def find_resource_pool_group_by_name(name)
|
421
|
+
json_response = resource_pool_groups_interface.list({name: name.to_s})
|
422
|
+
resource_pool_groups = json_response['resourcePoolGroups']
|
423
|
+
if resource_pool_groups.empty?
|
424
|
+
print_red_alert "Resource Pool Group not found by name #{name}"
|
425
|
+
return nil
|
426
|
+
elsif resource_pool_groups.size > 1
|
427
|
+
print_red_alert "#{resource_pool_groups.size} resource pool groups found by name #{name}"
|
428
|
+
rows = resource_pool_groups.collect do |it|
|
429
|
+
{id: it['id'], name: it['name']}
|
430
|
+
end
|
431
|
+
puts as_pretty_table(rows, [:id, :name], {color:red})
|
432
|
+
return nil
|
433
|
+
else
|
434
|
+
return resource_pool_groups[0]
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
346
438
|
def prompt_for_network(network_id, options={}, required=true, field_name='network', field_label='Network')
|
347
439
|
# Prompt for a Network, text input that searches by name or id
|
348
440
|
network = nil
|
@@ -479,6 +571,62 @@ module Morpheus::Cli::InfrastructureHelper
|
|
479
571
|
return {success:true, data: record_ids}
|
480
572
|
end
|
481
573
|
|
574
|
+
def prompt_for_pools(params, options={}, api_client=nil, api_params={})
|
575
|
+
# Pools
|
576
|
+
pool_list = nil
|
577
|
+
pool_ids = nil
|
578
|
+
still_prompting = true
|
579
|
+
if params['pools'].nil?
|
580
|
+
still_prompting = true
|
581
|
+
while still_prompting do
|
582
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'pools', 'type' => 'text', 'fieldLabel' => 'Pools', 'required' => false, 'description' => 'Pools to include, comma separated list of names or IDs.'}], options[:options])
|
583
|
+
unless v_prompt['pools'].to_s.empty?
|
584
|
+
pool_list = v_prompt['pools'].split(",").collect {|it| it.to_s.strip.empty? ? nil : it.to_s.strip }.compact.uniq
|
585
|
+
end
|
586
|
+
pool_ids = []
|
587
|
+
bad_ids = []
|
588
|
+
if pool_list && pool_list.size > 0
|
589
|
+
pool_list.each do |it|
|
590
|
+
found_pool = nil
|
591
|
+
begin
|
592
|
+
found_pool = find_resource_pool_by_name_or_id(it)
|
593
|
+
rescue SystemExit => cmdexit
|
594
|
+
end
|
595
|
+
if found_pool
|
596
|
+
pool_ids << found_pool['id']
|
597
|
+
else
|
598
|
+
bad_ids << it
|
599
|
+
end
|
600
|
+
end
|
601
|
+
end
|
602
|
+
still_prompting = bad_ids.empty? ? false : true
|
603
|
+
end
|
604
|
+
else
|
605
|
+
pool_list = params['pools']
|
606
|
+
still_prompting = false
|
607
|
+
pool_ids = []
|
608
|
+
bad_ids = []
|
609
|
+
if pool_list && pool_list.size > 0
|
610
|
+
pool_list.each do |it|
|
611
|
+
found_pool = nil
|
612
|
+
begin
|
613
|
+
found_pool = find_resource_pool_by_name_or_id(it)
|
614
|
+
rescue SystemExit => cmdexit
|
615
|
+
end
|
616
|
+
if found_pool
|
617
|
+
pool_ids << found_pool['id']
|
618
|
+
else
|
619
|
+
bad_ids << it
|
620
|
+
end
|
621
|
+
end
|
622
|
+
end
|
623
|
+
if !bad_ids.empty?
|
624
|
+
return {success:false, msg:"Pools not found: #{bad_ids}"}
|
625
|
+
end
|
626
|
+
end
|
627
|
+
return {success:true, data: pool_ids}
|
628
|
+
end
|
629
|
+
|
482
630
|
def network_pool_server_list_column_definitions(options)
|
483
631
|
{
|
484
632
|
"ID" => 'id',
|
@@ -678,7 +678,7 @@ module Morpheus
|
|
678
678
|
# print "Perhaps you meant one of these? #{ored_list(matched_options.collect {|i|i[value_field]}, 3)}\n"
|
679
679
|
print "Try using value instead of name.\n"
|
680
680
|
print "\n"
|
681
|
-
exit 1
|
681
|
+
#exit 1
|
682
682
|
elsif matched_options.size == 1
|
683
683
|
matched_option = matched_options[0]
|
684
684
|
end
|
data/lib/morpheus/cli/version.rb
CHANGED
data/test/cli/doc_test.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
|
+
version: 6.0.0
|
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: 2023-02
|
14
|
+
date: 2023-03-02 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -280,6 +280,7 @@ files:
|
|
280
280
|
- lib/morpheus/api/network_domain_records_interface.rb
|
281
281
|
- lib/morpheus/api/network_domains_interface.rb
|
282
282
|
- lib/morpheus/api/network_edge_clusters_interface.rb
|
283
|
+
- lib/morpheus/api/network_floating_ips_interface.rb
|
283
284
|
- lib/morpheus/api/network_groups_interface.rb
|
284
285
|
- lib/morpheus/api/network_pool_ips_interface.rb
|
285
286
|
- lib/morpheus/api/network_pool_server_types_interface.rb
|
@@ -313,6 +314,7 @@ files:
|
|
313
314
|
- lib/morpheus/api/provisioning_settings_interface.rb
|
314
315
|
- lib/morpheus/api/read_interface.rb
|
315
316
|
- lib/morpheus/api/reports_interface.rb
|
317
|
+
- lib/morpheus/api/resource_pool_groups_interface.rb
|
316
318
|
- lib/morpheus/api/rest_interface.rb
|
317
319
|
- lib/morpheus/api/roles_interface.rb
|
318
320
|
- lib/morpheus/api/scale_thresholds_interface.rb
|
@@ -455,6 +457,7 @@ files:
|
|
455
457
|
- lib/morpheus/cli/commands/network_domains_command.rb
|
456
458
|
- lib/morpheus/cli/commands/network_edge_clusters_command.rb
|
457
459
|
- lib/morpheus/cli/commands/network_firewalls_command.rb
|
460
|
+
- lib/morpheus/cli/commands/network_floating_ips.rb
|
458
461
|
- lib/morpheus/cli/commands/network_groups_command.rb
|
459
462
|
- lib/morpheus/cli/commands/network_pool_server_types.rb
|
460
463
|
- lib/morpheus/cli/commands/network_pool_servers_command.rb
|
@@ -483,6 +486,7 @@ files:
|
|
483
486
|
- lib/morpheus/cli/commands/recent_activity_command.rb
|
484
487
|
- lib/morpheus/cli/commands/remote.rb
|
485
488
|
- lib/morpheus/cli/commands/reports_command.rb
|
489
|
+
- lib/morpheus/cli/commands/resource_pool_groups_command.rb
|
486
490
|
- lib/morpheus/cli/commands/rm_command.rb
|
487
491
|
- lib/morpheus/cli/commands/roles.rb
|
488
492
|
- lib/morpheus/cli/commands/scale_thresholds.rb
|