morpheus-cli 8.0.10.1 → 8.0.11.1
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/hosts.rb +1 -1
- data/lib/morpheus/cli/commands/shell.rb +10 -7
- data/lib/morpheus/cli/commands/storage_providers_command.rb +49 -4
- data/lib/morpheus/cli/credentials.rb +2 -0
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +38 -4
- data/lib/morpheus/cli/option_types.rb +11 -2
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/terminal.rb +0 -24
- 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: 0e612ece8267586e1ede25aaa18364ba1a6debc9d98a92201dff496038363a27
|
|
4
|
+
data.tar.gz: e4f789f8b3b17a37d460de0833f65a3fa2f7599879a6162c617683eee9894163
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75e8de5e4f8d83b2a37aed735e036b156d36eddf7eeba60b3bea20bc4b2e3e371222854dba2b0fd27a2aacef625ddddf7d6dfb8e486a700fc8e67cc1434c95fd
|
|
7
|
+
data.tar.gz: 35c2a244ae0acb3d6187277b9650277dfe5c85349f7788ff8dc37c7bf341dfd4773e540c1ca68fabc5e726fa8aefec9eac42c7df6b7e11222561e84444784c84
|
data/Dockerfile
CHANGED
|
@@ -2556,7 +2556,7 @@ EOT
|
|
|
2556
2556
|
# prompt
|
|
2557
2557
|
# Host (preferredParentServer.id)
|
|
2558
2558
|
if payload['server']['host']
|
|
2559
|
-
options[:options] = payload['server'].
|
|
2559
|
+
options[:options] = payload['server'].delete('host')
|
|
2560
2560
|
end
|
|
2561
2561
|
default_host = (server['preferredParentServer'] ? server['preferredParentServer']['id'] : (server['parentServer'] ? server['parentServer']['id'] : nil))
|
|
2562
2562
|
host = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'host', 'type' => 'select', 'fieldLabel' => 'Host', 'optionSource' => 'parentServers', 'required' => false, 'description' => 'Choose the preferred parent host for this virtual machine to be placed on.', 'defaultValue' => default_host}],options[:options],@api_client,{'serverId' => server['id']})['host']
|
|
@@ -99,13 +99,15 @@ class Morpheus::Cli::Shell
|
|
|
99
99
|
end
|
|
100
100
|
@auto_complete_commands = (@exploded_commands + @shell_commands + @alias_commands).collect {|it| it.to_s }
|
|
101
101
|
@auto_complete = proc do |s|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
results = @auto_complete_commands.grep(/^#{Regexp.escape(s)}/)
|
|
103
|
+
# do not append space unless there is only one match
|
|
104
|
+
# note: this does not work in newer rubies for some reason (>= 3.3.7)
|
|
105
|
+
if results.size == 1
|
|
106
|
+
Readline.completion_append_character = " "
|
|
106
107
|
else
|
|
107
|
-
|
|
108
|
+
Readline.completion_append_character = ""
|
|
108
109
|
end
|
|
110
|
+
results
|
|
109
111
|
end
|
|
110
112
|
end
|
|
111
113
|
|
|
@@ -284,9 +286,10 @@ class Morpheus::Cli::Shell
|
|
|
284
286
|
while !@exit_now_please do
|
|
285
287
|
#Readline.input = my_terminal.stdin
|
|
286
288
|
#Readline.input = $stdin
|
|
287
|
-
Readline.completion_append_character = "
|
|
289
|
+
Readline.completion_append_character = ""
|
|
288
290
|
Readline.completion_proc = @auto_complete
|
|
289
|
-
Readline.basic_word_break_characters = ""
|
|
291
|
+
Readline.basic_word_break_characters = "" rescue nil
|
|
292
|
+
Readline.completer_word_break_characters = "" rescue nil
|
|
290
293
|
#Readline.basic_word_break_characters = "\t\n\"\‘`@$><=;|&{( "
|
|
291
294
|
input = Readline.readline(@calculated_prompt, true).to_s
|
|
292
295
|
input = input.strip
|
|
@@ -27,6 +27,7 @@ class Morpheus::Cli::StorageProvidersCommand
|
|
|
27
27
|
def connect(opts)
|
|
28
28
|
@api_client = establish_remote_appliance_connection(opts)
|
|
29
29
|
@storage_providers_interface = @api_client.storage_providers
|
|
30
|
+
@storage_servers_interface = @api_client.storage_servers
|
|
30
31
|
@clouds_interface = @api_client.clouds
|
|
31
32
|
@options_interface = @api_client.options
|
|
32
33
|
end
|
|
@@ -215,10 +216,44 @@ class Morpheus::Cli::StorageProvidersCommand
|
|
|
215
216
|
elsif options['providerType']
|
|
216
217
|
storage_provider_type_code = options['providerType'].to_s
|
|
217
218
|
else
|
|
218
|
-
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'providerType',
|
|
219
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'providerType',
|
|
220
|
+
'fieldLabel' => 'Provider Type',
|
|
221
|
+
'type' => 'select',
|
|
222
|
+
'selectOptions' => get_storage_provider_types(),
|
|
223
|
+
'required' => true,
|
|
224
|
+
'description' => 'Choose a storage bucket type.'}],
|
|
225
|
+
options, @api_client, {})
|
|
219
226
|
storage_provider_type_code = v_prompt['providerType'] unless v_prompt['providerType'].nil?
|
|
220
227
|
end
|
|
221
|
-
|
|
228
|
+
if storage_provider_type_code == 'amazonS3'
|
|
229
|
+
payload['storageBucket']['providerType'] = 's3' # cloud provided amazonS3
|
|
230
|
+
else
|
|
231
|
+
payload['storageBucket']['providerType'] = storage_provider_type_code
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
# Storage Service (only for amazonS3)
|
|
235
|
+
storage_server_type_id = nil
|
|
236
|
+
storage_server_id = nil
|
|
237
|
+
if storage_provider_type_code == 'amazonS3'
|
|
238
|
+
storage_server_type = @api_client.storage_server_types.list({max:1000})['storageServerTypes'].find {|it| it['code'].downcase == storage_provider_type_code.downcase }
|
|
239
|
+
if options['storageServer']
|
|
240
|
+
storage_server_id = options['storageServer']
|
|
241
|
+
else
|
|
242
|
+
if storage_server_type.nil?
|
|
243
|
+
raise_command_error "error: no storage server type found for amazonS3"
|
|
244
|
+
end
|
|
245
|
+
Morpheus::Logging::DarkPrinter.puts "Finding storage services..." if Morpheus::Logging.debug?
|
|
246
|
+
storage_server_options = @storage_servers_interface.list({max:1000, 'typeId': storage_server_type['id']})['storageServers'].collect {|it| {'name' => it['name'], 'value' => it['id'] } }
|
|
247
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'storageServer',
|
|
248
|
+
'fieldLabel' => 'Storage Server',
|
|
249
|
+
'type' => 'select',
|
|
250
|
+
'selectOptions' => storage_server_options,
|
|
251
|
+
'required' => true,
|
|
252
|
+
'description' => 'Choose a connected storage service.'}], options, @api_client, {})
|
|
253
|
+
storage_server_id = v_prompt['storageServer'] unless v_prompt['storageServer'].nil?
|
|
254
|
+
end
|
|
255
|
+
payload['storageBucket']['storageServer'] = storage_server_id.to_s # api before 8.0.11 expects a string instead of a number, oooof
|
|
256
|
+
end
|
|
222
257
|
|
|
223
258
|
# Provider Type Specific Options
|
|
224
259
|
provider_type_option_types = nil
|
|
@@ -232,6 +267,15 @@ class Morpheus::Cli::StorageProvidersCommand
|
|
|
232
267
|
{'fieldContext' => 'config', 'fieldName' => 'region', 'fieldLabel' => 'Region', 'type' => 'text', 'required' => false, 'description' => 'Optional Amazon region if creating a new bucket.'},
|
|
233
268
|
{'fieldContext' => 'config', 'fieldName' => 'endpoint', 'fieldLabel' => 'Endpoint URL', 'type' => 'text', 'required' => false, 'description' => 'Optional endpoint URL if pointing to an object store other than amazon that mimics the Amazon S3 APIs.'}
|
|
234
269
|
]
|
|
270
|
+
elsif storage_provider_type_code == 'amazonS3'
|
|
271
|
+
# print_h2 "Amazon S3 Provided by Cloud Options"
|
|
272
|
+
provider_type_option_types = [
|
|
273
|
+
{'fieldName' => 'bucketName', 'fieldLabel' => 'Bucket Name', 'type' => 'text', 'required' => true, 'description' => ''},
|
|
274
|
+
{'fieldName' => 'createBucket', 'fieldLabel' => 'Create Bucket', 'type' => 'checkbox', 'required' => false, 'defaultValue' => false, 'description' => 'Create the bucket if it does not exist.'},
|
|
275
|
+
{'fieldContext' => 'config', 'fieldName' => 'region', 'fieldLabel' => 'Region', 'type' => 'text', 'required' => false, 'description' => 'Optional Amazon region if creating a new bucket.'},
|
|
276
|
+
{'fieldContext' => 'config', 'fieldName' => 'endpoint', 'fieldLabel' => 'Endpoint URL', 'type' => 'text', 'required' => false, 'description' => 'Optional endpoint URL if pointing to an object store other than amazon that mimics the Amazon S3 APIs.'}
|
|
277
|
+
]
|
|
278
|
+
|
|
235
279
|
elsif storage_provider_type_code == 'azure'
|
|
236
280
|
# print_h2 "Azure Options"
|
|
237
281
|
provider_type_option_types = [
|
|
@@ -1215,14 +1259,15 @@ class Morpheus::Cli::StorageProvidersCommand
|
|
|
1215
1259
|
|
|
1216
1260
|
def get_storage_provider_types()
|
|
1217
1261
|
[
|
|
1218
|
-
{'name' => 'Amazon S3', 'value' => '
|
|
1262
|
+
{'name' => 'Amazon S3', 'value' => 'amazonS3'},
|
|
1219
1263
|
{'name' => 'Alibaba', 'value' => 'alibaba'},
|
|
1220
1264
|
{'name' => 'Azure', 'value' => 'azure'},
|
|
1221
1265
|
{'name' => 'CIFS', 'value' => 'cifs'},
|
|
1222
1266
|
{'name' => 'Local Storage', 'value' => 'local'},
|
|
1223
1267
|
{'name' => 'NFSv3', 'value' => 'nfs'},
|
|
1224
1268
|
{'name' => 'Openstack Swift', 'value' => 'openstack'},
|
|
1225
|
-
{'name' => 'Rackspace CDN', 'value' => 'rackspace'}
|
|
1269
|
+
{'name' => 'Rackspace CDN', 'value' => 'rackspace'},
|
|
1270
|
+
{'name' => 'S3', 'value' => 's3'},
|
|
1226
1271
|
]
|
|
1227
1272
|
end
|
|
1228
1273
|
|
|
@@ -116,6 +116,7 @@ module Morpheus
|
|
|
116
116
|
# username = $stdin.gets.chomp!
|
|
117
117
|
Readline.completion_append_character = ""
|
|
118
118
|
Readline.basic_word_break_characters = ''
|
|
119
|
+
Readline.completer_word_break_characters = '' rescue nil
|
|
119
120
|
Readline.completion_proc = nil
|
|
120
121
|
username = Readline.readline("Username: #{required_blue_prompt} ", false).to_s.chomp
|
|
121
122
|
else
|
|
@@ -133,6 +134,7 @@ module Morpheus
|
|
|
133
134
|
|
|
134
135
|
Readline.completion_append_character = ""
|
|
135
136
|
Readline.basic_word_break_characters = ''
|
|
137
|
+
Readline.completer_word_break_characters = '' rescue nil
|
|
136
138
|
Readline.completion_proc = nil
|
|
137
139
|
# needs to work like $stdin.noecho
|
|
138
140
|
Readline.pre_input_hook = lambda {
|
|
@@ -1117,6 +1117,10 @@ module Morpheus::Cli::ProvisioningHelper
|
|
|
1117
1117
|
datastore_options << {"id" => it["value"] || it["id"], "name" => it["name"], "value" => it["value"] || it["id"]}
|
|
1118
1118
|
end
|
|
1119
1119
|
end
|
|
1120
|
+
storage_profiles = []
|
|
1121
|
+
if provision_type['storageProfiles']
|
|
1122
|
+
storage_profiles = provision_type['storageProfiles'].sort {|x,y| x['displayOrder'] <=> y['displayOrder'] }.collect {|it| {'name' => it['name'], 'value' => it['code'], 'isDefault' => it['isDefault']} }
|
|
1123
|
+
end
|
|
1120
1124
|
|
|
1121
1125
|
#puts "Configure Root Volume"
|
|
1122
1126
|
|
|
@@ -1193,6 +1197,10 @@ module Morpheus::Cli::ProvisioningHelper
|
|
|
1193
1197
|
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'datastoreId', 'type' => 'select', 'fieldLabel' => 'Root Datastore', 'selectOptions' => datastore_options, 'required' => true, 'description' => 'Choose a datastore.', 'defaultValue' => default_datastore ? default_datastore['name'] : volume['datastoreId']}], options[:options])
|
|
1194
1198
|
volume['datastoreId'] = v_prompt[field_context]['datastoreId']
|
|
1195
1199
|
end
|
|
1200
|
+
if !storage_profiles.empty?
|
|
1201
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'storageProfile', 'type' => 'select', 'fieldLabel' => 'Root Storage Profile', 'selectOptions' => storage_profiles, 'required' => false, 'description' => 'Choose a storage profile.'}], options[:options])
|
|
1202
|
+
volume['storageProfile'] = v_prompt[field_context]['storageProfile'] if v_prompt[field_context] && !v_prompt[field_context]['storageProfile'].to_s.empty?
|
|
1203
|
+
end
|
|
1196
1204
|
|
|
1197
1205
|
volumes << volume
|
|
1198
1206
|
|
|
@@ -1263,7 +1271,11 @@ module Morpheus::Cli::ProvisioningHelper
|
|
|
1263
1271
|
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'datastoreId', 'type' => 'select', 'fieldLabel' => "Disk #{volume_index} Datastore", 'selectOptions' => datastore_options, 'required' => true, 'description' => 'Choose a datastore.', 'defaultValue' => volume['datastoreId']}], options[:options])
|
|
1264
1272
|
volume['datastoreId'] = v_prompt[field_context]['datastoreId']
|
|
1265
1273
|
end
|
|
1266
|
-
|
|
1274
|
+
if !storage_profiles.empty?
|
|
1275
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'storageProfile', 'type' => 'select', 'fieldLabel' => "Disk #{volume_index} Storage Profile", 'selectOptions' => storage_profiles, 'required' => false, 'description' => 'Choose a storage profile.'}], options[:options])
|
|
1276
|
+
volume['storageProfile'] = v_prompt[field_context]['storageProfile'] if v_prompt[field_context] && !v_prompt[field_context]['storageProfile'].to_s.empty?
|
|
1277
|
+
end
|
|
1278
|
+
|
|
1267
1279
|
volumes << volume
|
|
1268
1280
|
|
|
1269
1281
|
volume_index += 1
|
|
@@ -1347,7 +1359,10 @@ module Morpheus::Cli::ProvisioningHelper
|
|
|
1347
1359
|
end
|
|
1348
1360
|
end
|
|
1349
1361
|
end
|
|
1350
|
-
|
|
1362
|
+
storage_profiles = []
|
|
1363
|
+
if provision_type['storageProfiles']
|
|
1364
|
+
storage_profiles = provision_type['storageProfiles'].sort {|x,y| x['displayOrder'] <=> y['displayOrder'] }.collect {|it| {'name' => it['name'], 'value' => it['code'], 'isDefault' => it['isDefault']} }
|
|
1365
|
+
end
|
|
1351
1366
|
#puts "Configure Root Volume"
|
|
1352
1367
|
|
|
1353
1368
|
field_context = "rootVolume"
|
|
@@ -1385,6 +1400,9 @@ module Morpheus::Cli::ProvisioningHelper
|
|
|
1385
1400
|
if !current_root_volume['controllerMountPoint'].to_s.empty?
|
|
1386
1401
|
volume['controllerMountPoint'] = current_root_volume['controllerMountPoint']
|
|
1387
1402
|
end
|
|
1403
|
+
if !current_root_volume['storageProfile'].to_s.empty?
|
|
1404
|
+
volume['storageProfile'] = current_root_volume['storageProfile']
|
|
1405
|
+
end
|
|
1388
1406
|
if plan_info['rootDiskCustomizable'] && storage_type && storage_type['customLabel']
|
|
1389
1407
|
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'name', 'type' => 'text', 'fieldLabel' => 'Root Volume Label', 'required' => true, 'description' => 'Enter a volume label.', 'defaultValue' => volume['name']}], options[:options])
|
|
1390
1408
|
volume['name'] = v_prompt[field_context]['name']
|
|
@@ -1413,7 +1431,10 @@ module Morpheus::Cli::ProvisioningHelper
|
|
|
1413
1431
|
# v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'datastoreId', 'type' => 'select', 'fieldLabel' => 'Root Datastore', 'selectOptions' => datastore_options, 'required' => true, 'description' => 'Choose a datastore.'}], options[:options])
|
|
1414
1432
|
# volume['datastoreId'] = v_prompt[field_context]['datastoreId']
|
|
1415
1433
|
# end
|
|
1416
|
-
|
|
1434
|
+
if !storage_profiles.empty?
|
|
1435
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'storageProfile', 'type' => 'select', 'fieldLabel' => 'Root Storage Profile', 'selectOptions' => storage_profiles, 'required' => false, 'description' => 'Choose a storage profile.', 'defaultValue' => volume['storageProfile']}], options[:options])
|
|
1436
|
+
volume['storageProfile'] = v_prompt[field_context]['storageProfile'] if v_prompt[field_context] && !v_prompt[field_context]['storageProfile'].to_s.empty?
|
|
1437
|
+
end
|
|
1417
1438
|
volumes << volume
|
|
1418
1439
|
|
|
1419
1440
|
# modify or delete existing data volumes
|
|
@@ -1443,6 +1464,9 @@ module Morpheus::Cli::ProvisioningHelper
|
|
|
1443
1464
|
if !current_volume['controllerMountPoint'].to_s.empty?
|
|
1444
1465
|
volume['controllerMountPoint'] = current_volume['controllerMountPoint']
|
|
1445
1466
|
end
|
|
1467
|
+
if !current_volume['storageProfile'].to_s.empty?
|
|
1468
|
+
volume['storageProfile'] = current_volume['storageProfile']
|
|
1469
|
+
end
|
|
1446
1470
|
volumes << volume
|
|
1447
1471
|
else
|
|
1448
1472
|
# v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'storageType', 'type' => 'select', 'fieldLabel' => "Disk #{volume_index} Storage Type", 'selectOptions' => storage_types, 'required' => true, 'skipSingleOption' => true, 'description' => 'Choose a storage type.'}], options[:options])
|
|
@@ -1471,7 +1495,9 @@ module Morpheus::Cli::ProvisioningHelper
|
|
|
1471
1495
|
if !current_volume['controllerMountPoint'].to_s.empty?
|
|
1472
1496
|
volume['controllerMountPoint'] = current_volume['controllerMountPoint']
|
|
1473
1497
|
end
|
|
1474
|
-
|
|
1498
|
+
if !current_volume['storageProfile'].to_s.empty?
|
|
1499
|
+
volume['storageProfile'] = current_volume['storageProfile']
|
|
1500
|
+
end
|
|
1475
1501
|
if plan_info['customizeVolume'] && storage_type['customLabel']
|
|
1476
1502
|
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'name', 'type' => 'text', 'fieldLabel' => "Disk #{volume_index} Volume Label", 'required' => true, 'description' => 'Enter a volume label.', 'defaultValue' => volume['name']}], options[:options])
|
|
1477
1503
|
volume['name'] = v_prompt[field_context]['name']
|
|
@@ -1499,6 +1525,10 @@ module Morpheus::Cli::ProvisioningHelper
|
|
|
1499
1525
|
# v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'datastoreId', 'type' => 'select', 'fieldLabel' => "Disk #{volume_index} Datastore", 'selectOptions' => datastore_options, 'required' => true, 'description' => 'Choose a datastore.'}], options[:options])
|
|
1500
1526
|
# volume['datastoreId'] = v_prompt[field_context]['datastoreId']
|
|
1501
1527
|
# end
|
|
1528
|
+
if !storage_profiles.empty?
|
|
1529
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'storageProfile', 'type' => 'select', 'fieldLabel' => 'Root Storage Profile', 'selectOptions' => storage_profiles, 'required' => false, 'description' => 'Choose a storage profile.', 'defaultValue' => current_volume['storageProfile']}], options[:options])
|
|
1530
|
+
volume['storageProfile'] = v_prompt[field_context]['storageProfile'] if v_prompt[field_context] && !v_prompt[field_context]['storageProfile'].to_s.empty?
|
|
1531
|
+
end
|
|
1502
1532
|
|
|
1503
1533
|
volumes << volume
|
|
1504
1534
|
|
|
@@ -1572,6 +1602,10 @@ module Morpheus::Cli::ProvisioningHelper
|
|
|
1572
1602
|
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'datastoreId', 'type' => 'select', 'fieldLabel' => "Disk #{volume_index} Datastore", 'selectOptions' => datastore_options, 'required' => true, 'description' => 'Choose a datastore.', 'defaultValue' => current_root_volume['datastoreId']}], options[:options])
|
|
1573
1603
|
volume['datastoreId'] = v_prompt[field_context]['datastoreId'] unless v_prompt[field_context]['datastoreId'].to_s.empty?
|
|
1574
1604
|
end
|
|
1605
|
+
if !storage_profiles.empty?
|
|
1606
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'storageProfile', 'type' => 'select', 'fieldLabel' => 'Root Storage Profile', 'selectOptions' => storage_profiles, 'required' => false, 'description' => 'Choose a storage profile.'}], options[:options])
|
|
1607
|
+
volume['storageProfile'] = v_prompt[field_context]['storageProfile'] if v_prompt[field_context] && !v_prompt[field_context]['storageProfile'].to_s.empty?
|
|
1608
|
+
end
|
|
1575
1609
|
|
|
1576
1610
|
volumes << volume
|
|
1577
1611
|
|
|
@@ -24,6 +24,7 @@ module Morpheus
|
|
|
24
24
|
# should use Readline.readline to probably
|
|
25
25
|
Readline.completion_append_character = ""
|
|
26
26
|
Readline.basic_word_break_characters = ''
|
|
27
|
+
Readline.completer_word_break_characters = '' rescue nil
|
|
27
28
|
Readline.completion_proc = nil
|
|
28
29
|
if default_value.nil?
|
|
29
30
|
confirm_prompt = "#{message} (yes/no): "
|
|
@@ -716,7 +717,7 @@ module Morpheus
|
|
|
716
717
|
end
|
|
717
718
|
else
|
|
718
719
|
found_default_option = select_options.find {|opt| opt[value_field].to_s == default_value.to_s || opt['name'] == default_value.to_s}
|
|
719
|
-
found_default_option = select_options.find {|opt| opt[value_field].to_s.start_with?(default_value.to_s) || opt['name'].to_s.start_with?(default_value.to_s)} if !found_default_option
|
|
720
|
+
#found_default_option = select_options.find {|opt| opt[value_field].to_s.start_with?(default_value.to_s) || opt['name'].to_s.start_with?(default_value.to_s)} if !found_default_option
|
|
720
721
|
if found_default_option
|
|
721
722
|
default_value = found_default_option['name'] # name is prettier than value
|
|
722
723
|
end
|
|
@@ -804,6 +805,7 @@ module Morpheus
|
|
|
804
805
|
#Readline.input = $stdin
|
|
805
806
|
Readline.completion_append_character = ""
|
|
806
807
|
Readline.basic_word_break_characters = ''
|
|
808
|
+
Readline.completer_word_break_characters = '' rescue nil
|
|
807
809
|
Readline.completion_proc = proc {|s|
|
|
808
810
|
matches = []
|
|
809
811
|
available_options = (select_options || [])
|
|
@@ -901,6 +903,7 @@ module Morpheus
|
|
|
901
903
|
#Readline.input = $stdin
|
|
902
904
|
Readline.completion_append_character = ""
|
|
903
905
|
Readline.basic_word_break_characters = ''
|
|
906
|
+
Readline.completer_word_break_characters = '' rescue nil
|
|
904
907
|
Readline.completion_proc = proc {|s|
|
|
905
908
|
matches = []
|
|
906
909
|
available_options = (select_options || [])
|
|
@@ -1120,6 +1123,7 @@ module Morpheus
|
|
|
1120
1123
|
# input = $stdin.gets.chomp!
|
|
1121
1124
|
Readline.completion_append_character = ""
|
|
1122
1125
|
Readline.basic_word_break_characters = ''
|
|
1126
|
+
Readline.completer_word_break_characters = '' rescue nil
|
|
1123
1127
|
Readline.completion_proc = nil
|
|
1124
1128
|
prompt_label = "#{option_type['fieldLabel']}#{option_type['fieldAddOn'] ? (' (' + option_type['fieldAddOn'] + ') ') : '' }#{!option_type['required'] ? ' (optional)' : ''}#{!option_type['defaultValue'].to_s.empty? ? ' ['+option_type['defaultValue'].to_s+']' : ''}: "
|
|
1125
1129
|
input = Readline.readline(prompt_label, false).to_s
|
|
@@ -1186,6 +1190,7 @@ module Morpheus
|
|
|
1186
1190
|
else
|
|
1187
1191
|
Readline.completion_append_character = ""
|
|
1188
1192
|
Readline.basic_word_break_characters = ''
|
|
1193
|
+
Readline.completer_word_break_characters = '' rescue nil
|
|
1189
1194
|
Readline.completion_proc = nil
|
|
1190
1195
|
# needs to work like $stdin.noecho
|
|
1191
1196
|
Readline.pre_input_hook = lambda {
|
|
@@ -1221,7 +1226,11 @@ module Morpheus
|
|
|
1221
1226
|
#Readline.input = $stdin
|
|
1222
1227
|
Readline.completion_append_character = ""
|
|
1223
1228
|
Readline.basic_word_break_characters = ''
|
|
1224
|
-
Readline.
|
|
1229
|
+
Readline.completer_word_break_characters = '' rescue nil
|
|
1230
|
+
Readline.completion_proc = proc {|s|
|
|
1231
|
+
# FILENAME_COMPLETION_PROC is nil in newer rubies
|
|
1232
|
+
Readline::FILENAME_COMPLETION_PROC.call(s) rescue []
|
|
1233
|
+
}
|
|
1225
1234
|
input = Readline.readline("#{option_type['fieldLabel']}#{option_type['fieldAddOn'] ? (' (' + option_type['fieldAddOn'] + ') ') : '' }#{optional_label(option_type)}#{option_type['defaultValue'] ? ' ['+option_type['defaultValue'].to_s+']' : ''}: ", false).to_s
|
|
1226
1235
|
input = input.chomp.strip
|
|
1227
1236
|
#input = $stdin.gets.chomp!
|
data/lib/morpheus/cli/version.rb
CHANGED
data/lib/morpheus/terminal.rb
CHANGED
|
@@ -356,30 +356,6 @@ module Morpheus
|
|
|
356
356
|
@angry_prompt ||= Morpheus::Terminal.angry_prompt
|
|
357
357
|
end
|
|
358
358
|
|
|
359
|
-
# def gets
|
|
360
|
-
# Readline.completion_append_character = " "
|
|
361
|
-
# Readline.completion_proc = @auto_complete
|
|
362
|
-
# Readline.basic_word_break_characters = ""
|
|
363
|
-
# #Readline.basic_word_break_characters = "\t\n\"\‘`@$><=;|&{( "
|
|
364
|
-
# input = Readline.readline("#{@prompt}", true).to_s
|
|
365
|
-
# input = input.strip
|
|
366
|
-
# execute(input)
|
|
367
|
-
# end
|
|
368
|
-
|
|
369
|
-
# def puts(*cmds)
|
|
370
|
-
# cmds.each do |cmd|
|
|
371
|
-
# self.execute(cmd) # exec
|
|
372
|
-
# end
|
|
373
|
-
# end
|
|
374
|
-
|
|
375
|
-
# def gets(*args)
|
|
376
|
-
# $stdin.gets(*args)
|
|
377
|
-
# end
|
|
378
|
-
|
|
379
|
-
def readline(*args)
|
|
380
|
-
# todo: one prompt to rule them all
|
|
381
|
-
end
|
|
382
|
-
|
|
383
359
|
# protected
|
|
384
360
|
|
|
385
361
|
def execute(input)
|
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.11.1
|
|
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: 2025-
|
|
14
|
+
date: 2025-11-20 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: tins
|