morpheus-cli 5.4.1 → 5.4.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/cli/cli_command.rb +1 -1
- data/lib/morpheus/cli/commands/clusters.rb +1 -1
- data/lib/morpheus/cli/commands/image_builder_command.rb +4 -8
- data/lib/morpheus/cli/commands/integrations_command.rb +1 -12
- data/lib/morpheus/cli/commands/load_balancer_monitors.rb +0 -1
- data/lib/morpheus/cli/commands/load_balancer_pools.rb +0 -1
- data/lib/morpheus/cli/commands/load_balancer_profiles.rb +0 -1
- data/lib/morpheus/cli/commands/load_balancer_virtual_servers.rb +2 -11
- data/lib/morpheus/cli/commands/load_balancers.rb +18 -2
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +1 -1
- data/lib/morpheus/cli/mixins/rest_command.rb +3 -1
- data/lib/morpheus/cli/mixins/secondary_rest_command.rb +5 -6
- data/lib/morpheus/cli/option_types.rb +34 -3
- data/lib/morpheus/cli/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d81fbae375d0d103b21c67cbbe12688b7d6977674b275047acf8e5dc9f2e155f
|
4
|
+
data.tar.gz: f926189bc1792af28a86c1652a9b0b4268581d759fff857697e559e862aa09fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5d832fc40ea3d0da75e4acfcd445fb59509b78fee5b87c81fa401237ed6ee8476a8a5de9fa11ce6bf2b1cac28f292bc0c6a5a9ef4345ca3c08a99baf084bee6
|
7
|
+
data.tar.gz: 216b534d057fe67350a816ee00e45a4d9218f21a9a4ebeeadad764a9b12821720658bf56be6b873e63143c58be61064d20c88550cd4a4a88780748499fe2f386
|
data/Dockerfile
CHANGED
@@ -1517,7 +1517,7 @@ module Morpheus
|
|
1517
1517
|
begin
|
1518
1518
|
json_response = interface.get(*ids)
|
1519
1519
|
return json_response[object_key]
|
1520
|
-
rescue
|
1520
|
+
rescue Exception => e
|
1521
1521
|
if e.response && e.response.code == 404
|
1522
1522
|
print_red_alert "#{label} not found by id #{ids.last}"
|
1523
1523
|
return nil
|
@@ -629,7 +629,7 @@ class Morpheus::Cli::Clusters
|
|
629
629
|
|
630
630
|
# Worker count
|
631
631
|
default_node_count = layout['computeServers'] ? (layout['computeServers'].find {|it| it['nodeType'] == 'worker'} || {'nodeCount' => 3})['nodeCount'] : 3
|
632
|
-
server_payload['config']['nodeCount'] = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => "config.nodeCount", 'type' => 'number', 'fieldLabel' => "#{
|
632
|
+
server_payload['config']['nodeCount'] = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => "config.nodeCount", 'type' => 'number', 'fieldLabel' => "#{['docker', 'kvm-cluster'].include?(cluster_type['code']) ? 'Host' : 'Worker'} Count", 'required' => true, 'defaultValue' => default_node_count > 0 ? default_node_count : 3}], options[:options], @api_client, api_params, options[:no_prompt])['config']['nodeCount']
|
633
633
|
|
634
634
|
# Create User
|
635
635
|
if !options[:createUser].nil?
|
@@ -1065,20 +1065,16 @@ class Morpheus::Cli::ImageBuilderCommand
|
|
1065
1065
|
preseed_script_id = nil
|
1066
1066
|
if options['preseedScript']
|
1067
1067
|
preseed_script = find_preseed_script(options['preseedScript'])
|
1068
|
-
if
|
1069
|
-
|
1070
|
-
return false
|
1068
|
+
if preseed_script
|
1069
|
+
preseed_script_id = preseed_script['id']
|
1071
1070
|
end
|
1072
|
-
preseed_script_id = preseed_script['id']
|
1073
1071
|
else
|
1074
1072
|
preseed_script_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'preseedScript', 'type' => 'select', 'fieldLabel' => 'Preseed Script', 'selectOptions' => get_available_preseed_scripts(), 'required' => false, 'description' => 'Select Preseed Script.', 'defaultValue' => default_values['preseedScript'], :fmt=>:natural}],options,api_client,{})
|
1075
1073
|
# preseed_script_id = preseed_script_prompt['preseedScript']
|
1076
1074
|
preseed_script = find_preseed_script(preseed_script_prompt['preseedScript'])
|
1077
|
-
if
|
1078
|
-
|
1079
|
-
return false
|
1075
|
+
if preseed_script
|
1076
|
+
preseed_script_id = preseed_script['id']
|
1080
1077
|
end
|
1081
|
-
preseed_script_id = preseed_script['id']
|
1082
1078
|
end
|
1083
1079
|
if preseed_script_id
|
1084
1080
|
# payload['preseedScript'] = preseed_script_id
|
@@ -1122,19 +1122,8 @@ EOT
|
|
1122
1122
|
|
1123
1123
|
def add_integration_object_option_types
|
1124
1124
|
[
|
1125
|
-
{'code' => 'integrationObject.type', 'shorthand' => '-t', 'switch' => 'type', 'fieldName' => 'type', 'fieldLabel' => 'Type', 'type' => 'select', 'optionSource' => 'integrationObjectTypes', 'required' => true, 'description' => "Integration Object Type eg.
|
1125
|
+
{'code' => 'integrationObject.type', 'shorthand' => '-t', 'switch' => 'type', 'fieldName' => 'type', 'fieldLabel' => 'Type', 'type' => 'select', 'optionSource' => 'integrationObjectTypes', 'required' => true, 'description' => "Integration Object Type eg. catalog", 'displayOrder' => 1},
|
1126
1126
|
# {'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => false, 'description' => 'Display Name of the integration object, default is the name of the referenced object', 'displayOrder' => 2},
|
1127
|
-
{'dependsOnCode' => 'integrationObject.type:cloud', 'switch' => 'group', 'fieldName' => 'group', 'fieldLabel' => 'Group', 'type' => 'select', 'optionSource' => 'groups', 'required' => true, 'description' => 'Group', 'displayOrder' => 3},
|
1128
|
-
{'dependsOnCode' => 'integrationObject.type:cloud', 'switch' => 'cloud', 'fieldName' => 'cloud', 'fieldLabel' => 'Cloud', 'type' => 'select', 'optionSource' => 'clouds', 'required' => true, 'description' => 'Cloud', 'displayOrder' => 4},
|
1129
|
-
{'dependsOnCode' => 'integrationObject.type:layout', 'switch' => 'instance-type', 'fieldName' => 'instanceType', 'fieldLabel' => 'Instance Type', 'type' => 'select', 'optionSource' => 'instanceTypes', 'required' => true, 'description' => 'Instance Type', 'displayOrder' => 5},
|
1130
|
-
{'dependsOnCode' => 'integrationObject.type:layout', 'switch' => 'technology', 'fieldName' => 'zoneType', 'fieldLabel' => 'Cloud Type', 'type' => 'select', 'optionSource' => 'zoneTypes', 'required' => true, 'description' => 'Cloud Type (Technology)', 'displayOrder' => 5},
|
1131
|
-
{'dependsOnCode' => 'integrationObject.type:layout', 'switch' => 'layout', 'fieldName' => 'layout', 'fieldLabel' => 'Layout', 'type' => 'select', 'optionSource' => 'layouts', 'required' => true, 'description' => 'Layout', 'displayOrder' => 6},
|
1132
|
-
{'dependsOnCode' => 'integrationObject.type:blueprint', 'fieldName' => 'name', 'fieldLabel' => 'Catalog Item Name', 'type' => 'text', 'required' => true, 'description' => 'Display Name of the integration object', 'displayOrder' => 7},
|
1133
|
-
{'dependsOnCode' => 'integrationObject.type:blueprint', 'switch' => 'blueprint', 'fieldName' => 'blueprint', 'fieldLabel' => 'Blueprint', 'type' => 'select', 'optionSource' => 'blueprints', 'required' => true, 'description' => 'Blueprint', 'displayOrder' => 8, 'noParams' => true},
|
1134
|
-
{'dependsOnCode' => 'integrationObject.type:blueprint', 'switch' => 'group', 'fieldName' => 'group', 'fieldLabel' => 'Group', 'type' => 'select', 'optionSource' => 'groups', 'required' => true, 'description' => 'Group', 'displayOrder' => 9},
|
1135
|
-
{'dependsOnCode' => 'integrationObject.type:blueprint', 'switch' => 'default-cloud', 'fieldName' => 'defaultCloud', 'fieldLabel' => 'Default Cloud', 'type' => 'select', 'optionSource' => 'clouds', 'required' => false, 'description' => 'Default Cloud', 'displayOrder' => 10},
|
1136
|
-
{'dependsOnCode' => 'integrationObject.type:blueprint', 'switch' => 'environment', 'fieldName' => 'environment', 'fieldLabel' => 'Environment', 'type' => 'select', 'optionSource' => 'environments', 'required' => false, 'description' => 'Environment', 'displayOrder' => 11},
|
1137
|
-
{'dependsOnCode' => 'integrationObject.type:blueprint', 'switch' => 'config', 'fieldName' => 'config', 'fieldLabel' => 'Config', 'type' => 'code-editor', 'required' => true, 'description' => 'Config JSON', 'displayOrder' => 12},
|
1138
1127
|
{'dependsOnCode' => 'integrationObject.type:catalog', 'switch' => 'catalog', 'fieldName' => 'catalog', 'fieldLabel' => 'Catalog Item', 'type' => 'select', 'optionSource' => 'catalogItemTypes', 'required' => true, 'description' => 'Catalog Item', 'displayOrder' => 13},
|
1139
1128
|
]
|
1140
1129
|
end
|
@@ -6,7 +6,6 @@ class Morpheus::Cli::LoadBalancerMonitors
|
|
6
6
|
include Morpheus::Cli::SecondaryRestCommand
|
7
7
|
include Morpheus::Cli::LoadBalancersHelper
|
8
8
|
|
9
|
-
set_command_hidden
|
10
9
|
set_command_description "View and manage load balancer monitors."
|
11
10
|
set_command_name :'load-balancer-monitors'
|
12
11
|
register_subcommands :list, :get, :add, :update, :remove
|
@@ -6,7 +6,6 @@ class Morpheus::Cli::LoadBalancerPools
|
|
6
6
|
include Morpheus::Cli::SecondaryRestCommand
|
7
7
|
include Morpheus::Cli::LoadBalancersHelper
|
8
8
|
|
9
|
-
set_command_hidden
|
10
9
|
set_command_description "View and manage load balancer pools."
|
11
10
|
set_command_name :'load-balancer-pools'
|
12
11
|
register_subcommands :list, :get, :add, :update, :remove
|
@@ -6,7 +6,6 @@ class Morpheus::Cli::LoadBalancerProfiles
|
|
6
6
|
include Morpheus::Cli::SecondaryRestCommand
|
7
7
|
include Morpheus::Cli::LoadBalancersHelper
|
8
8
|
|
9
|
-
set_command_hidden
|
10
9
|
set_command_description "View and manage load balancer profiles."
|
11
10
|
set_command_name :'load-balancer-profiles'
|
12
11
|
register_subcommands :list, :get, :add, :update, :remove
|
@@ -6,11 +6,9 @@ class Morpheus::Cli::LoadBalancerVirtualServers
|
|
6
6
|
include Morpheus::Cli::SecondaryRestCommand
|
7
7
|
include Morpheus::Cli::LoadBalancersHelper
|
8
8
|
|
9
|
-
set_command_hidden
|
10
9
|
set_command_description "View and manage load balancer virtual servers."
|
11
10
|
set_command_name :'load-balancer-virtual-servers'
|
12
11
|
register_subcommands :list, :get, :add, :update, :remove
|
13
|
-
|
14
12
|
register_interfaces :load_balancer_virtual_servers,
|
15
13
|
:load_balancers, :load_balancer_types
|
16
14
|
|
@@ -18,6 +16,7 @@ class Morpheus::Cli::LoadBalancerVirtualServers
|
|
18
16
|
set_rest_arg 'vipName'
|
19
17
|
|
20
18
|
# overridden to provide global list functionality without requiring parent argument
|
19
|
+
=begin
|
21
20
|
def list(args)
|
22
21
|
parent_id, parent_record = nil, nil
|
23
22
|
params = {}
|
@@ -62,17 +61,9 @@ EOT
|
|
62
61
|
end
|
63
62
|
return 0, nil
|
64
63
|
end
|
65
|
-
|
64
|
+
=end
|
66
65
|
protected
|
67
66
|
|
68
|
-
def build_list_options(opts, options, params)
|
69
|
-
opts.on('--load-balancer LB', String, "Load Balancer Name or ID") do |val|
|
70
|
-
options[:load_balancer] = val
|
71
|
-
end
|
72
|
-
# build_standard_list_options(opts, options)
|
73
|
-
super
|
74
|
-
end
|
75
|
-
|
76
67
|
def parse_list_options!(args, options, params)
|
77
68
|
parse_parameter_as_resource_id!(:load_balancer, options, params)
|
78
69
|
super
|
@@ -5,7 +5,6 @@ class Morpheus::Cli::LoadBalancers
|
|
5
5
|
include Morpheus::Cli::RestCommand
|
6
6
|
include Morpheus::Cli::LoadBalancersHelper
|
7
7
|
|
8
|
-
set_command_hidden
|
9
8
|
set_command_description "View and manage load balancers."
|
10
9
|
set_command_name :'load-balancers'
|
11
10
|
register_subcommands :list, :get, :add, :update, :remove, :refresh
|
@@ -93,6 +92,23 @@ EOT
|
|
93
92
|
|
94
93
|
protected
|
95
94
|
|
95
|
+
# filtering for NSX-T only
|
96
|
+
def rest_list_types()
|
97
|
+
rest_type_interface.list({max:10000, creatable:true})[rest_type_list_key].reject {|it| it['code'] == 'nsx-t'}
|
98
|
+
end
|
99
|
+
|
100
|
+
def load_balancer_type_list_to_options(type_list)
|
101
|
+
type_list.reject {|it| it['code'] != 'nsx-t'}.collect {|it| {'name' => it['name'], 'value' => it['code']} }
|
102
|
+
end
|
103
|
+
|
104
|
+
def add_load_balancer_footer_addn
|
105
|
+
"#{bold}Available for NSX-T load balancers only#{reset}"
|
106
|
+
end
|
107
|
+
|
108
|
+
def update_load_balancer_footer_addn
|
109
|
+
"#{bold}Available for NSX-T load balancers only#{reset}"
|
110
|
+
end
|
111
|
+
|
96
112
|
def load_balancer_list_column_definitions(options)
|
97
113
|
{
|
98
114
|
"ID" => 'id',
|
@@ -141,7 +157,7 @@ EOT
|
|
141
157
|
def add_load_balancer_advanced_option_types()
|
142
158
|
[
|
143
159
|
{'fieldName' => 'visibility', 'fieldLabel' => 'Visibility', 'fieldGroup' => 'Advanced', 'type' => 'select', 'selectOptions' => [{'name' => 'Private', 'value' => 'private'},{'name' => 'Public', 'value' => 'public'}], 'required' => false, 'description' => 'Visibility', 'category' => 'permissions', 'defaultValue' => 'public'},
|
144
|
-
{'fieldName' => 'tenants', 'fieldLabel' => 'Tenants', 'fieldGroup' => 'Advanced', 'type' => 'multiSelect', 'optionSource' => lambda { |api_client, api_params|
|
160
|
+
{'fieldName' => 'tenants', 'fieldLabel' => 'Tenants', 'fieldGroup' => 'Advanced', 'type' => 'multiSelect', 'resultValueField' => 'id', 'optionSource' => lambda { |api_client, api_params|
|
145
161
|
api_client.options.options_for_source("allTenants", {})['data']
|
146
162
|
}},
|
147
163
|
]
|
@@ -484,7 +484,7 @@ module Morpheus::Cli::ProvisioningHelper
|
|
484
484
|
if options[:instance_type_code]
|
485
485
|
instance_type_code = options[:instance_type_code]
|
486
486
|
else
|
487
|
-
instance_type_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'type', 'type' => 'select', 'fieldLabel' => 'Type', 'optionSource' => 'instanceTypes', 'required' => true, 'description' => 'Select Instance Type.'}],options[:options],api_client,{groupId: group_id}, no_prompt, true)
|
487
|
+
instance_type_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'type', 'type' => 'select', 'fieldLabel' => 'Type', 'optionSource' => 'instanceTypes', 'required' => true, 'description' => 'Select Instance Type.'}],options[:options],api_client,{groupId: group_id, cloudId: cloud_id, restrictProvisionType:true}, no_prompt, true)
|
488
488
|
instance_type_code = instance_type_prompt['type']
|
489
489
|
end
|
490
490
|
if instance_type_code.to_s =~ /\A\d{1,}\Z/
|
@@ -569,6 +569,7 @@ EOT
|
|
569
569
|
Create a new #{rest_label.downcase}.
|
570
570
|
[#{rest_arg}] is required. This is the name of the new #{rest_label.downcase}.
|
571
571
|
EOT
|
572
|
+
opts.footer += send "add_#{rest_key}_footer_addn" if respond_to?("add_#{rest_key}_footer_addn", true)
|
572
573
|
end
|
573
574
|
optparse.parse!(args)
|
574
575
|
# todo: make supporting args[0] optional and more flexible
|
@@ -588,7 +589,7 @@ EOT
|
|
588
589
|
if record_type_id.nil?
|
589
590
|
#raise_command_error "#{rest_type_label} is required.\n#{optparse}"
|
590
591
|
type_list = rest_type_interface.list({max:10000, creatable:true})[rest_type_list_key]
|
591
|
-
type_dropdown_options = type_list.collect {|it| {'name' => it['name'], 'value' => it['code']} }
|
592
|
+
type_dropdown_options = respond_to?("#{rest_key}_type_list_to_options", true) ? send("#{rest_key}_type_list_to_options", type_list) : type_list.collect {|it| {'name' => it['name'], 'value' => it['code']} }
|
592
593
|
record_type_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'type', 'fieldLabel' => rest_type_label, 'type' => 'select', 'selectOptions' => type_dropdown_options, 'required' => true}], options[:options], @api_client)['type']
|
593
594
|
end
|
594
595
|
record_type = rest_type_find_by_name_or_id(record_type_id)
|
@@ -694,6 +695,7 @@ EOT
|
|
694
695
|
Update an existing #{rest_label.downcase}.
|
695
696
|
[#{rest_arg}] is required. This is the #{rest_has_name ? 'name or id' : 'id'} of #{a_or_an(rest_label)} #{rest_label.downcase}.
|
696
697
|
EOT
|
698
|
+
opts.footer += send "update_#{rest_key}_footer_addn" if respond_to?("update_#{rest_key}_footer_addn", true)
|
697
699
|
end
|
698
700
|
optparse.parse!(args)
|
699
701
|
verify_args!(args:args, optparse:optparse, count:1)
|
@@ -265,7 +265,7 @@ module Morpheus::Cli::SecondaryRestCommand
|
|
265
265
|
options = {}
|
266
266
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
267
267
|
opts.banner = subcommand_usage("[#{rest_parent_arg}] [search]")
|
268
|
-
|
268
|
+
build_list_options(opts, options, params)
|
269
269
|
opts.footer = <<-EOT
|
270
270
|
List #{rest_label_plural.downcase}.
|
271
271
|
[#{rest_parent_arg}] is required. This is the #{rest_parent_has_name ? 'name or id' : 'id'} of #{a_or_an(rest_parent_label)} #{rest_parent_label.downcase}.
|
@@ -513,7 +513,6 @@ EOT
|
|
513
513
|
advanced_option_types = respond_to?("update_#{rest_key}_advanced_option_types", true) ? send("update_#{rest_key}_advanced_option_types") : []
|
514
514
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
515
515
|
opts.banner = subcommand_usage("[#{rest_parent_arg}] [#{rest_arg}] [options]")
|
516
|
-
|
517
516
|
build_standard_update_options(opts, options)
|
518
517
|
opts.footer = <<-EOT
|
519
518
|
Update an existing #{rest_label.downcase}.
|
@@ -562,7 +561,7 @@ EOT
|
|
562
561
|
options[:params]['type'] = record_type['code']
|
563
562
|
end
|
564
563
|
# update options without prompting by default
|
565
|
-
if option_types && !option_types.empty?
|
564
|
+
if false && option_types && !option_types.empty?
|
566
565
|
api_params = (options[:params] || {}).merge(record_payload) # need to merge in values from record too, ughhh
|
567
566
|
v_prompt = Morpheus::Cli::OptionTypes.no_prompt(option_types, options[:options], @api_client, api_params)
|
568
567
|
v_prompt.deep_compact!
|
@@ -576,7 +575,7 @@ EOT
|
|
576
575
|
else
|
577
576
|
my_option_types = record_type ? record_type['optionTypes'] : nil
|
578
577
|
end
|
579
|
-
if my_option_types && !my_option_types.empty?
|
578
|
+
if false && my_option_types && !my_option_types.empty?
|
580
579
|
# remove redundant fieldContext
|
581
580
|
# make them optional for updates
|
582
581
|
# todo: use current value as default instead of just making things optioanl
|
@@ -594,7 +593,7 @@ EOT
|
|
594
593
|
record_payload.deep_merge!(v_prompt)
|
595
594
|
end
|
596
595
|
# advanced options
|
597
|
-
if advanced_option_types && !advanced_option_types.empty?
|
596
|
+
if false && advanced_option_types && !advanced_option_types.empty?
|
598
597
|
v_prompt = Morpheus::Cli::OptionTypes.no_prompt(advanced_option_types, options[:options], @api_client, options[:params])
|
599
598
|
v_prompt.deep_compact!
|
600
599
|
v_prompt.booleanize! # 'on' => true
|
@@ -644,7 +643,7 @@ EOT
|
|
644
643
|
if parent_record.nil?
|
645
644
|
return 1, "#{rest_parent_label} not found for '#{parent_id}"
|
646
645
|
end
|
647
|
-
record = rest_find_by_name_or_id(
|
646
|
+
record = rest_find_by_name_or_id(parent_record['id'], id)
|
648
647
|
if record.nil?
|
649
648
|
return 1, "#{rest_name} not found for '#{id}'"
|
650
649
|
end
|
@@ -281,12 +281,14 @@ module Morpheus
|
|
281
281
|
if option_type['optionSource'].nil?
|
282
282
|
value = option_type['defaultValue']
|
283
283
|
else
|
284
|
-
value = load_source_options(option_type['optionSource'],
|
284
|
+
value = load_source_options(option_type['optionSource'], option_type['optionSourceType'], api_client, api_params || {})
|
285
285
|
end
|
286
286
|
elsif option_type['type'] == 'file'
|
287
287
|
value = file_prompt(option_type)
|
288
288
|
elsif option_type['type'] == 'file-content'
|
289
289
|
value = file_content_prompt(option_type, options, api_client, {})
|
290
|
+
elsif option_type['type'] == 'multiText'
|
291
|
+
value = multitext_prompt(option_type)
|
290
292
|
else
|
291
293
|
value = generic_prompt(option_type)
|
292
294
|
end
|
@@ -294,7 +296,6 @@ module Morpheus
|
|
294
296
|
|
295
297
|
if option_type['type'] == 'multiSelect'
|
296
298
|
value = [value] if !value.nil? && !value.is_a?(Array)
|
297
|
-
# parent_context_map[parent_ns] = value
|
298
299
|
elsif option_type['type'] == 'multiText'
|
299
300
|
# multiText expects csv value
|
300
301
|
if value && value.is_a?(String)
|
@@ -530,6 +531,10 @@ module Morpheus
|
|
530
531
|
if value && !option_type['fieldInput'].nil?
|
531
532
|
value = {option_type['fieldName'].split('.').last => value, option_type['fieldInput'] => (no_prompt ? option_type['defaultInputValue'] : field_input_prompt(option_type))}
|
532
533
|
end
|
534
|
+
|
535
|
+
if value && !option_type['resultValueField'].nil?
|
536
|
+
value = {option_type['resultValueField'] => value}
|
537
|
+
end
|
533
538
|
value
|
534
539
|
end
|
535
540
|
|
@@ -926,6 +931,32 @@ module Morpheus
|
|
926
931
|
return file_params
|
927
932
|
end
|
928
933
|
|
934
|
+
def self.multitext_prompt(option_type)
|
935
|
+
rtn = nil
|
936
|
+
|
937
|
+
# supports multi-part fields via config.fields
|
938
|
+
# {"fields": [{"name":"tag", "required":true, "label": "Tag"}, {"name":"value", "required":false, "label": "Scope"}]}
|
939
|
+
if option_type['config']['fields']
|
940
|
+
while (option_type['required'] && rtn.empty?) || self.confirm("Add#{rtn.empty? ? '': ' more'} #{option_type['fieldLabel']}?", {:default => false})
|
941
|
+
rtn ||= []
|
942
|
+
value = {}
|
943
|
+
option_type['config']['fields'].each do |field|
|
944
|
+
field_label = field['label'] || field['name'].capitalize
|
945
|
+
value[field['name']] = generic_prompt(option_type.merge({'fieldLabel' => field_label, 'required' => field['required'], 'description' => "#{option_type['fieldLabel']} #{field_label}"}))
|
946
|
+
end
|
947
|
+
rtn << value
|
948
|
+
end
|
949
|
+
else
|
950
|
+
if rtn = generic_prompt(option_type)
|
951
|
+
rtn = [rtn]
|
952
|
+
while self.confirm("Add more #{option_type['fieldLabel']}?", {:default => false}) do
|
953
|
+
rtn << generic_prompt(option_type)
|
954
|
+
end
|
955
|
+
end
|
956
|
+
end
|
957
|
+
rtn
|
958
|
+
end
|
959
|
+
|
929
960
|
def self.load_options(option_type, api_client, api_params, query_value=nil)
|
930
961
|
select_options = []
|
931
962
|
# local array of options
|
@@ -945,7 +976,7 @@ module Morpheus
|
|
945
976
|
select_options = filtered_options
|
946
977
|
end
|
947
978
|
elsif option_type['optionSource']
|
948
|
-
api_params = api_params.select {|k,v| option_type['params'].include(k)} if option_type['params'].nil? && api_params
|
979
|
+
api_params = api_params.select {|k,v| option_type['params'].include(k)} if !option_type['params'].nil? && api_params
|
949
980
|
|
950
981
|
# calculate from inline lambda
|
951
982
|
if option_type['optionSource'].is_a?(Proc)
|
data/lib/morpheus/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: morpheus-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.4.
|
4
|
+
version: 5.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Estes
|
8
8
|
- Bob Whiton
|
9
9
|
- Jeremy Michael Crosbie
|
10
10
|
- James Dickson
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2022-01-11 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -524,11 +524,11 @@ files:
|
|
524
524
|
- lib/morpheus/terminal.rb
|
525
525
|
- lib/morpheus/util.rb
|
526
526
|
- morpheus-cli.gemspec
|
527
|
-
homepage:
|
527
|
+
homepage:
|
528
528
|
licenses:
|
529
529
|
- MIT
|
530
530
|
metadata: {}
|
531
|
-
post_install_message:
|
531
|
+
post_install_message:
|
532
532
|
rdoc_options: []
|
533
533
|
require_paths:
|
534
534
|
- lib
|
@@ -543,8 +543,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
543
543
|
- !ruby/object:Gem::Version
|
544
544
|
version: '0'
|
545
545
|
requirements: []
|
546
|
-
|
547
|
-
|
546
|
+
rubyforge_project:
|
547
|
+
rubygems_version: 2.7.6
|
548
|
+
signing_key:
|
548
549
|
specification_version: 4
|
549
550
|
summary: Provides CLI Interface to the Morpheus Public/Private Cloud Appliance
|
550
551
|
test_files: []
|