morpheus-cli 8.0.12.1 → 8.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Dockerfile +1 -1
- data/lib/morpheus/cli/commands/catalog_item_types_command.rb +8 -12
- data/lib/morpheus/cli/commands/clouds.rb +2 -2
- data/lib/morpheus/cli/commands/clusters.rb +20 -16
- data/lib/morpheus/cli/option_types.rb +2 -2
- data/lib/morpheus/cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aad3ce7f814765f24cd6d8c0c54c234d6c745be616536a92b3005e127740f2d0
|
|
4
|
+
data.tar.gz: af0212f0f02ee8f85133c36790493e09542112e9e21ee183692cce150a029e29
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 648640393d42c0a3dc358a198baf5c513cbf48e8c58202143974f7bbd15e2acc06f7cd3c35305a6404ddabb9ed0ee64c16c4beb84bbda588d7c03df4debca69d
|
|
7
|
+
data.tar.gz: 4a1b6e530ebcb825f2c1bc54e04ea29ad0ec249f1b3ddc65d1bfce2144db1f17c1389d2368ee9f4dbb4398f5be911b1509f418f6ee9a28c8c42bd1e4e95b3cc2
|
data/Dockerfile
CHANGED
|
@@ -316,9 +316,8 @@ EOT
|
|
|
316
316
|
parse_result = parse_json_or_yaml(file_content)
|
|
317
317
|
config_map = parse_result[:data]
|
|
318
318
|
if config_map.nil?
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
#raise_command_error "Failed to parse config as valid YAML or JSON."
|
|
319
|
+
params['config'] = file_content
|
|
320
|
+
Morpheus::Logging::DarkPrinter.puts "Failed to parse config as JSON or YAML. Defaulting to String."
|
|
322
321
|
else
|
|
323
322
|
params['config'] = config_map
|
|
324
323
|
options[:options]['config'] = params['config'] # or file_content
|
|
@@ -386,9 +385,8 @@ EOT
|
|
|
386
385
|
parse_result = parse_json_or_yaml(config)
|
|
387
386
|
config_map = parse_result[:data]
|
|
388
387
|
if config_map.nil?
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
#raise_command_error "Failed to parse config as valid YAML or JSON."
|
|
388
|
+
params['config'] = config
|
|
389
|
+
Morpheus::Logging::DarkPrinter.puts "Failed to parse config as JSON or YAML. Defaulting to String."
|
|
392
390
|
else
|
|
393
391
|
params['config'] = config_map
|
|
394
392
|
end
|
|
@@ -466,9 +464,8 @@ EOT
|
|
|
466
464
|
parse_result = parse_json_or_yaml(file_content)
|
|
467
465
|
config_map = parse_result[:data]
|
|
468
466
|
if config_map.nil?
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
#raise_command_error "Failed to parse config as valid YAML or JSON."
|
|
467
|
+
params['config'] = file_content
|
|
468
|
+
Morpheus::Logging::DarkPrinter.puts "Failed to parse config as JSON or YAML. Defaulting to String."
|
|
472
469
|
else
|
|
473
470
|
params['config'] = config_map
|
|
474
471
|
options[:options]['config'] = params['config'] # or file_content
|
|
@@ -529,9 +526,8 @@ EOT
|
|
|
529
526
|
parse_result = parse_json_or_yaml(config)
|
|
530
527
|
config_map = parse_result[:data]
|
|
531
528
|
if config_map.nil?
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
#raise_command_error "Failed to parse config as valid YAML or JSON."
|
|
529
|
+
params['config'] = config
|
|
530
|
+
Morpheus::Logging::DarkPrinter.puts "Failed to parse config as JSON or YAML. Defaulting to String."
|
|
535
531
|
else
|
|
536
532
|
params['config'] = config_map
|
|
537
533
|
end
|
|
@@ -1599,14 +1599,14 @@ EOT
|
|
|
1599
1599
|
{'fieldName' => 'affinityType', 'fieldLabel' => 'Type', 'type' => 'select', 'selectOptions' => [{'name' => 'Keep Separate', 'value' => 'KEEP_SEPARATE'}, {'name' => 'Keep Together', 'value' => 'KEEP_TOGETHER'}], 'description' => 'Choose affinity type.', 'required' => true, 'defaultValue' => 'KEEP_SEPARATE'},
|
|
1600
1600
|
{'fieldName' => 'active', 'fieldLabel' => 'Active', 'type' => 'checkbox', 'defaultValue' => true},
|
|
1601
1601
|
{'fieldName' => 'pool.id', 'fieldLabel' => 'Cluster', 'type' => 'select', 'optionSourceType' => 'vmware', 'optionSource' => 'vmwareZonePoolClusters', 'description' => 'Select cluster for the affinity group.', 'required' => true},
|
|
1602
|
-
{'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'description' => 'Select servers to be in the affinity group.'},
|
|
1602
|
+
{'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'searchParameter' => 'phrase', 'description' => 'Select servers to be in the affinity group.'},
|
|
1603
1603
|
]
|
|
1604
1604
|
end
|
|
1605
1605
|
|
|
1606
1606
|
def update_cloud_affinity_group_option_types
|
|
1607
1607
|
[
|
|
1608
1608
|
{'fieldName' => 'active', 'fieldLabel' => 'Active', 'type' => 'checkbox'},
|
|
1609
|
-
{'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'description' => 'Select servers to be in the affinity group.'},
|
|
1609
|
+
{'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'searchParameter' => 'phrase', 'description' => 'Select servers to be in the affinity group.'},
|
|
1610
1610
|
]
|
|
1611
1611
|
end
|
|
1612
1612
|
|
|
@@ -499,7 +499,7 @@ class Morpheus::Cli::Clusters
|
|
|
499
499
|
|
|
500
500
|
# Group / Site
|
|
501
501
|
group = load_group(cluster_type['code'], options)
|
|
502
|
-
cluster_payload['group'] = {'id' => group['id']}
|
|
502
|
+
cluster_payload['group'] = {'id' => group['id']} if group
|
|
503
503
|
|
|
504
504
|
# Cluster Name
|
|
505
505
|
if args.empty? && options[:no_prompt]
|
|
@@ -561,19 +561,19 @@ class Morpheus::Cli::Clusters
|
|
|
561
561
|
|
|
562
562
|
# Cloud / Zone
|
|
563
563
|
cloud_id = nil
|
|
564
|
-
cloud = options[:cloud] ? find_cloud_by_name_or_id_for_provisioning(group['id'], options[:cloud]) : nil
|
|
564
|
+
cloud = options[:cloud] ? find_cloud_by_name_or_id_for_provisioning(group ? group['id'] : nil, options[:cloud]) : nil
|
|
565
565
|
if cloud
|
|
566
566
|
# load full cloud
|
|
567
567
|
cloud = @clouds_interface.get(cloud['id'])['zone']
|
|
568
568
|
cloud_id = cloud['id']
|
|
569
569
|
else
|
|
570
|
-
available_clouds = get_available_clouds(group['id'], {groupType: cluster_payload['type']})
|
|
570
|
+
available_clouds = get_available_clouds(group ? group['id'] : nil, {groupType: cluster_payload['type']})
|
|
571
571
|
|
|
572
572
|
if available_clouds.empty?
|
|
573
|
-
print_red_alert "Group #{group['name']} has no available clouds"
|
|
573
|
+
print_red_alert group ? "Group #{group['name']} has no available clouds" : "No available clouds"
|
|
574
574
|
exit 1
|
|
575
575
|
else
|
|
576
|
-
cloud_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'cloud', 'type' => 'select', 'fieldLabel' => 'Cloud', 'selectOptions' => available_clouds, 'required' => true, 'description' => 'Select Cloud.'}],options[:options],@api_client,{groupId: group['id']})['cloud']
|
|
576
|
+
cloud_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'cloud', 'type' => 'select', 'fieldLabel' => 'Cloud', 'selectOptions' => available_clouds, 'required' => true, 'description' => 'Select Cloud.'}],options[:options],@api_client,{groupId: group ? group['id'] : nil})['cloud']
|
|
577
577
|
end
|
|
578
578
|
cloud = @clouds_interface.get(cloud_id)['zone']
|
|
579
579
|
end
|
|
@@ -598,7 +598,7 @@ class Morpheus::Cli::Clusters
|
|
|
598
598
|
# Provision Type
|
|
599
599
|
provision_type = (layout && layout['provisionType'] ? layout['provisionType'] : nil) || get_provision_type_for_zone_type(cloud['zoneType']['id'])
|
|
600
600
|
provision_type = @provision_types_interface.get(provision_type['id'])['provisionType'] if !provision_type.nil?
|
|
601
|
-
api_params = {zoneId: cloud['id'], siteId: group['id'], layoutId: layout['id'], groupTypeId: cluster_type['id'], provisionType: provision_type['code'], provisionTypeId: provision_type['id']}
|
|
601
|
+
api_params = {zoneId: cloud['id'], siteId: group ? group['id'] : nil, layoutId: layout['id'], groupTypeId: cluster_type['id'], provisionType: provision_type['code'], provisionTypeId: provision_type['id']}.compact
|
|
602
602
|
|
|
603
603
|
# Service Plan
|
|
604
604
|
service_plan = prompt_service_plan(api_params, options)
|
|
@@ -809,7 +809,7 @@ class Morpheus::Cli::Clusters
|
|
|
809
809
|
elsif server_payload['sshHosts'].is_a?(Array)
|
|
810
810
|
server_payload['sshHosts'] = server_payload['sshHosts'].collect {|it| it.is_a?(String) ? {"ip" => it} : it }
|
|
811
811
|
end
|
|
812
|
-
|
|
812
|
+
server_payload['sshHosts'] = server_payload['sshHosts'].flatten
|
|
813
813
|
# inject the optionalNames array into the sshHosts if present
|
|
814
814
|
if server_payload['optionalNames']
|
|
815
815
|
optional_names = server_payload['optionalNames'].is_a?(String) ? server_payload['optionalNames'].split(",") : [server_payload['optionalNames']].flatten
|
|
@@ -1344,7 +1344,7 @@ class Morpheus::Cli::Clusters
|
|
|
1344
1344
|
server_payload['labels'] = labels if labels
|
|
1345
1345
|
|
|
1346
1346
|
# Cloud
|
|
1347
|
-
available_clouds = options_interface.options_for_source('clouds', {groupId: cluster['site']['id'], clusterId: cluster['id'], ownerOnly: true})['data']
|
|
1347
|
+
available_clouds = options_interface.options_for_source('clouds', {groupId: cluster['site'] ? cluster['site']['id'] : nil, clusterId: cluster['id'], ownerOnly: true}.compact)['data']
|
|
1348
1348
|
cloud_id = nil
|
|
1349
1349
|
|
|
1350
1350
|
if options[:cloud]
|
|
@@ -1366,12 +1366,12 @@ class Morpheus::Cli::Clusters
|
|
|
1366
1366
|
# resources (zone pools)
|
|
1367
1367
|
cloud = @clouds_interface.get(cloud_id)['zone']
|
|
1368
1368
|
cloud['zoneType'] = get_cloud_type(cloud['zoneType']['id'])
|
|
1369
|
-
group = @groups_interface.get(cluster['site']['id'])['group']
|
|
1369
|
+
group = cluster['site'] ? @groups_interface.get(cluster['site']['id'])['group'] : nil
|
|
1370
1370
|
provision_type = server_type['provisionType'] || {}
|
|
1371
1371
|
provision_type = @provision_types_interface.get(provision_type['id'])['provisionType'] if !provision_type.nil?
|
|
1372
1372
|
|
|
1373
1373
|
server_payload['cloud'] = {'id' => cloud_id}
|
|
1374
|
-
service_plan = prompt_service_plan({zoneId: cloud_id, siteId:
|
|
1374
|
+
service_plan = prompt_service_plan({zoneId: cloud_id, siteId: group ? group['id'] : nil, provisionTypeId: server_type['provisionType']['id'], groupTypeId: cluster_type['id']}.compact, options)
|
|
1375
1375
|
|
|
1376
1376
|
if service_plan
|
|
1377
1377
|
server_payload['plan'] = {'code' => service_plan['code']}
|
|
@@ -1420,7 +1420,7 @@ class Morpheus::Cli::Clusters
|
|
|
1420
1420
|
metadata_option_type = cluster_type['optionTypes'].find {|type| type['fieldName'] == 'metadata' }
|
|
1421
1421
|
option_type_list = option_type_list.reject {|type| type['fieldName'] == 'metadata' }
|
|
1422
1422
|
|
|
1423
|
-
server_payload.deep_merge!(Morpheus::Cli::OptionTypes.prompt(option_type_list, options[:options], @api_client, {zoneId: cloud['id'], siteId: group['id'], layoutId: layout['id']}))
|
|
1423
|
+
server_payload.deep_merge!(Morpheus::Cli::OptionTypes.prompt(option_type_list, options[:options], @api_client, {zoneId: cloud['id'], siteId: group ? group['id'] : nil, layoutId: layout['id']}.compact))
|
|
1424
1424
|
|
|
1425
1425
|
# Metadata Tags
|
|
1426
1426
|
if metadata_option_type
|
|
@@ -4751,11 +4751,15 @@ class Morpheus::Cli::Clusters
|
|
|
4751
4751
|
print_red_alert "No available groups"
|
|
4752
4752
|
exit 1
|
|
4753
4753
|
else available_groups.count > 1 && !options[:no_prompt]
|
|
4754
|
-
group_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'group', 'type' => 'select', 'fieldLabel' => 'Group', 'selectOptions' => available_groups, 'required' =>
|
|
4754
|
+
group_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'group', 'type' => 'select', 'fieldLabel' => 'Group', 'selectOptions' => available_groups, 'required' => false, 'description' => 'Select Group.'}],options[:options],@api_client,{})['group']
|
|
4755
4755
|
end
|
|
4756
4756
|
end
|
|
4757
4757
|
end
|
|
4758
|
-
|
|
4758
|
+
if group_id
|
|
4759
|
+
return @groups_interface.get(group_id)['group']
|
|
4760
|
+
else
|
|
4761
|
+
return nil
|
|
4762
|
+
end
|
|
4759
4763
|
end
|
|
4760
4764
|
|
|
4761
4765
|
def prompt_service_plan(api_params, options)
|
|
@@ -4948,7 +4952,7 @@ class Morpheus::Cli::Clusters
|
|
|
4948
4952
|
resource_pool = options[:resourcePool] ? find_cloud_resource_pool_by_name_or_id(cloud['id'], options[:resourcePool]) : nil
|
|
4949
4953
|
|
|
4950
4954
|
if !resource_pool
|
|
4951
|
-
resource_pool_options = @options_interface.options_for_source('zonePools', {groupId: group['id'], zoneId: cloud['id']
|
|
4955
|
+
resource_pool_options = @options_interface.options_for_source('zonePools', {groupId: group ? group['id'] : nil, zoneId: cloud['id'], planId: service_plan ? service_plan['id'] : nil}).compact['data'].reject { |it| it['id'].nil? && it['name'].nil? }
|
|
4952
4956
|
|
|
4953
4957
|
if resource_pool_options.empty?
|
|
4954
4958
|
print yellow,bold, "Cloud #{cloud['name']} has no available resource pools",reset,"\n\n"
|
|
@@ -5268,14 +5272,14 @@ class Morpheus::Cli::Clusters
|
|
|
5268
5272
|
{'fieldName' => 'affinityType', 'fieldLabel' => 'Type', 'type' => 'select', 'selectOptions' => [{'name' => 'Keep Separate', 'value' => 'KEEP_SEPARATE'}, {'name' => 'Keep Together', 'value' => 'KEEP_TOGETHER'}], 'description' => 'Choose affinity type.', 'required' => true, 'defaultValue' => 'KEEP_SEPARATE'},
|
|
5269
5273
|
{'fieldName' => 'active', 'fieldLabel' => 'Active', 'type' => 'checkbox', 'defaultValue' => true},
|
|
5270
5274
|
# {'fieldName' => 'pool.id', 'fieldLabel' => 'Cluster', 'type' => 'select', 'optionSourceType' => 'vmware', 'optionSource' => 'vmwareZonePoolClusters', 'description' => 'Select cluster for the affinity group.', 'required' => true},
|
|
5271
|
-
{'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'description' => 'Select servers to be in the affinity group.'},
|
|
5275
|
+
{'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'searchParameter' => 'phrase', 'description' => 'Select servers to be in the affinity group.'},
|
|
5272
5276
|
]
|
|
5273
5277
|
end
|
|
5274
5278
|
|
|
5275
5279
|
def update_affinity_group_option_types
|
|
5276
5280
|
[
|
|
5277
5281
|
{'fieldName' => 'active', 'fieldLabel' => 'Active', 'type' => 'checkbox'},
|
|
5278
|
-
{'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'description' => 'Select servers to be in the affinity group.'},
|
|
5282
|
+
{'fieldName' => 'servers', 'fieldLabel' => 'Server', 'type' => 'multiTypeahead', 'optionSource' => 'searchServers', 'searchParameter' => 'phrase', 'description' => 'Select servers to be in the affinity group.'},
|
|
5279
5283
|
]
|
|
5280
5284
|
end
|
|
5281
5285
|
|
|
@@ -978,8 +978,8 @@ module Morpheus
|
|
|
978
978
|
# query_value = (value || use_value || default_value || '')
|
|
979
979
|
query_value = (input || '')
|
|
980
980
|
api_params ||= {}
|
|
981
|
-
|
|
982
|
-
api_params[
|
|
981
|
+
search_parameter = option_type['searchParameter'] || 'query'
|
|
982
|
+
api_params[search_parameter] = query_value
|
|
983
983
|
# skip refresh if you just hit enter
|
|
984
984
|
if !query_value.empty? || (select_options.nil? || select_options.empty?)
|
|
985
985
|
select_options = load_options(option_type, api_client, api_params, query_value)
|
data/lib/morpheus/cli/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: morpheus-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.0.
|
|
4
|
+
version: 8.0.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Estes
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date:
|
|
14
|
+
date: 2026-01-27 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: tins
|