morpheus-cli 6.3.1 → 6.3.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8acef874a37276edc6d53f64e243ca01c0e0d30e49dea166502058da2f01350d
4
- data.tar.gz: f0f9022abbb5b04c526cf992c95cacee2927ce5fb2e27027b19dc624abe454be
3
+ metadata.gz: 94da7995030caa8d8370454c1a17ae68e314080fa52dde2d95b48122e69e5f6d
4
+ data.tar.gz: 19aa5d0040441e385606f43f1ae1b0d09e6eb5a3fa99958450acc6914dc8a803
5
5
  SHA512:
6
- metadata.gz: ab4f224e431ff217ea24591b385d76f1a6370626770e8eb9f8ae8291c6d6681e3a29c58c6c220fea85510819da0df901e3816e37f4937ad2b04c4322a5eae0b2
7
- data.tar.gz: 27976146b5f086f41968860c7eb210fdbc7cf8ac6667b55e1318e88f9fae938c33699b05a14a1cdba91bfcde0635b01113bc61c3c1e21ade5e2a7bea719cee66
6
+ metadata.gz: d718c881f79ecdf26a91172506f9500b69a3269bc1ae00bf53d0191fcbe484d10aea1e9919822c2a6fdf69d195b2d1c8009917d79ef9d5fd0df0a76962ba8f14
7
+ data.tar.gz: da197f17e1617a9f909bd61b92c3f82b79ab70b951603033b08cd6b86e5b5ff20b8f659cd48fd5823fea80afad02712be72ad202ec5ef0d3e179a12a503af225
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
1
  FROM ruby:2.7.5
2
2
 
3
- RUN gem install morpheus-cli -v 6.3.1
3
+ RUN gem install morpheus-cli -v 6.3.3
4
4
 
5
5
  ENTRYPOINT ["morpheus"]
@@ -38,4 +38,23 @@ class Morpheus::LibraryClusterPackagesInterface < Morpheus::APIClient
38
38
  opts = {method: :delete, url: url, headers: headers, payload: payload.to_json}
39
39
  execute(opts)
40
40
  end
41
+
42
+ def update_logo(id, logo_file, dark_logo_file=nil)
43
+ url = "#{@base_url}/api/library/cluster-packages/#{id}"
44
+ headers = { :params => {}, :authorization => "Bearer #{@access_token}"}
45
+ payload = {}
46
+ payload["clusterPackage"] = {}
47
+ if logo_file
48
+ payload["clusterPackage"]["logo"] = logo_file
49
+ end
50
+ if dark_logo_file
51
+ payload["clusterPackage"]["darkLogo"] = dark_logo_file
52
+ end
53
+ if logo_file.is_a?(File) || dark_logo_file.is_a?(File)
54
+ payload[:multipart] = true
55
+ else
56
+ headers['Content-Type'] = 'application/x-www-form-urlencoded'
57
+ end
58
+ execute(method: :put, url: url, headers: headers, payload: payload)
59
+ end
41
60
  end
@@ -563,7 +563,7 @@ module Morpheus
563
563
  # added with :payload too... just need it here to avoid unknown key error
564
564
  # todo: remove this when every command supporting :payload is updated to use parse_payload(options) and execute_api(options)
565
565
  when :list
566
- opts.on( '-m', '--max MAX', "Max Results (use -1 for all results)" ) do |val|
566
+ opts.on( '-m', '--max MAX', "Max Results" ) do |val|
567
567
  # api supports max=-1 for all at the moment..
568
568
  if val.to_s == "all" || val.to_s == "-1"
569
569
  options[:max] = "-1"
@@ -181,7 +181,8 @@ class Morpheus::Cli::CloudFoldersCommand
181
181
  #"Type" => lambda {|it| it['type'].to_s.capitalize },
182
182
  "Cloud" => lambda {|it| it['zone'] ? it['zone']['name'] : '' },
183
183
  "Active" => lambda {|it| format_boolean(it['active']) },
184
- "Default" => lambda {|it| format_boolean(it['defaultPool']) },
184
+ "Default" => lambda {|it| format_boolean(it['defaultFolder']) },
185
+ "Image Target" => lambda {|it| format_boolean(it['defaultStore']) },
185
186
  "Visibility" => lambda {|it| it['visibility'].to_s.capitalize },
186
187
  #"Tenants" => lambda {|it| it['tenants'] ? it['tenants'].collect {|it| it['name'] }.uniq.join(', ') : '' }
187
188
  # "Owner" => lambda {|it| it['owner'] ? it['owner']['name'] : '' },
@@ -319,6 +320,12 @@ class Morpheus::Cli::CloudFoldersCommand
319
320
  opts.on('--active [on|off]', String, "Can be used to disable a resource folder") do |val|
320
321
  options['active'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == ''
321
322
  end
323
+ opts.on('--default-folder [on|off]', String, "Default Folder") do |val|
324
+ options['defaultFolder'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == ''
325
+ end
326
+ opts.on('--image-target [on|off]', String, "Image Target") do |val|
327
+ options['defaultStore'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == ''
328
+ end
322
329
  build_common_options(opts, options, [:options, :payload, :json, :dry_run, :remote])
323
330
  opts.footer = "Update a resource folder." + "\n" +
324
331
  "[cloud] is required. This is the name or id of the cloud." + "\n"
@@ -408,6 +415,16 @@ class Morpheus::Cli::CloudFoldersCommand
408
415
  if options['active'] != nil
409
416
  payload['folder']['active'] = options['active']
410
417
  end
418
+
419
+ # Default
420
+ if options['defaultFolder'] != nil
421
+ payload['folder']['defaultFolder'] = options['defaultFolder']
422
+ end
423
+
424
+ # Image Target
425
+ if options['defaultStore'] != nil
426
+ payload['folder']['defaultStore'] = options['defaultStore']
427
+ end
411
428
 
412
429
  # Visibility
413
430
  if options['visibility'] != nil
@@ -5,6 +5,7 @@ class Morpheus::Cli::DashboardCommand
5
5
  include Morpheus::Cli::ProvisioningHelper
6
6
  set_command_name :dashboard
7
7
  set_command_description "View Morpheus Dashboard"
8
+ set_command_hidden
8
9
 
9
10
  def initialize()
10
11
  # @appliance_name, @appliance_url = Morpheus::Cli::Remote.active_appliance
@@ -16,7 +17,7 @@ class Morpheus::Cli::DashboardCommand
16
17
  end
17
18
 
18
19
  def usage
19
- "Usage: morpheus #{command_name}"
20
+ "#{yellow}API for this command has been removed starting with appliance version 6.2.6\n#{reset}Usage: morpheus #{command_name}"
20
21
  end
21
22
 
22
23
  def handle(args)
@@ -89,7 +89,7 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
89
89
  opts.banner = subcommand_usage("[clusterPackage]")
90
90
  build_common_options(opts, options, [:json, :yaml, :csv, :fields, :dry_run, :remote])
91
91
  opts.footer = "Display cluster package details." + "\n" +
92
- "[clusterPackage] is required. This is the name or id of a cluster package."
92
+ "[clusterPackage] is required. This is the id of a cluster package."
93
93
  end
94
94
  optparse.parse!(args)
95
95
  if args.count < 1
@@ -114,7 +114,7 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
114
114
  print_dry_run @library_cluster_packages_interface.dry.get(id)
115
115
  return
116
116
  end
117
- package = find_package_by_name_or_id(id)
117
+ package = find_package_by_id(id)
118
118
  if package.nil?
119
119
  return 1
120
120
  end
@@ -143,6 +143,9 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
143
143
  "Package Version" => lambda {|it| it['packageVersion']},
144
144
  "Package Type" => lambda {|it| it['packageType']},
145
145
  "Type" => lambda {|it| it['type'] },
146
+ "Repeat Install" => lambda {|it| format_boolean(it['repeatInstall'])},
147
+ "Logo" => lambda {|it| it['imagePath'] },
148
+ "Dark Logo" => lambda {|it| it['darkImagePath'] },
146
149
  "Spec Templates" => lambda {|it|
147
150
  "(#{it['specTemplates'].count}) #{it['specTemplates'].collect {|it| it['name'] }.join(', ')}"
148
151
  }
@@ -171,6 +174,8 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
171
174
  def add(args)
172
175
  options = {}
173
176
  params = {}
177
+ logo_file = nil
178
+ dark_logo_file = nil
174
179
  optparse = Morpheus::Cli::OptionParser.new do|opts|
175
180
  opts.banner = subcommand_usage("[name] [options]")
176
181
  opts.on('-n', '--name VALUE', String, "Name for this cluster package") do |val|
@@ -202,7 +207,32 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
202
207
  params['specTemplates'] = list.collect {|it| it.to_s.strip.empty? ? nil : it.to_s.strip }.compact.uniq
203
208
  end
204
209
  end
205
-
210
+ opts.on('--logo FILE', String, "Upload a custom logo icon") do |val|
211
+ filename = val
212
+ logo_file = nil
213
+ if filename == 'null'
214
+ logo_file = 'null' # clear it
215
+ else
216
+ filename = File.expand_path(filename)
217
+ if !File.exist?(filename)
218
+ raise_command_error "File not found: #{filename}"
219
+ end
220
+ logo_file = File.new(filename, 'rb')
221
+ end
222
+ end
223
+ opts.on('--dark-logo FILE', String, "Upload a custom dark logo icon") do |val|
224
+ filename = val
225
+ dark_logo_file = nil
226
+ if filename == 'null'
227
+ dark_logo_file = 'null' # clear it
228
+ else
229
+ filename = File.expand_path(filename)
230
+ if !File.exist?(filename)
231
+ raise_command_error "File not found: #{filename}"
232
+ end
233
+ dark_logo_file = File.new(filename, 'rb')
234
+ end
235
+ end
206
236
  build_common_options(opts, options, [:options, :payload, :json, :dry_run, :remote])
207
237
  opts.footer = "Create a cluster package."
208
238
  end
@@ -263,6 +293,11 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
263
293
  params['packageVersion'] = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'packageVersion', 'packageVersion' => 'text', 'fieldLabel' => 'Package Version', 'required' => true}], options[:options], @api_client,{})['packageVersion']
264
294
  end
265
295
 
296
+ # logo
297
+ if params['iconPath'].nil?
298
+ params['iconPath'] = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'iconPath', 'fieldLabel' => 'Logo', 'type' => 'select', 'optionSource' => 'iconList'}], options[:options], @api_client,{})['iconPath']
299
+ end
300
+
266
301
  # specTemplates
267
302
  if params['specTemplates'].nil?
268
303
  spec_templates = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'specTemplates', 'fieldLabel' => 'Spec Templates', 'type' => 'multiSelect', 'required' => true, 'optionSource' => 'clusterResourceSpecTemplates'}], options[:options], @api_client, {})['specTemplates']
@@ -279,6 +314,16 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
279
314
  end
280
315
 
281
316
  json_response = @library_cluster_packages_interface.create(payload)
317
+ if json_response['success']
318
+ if logo_file || dark_logo_file
319
+ begin
320
+ @library_cluster_packages_interface.update_logo(json_response['id'], logo_file, dark_logo_file)
321
+ rescue RestClient::Exception => e
322
+ print_red_alert "Failed to save logo!"
323
+ print_rest_exception(e, options)
324
+ end
325
+ end
326
+ end
282
327
 
283
328
  if options[:json]
284
329
  print JSON.pretty_generate(json_response), "\n"
@@ -295,8 +340,10 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
295
340
  def update(args)
296
341
  options = {}
297
342
  params = {}
343
+ logo_file = nil
344
+ dark_logo_file = nil
298
345
  optparse = Morpheus::Cli::OptionParser.new do|opts|
299
- opts.banner = subcommand_usage("[name] [options]")
346
+ opts.banner = subcommand_usage("[id] [options]")
300
347
  opts.on('-n', '--name VALUE', String, "Name for this cluster package") do |val|
301
348
  params['name'] = val
302
349
  end
@@ -326,10 +373,35 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
326
373
  params['specTemplates'] = list.collect {|it| it.to_s.strip.empty? ? nil : it.to_s.strip }.compact.uniq
327
374
  end
328
375
  end
329
-
376
+ opts.on('--logo FILE', String, "Upload a custom logo icon") do |val|
377
+ filename = val
378
+ logo_file = nil
379
+ if filename == 'null'
380
+ logo_file = 'null' # clear it
381
+ else
382
+ filename = File.expand_path(filename)
383
+ if !File.exist?(filename)
384
+ raise_command_error "File not found: #{filename}"
385
+ end
386
+ logo_file = File.new(filename, 'rb')
387
+ end
388
+ end
389
+ opts.on('--dark-logo FILE', String, "Upload a custom dark logo icon") do |val|
390
+ filename = val
391
+ dark_logo_file = nil
392
+ if filename == 'null'
393
+ dark_logo_file = 'null' # clear it
394
+ else
395
+ filename = File.expand_path(filename)
396
+ if !File.exist?(filename)
397
+ raise_command_error "File not found: #{filename}"
398
+ end
399
+ dark_logo_file = File.new(filename, 'rb')
400
+ end
401
+ end
330
402
  build_common_options(opts, options, [:options, :json, :dry_run, :remote])
331
403
  opts.footer = "Update a cluster package." + "\n" +
332
- "[name] is required. This is the name or id of a cluster package."
404
+ "[id] is required. This is the id of a cluster package."
333
405
  end
334
406
 
335
407
  optparse.parse!(args)
@@ -340,7 +412,7 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
340
412
  return 1
341
413
  end
342
414
  begin
343
- cluster_package = find_package_by_name_or_id(args[0])
415
+ cluster_package = find_package_by_id(args[0])
344
416
  exit 1 if cluster_package.nil?
345
417
  passed_options = (options[:options] || {}).reject {|k,v| k.is_a?(Symbol) }
346
418
  payload = nil
@@ -351,7 +423,7 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
351
423
  params.deep_merge!(options[:options].reject {|k,v| k.is_a?(Symbol) }) if options[:options]
352
424
  end
353
425
 
354
- if params.empty?
426
+ if params.empty? && !logo_file && !dark_logo_file
355
427
  print_green_success "Nothing to update"
356
428
  exit 1
357
429
  end
@@ -361,15 +433,34 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
361
433
  print_dry_run @library_cluster_packages_interface.dry.update(cluster_package['id'], payload)
362
434
  return 0
363
435
  end
364
-
365
- json_response = @library_cluster_packages_interface.update(cluster_package['id'], payload)
366
-
367
- if options[:json]
368
- print JSON.pretty_generate(json_response), "\n"
369
- return 0
370
- end
371
436
 
372
- print_green_success "Updated Cluster Package #{params['name'] || cluster_package['name']}"
437
+ if (logo_file || dark_logo_file) && params.empty?
438
+ begin
439
+ @library_cluster_packages_interface.update_logo(cluster_package['id'], logo_file, dark_logo_file)
440
+ print_green_success "Updated Cluster Package #{params['name'] || cluster_package['name']}"
441
+ rescue RestClient::Exception => e
442
+ print_red_alert "Failed to save logo!"
443
+ print_rest_exception(e, options)
444
+ end
445
+ else
446
+ json_response = @library_cluster_packages_interface.update(cluster_package['id'], payload)
447
+ if json_response['success']
448
+ if logo_file || dark_logo_file
449
+ begin
450
+ @library_cluster_packages_interface.update_logo(json_response['id'], logo_file, dark_logo_file)
451
+ rescue RestClient::Exception => e
452
+ print_red_alert "Failed to save logo!"
453
+ print_rest_exception(e, options)
454
+ end
455
+ end
456
+ end
457
+ if options[:json]
458
+ print JSON.pretty_generate(json_response), "\n"
459
+ return 0
460
+ end
461
+
462
+ print_green_success "Updated Cluster Package #{params['name'] || cluster_package['name']}"
463
+ end
373
464
  return 0
374
465
  rescue RestClient::Exception => e
375
466
  print_rest_exception(e, options)
@@ -383,7 +474,7 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
383
474
  opts.banner = subcommand_usage("[clusterPackage]")
384
475
  build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
385
476
  opts.footer = "Delete a cluster package." + "\n" +
386
- "[clusterPackage] is required. This is the name or id of a cluster package."
477
+ "[clusterPackage] is required. This is the id of a cluster package."
387
478
  end
388
479
  optparse.parse!(args)
389
480
 
@@ -396,7 +487,7 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
396
487
  connect(options)
397
488
 
398
489
  begin
399
- cluster_package = find_package_by_name_or_id(args[0])
490
+ cluster_package = find_package_by_id(args[0])
400
491
  if cluster_package.nil?
401
492
  return 1
402
493
  end
@@ -432,14 +523,6 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
432
523
 
433
524
  private
434
525
 
435
- def find_package_by_name_or_id(val)
436
- if val.to_s =~ /\A\d{1,}\Z/
437
- return find_package_by_id(val)
438
- else
439
- return find_package_by_name(val)
440
- end
441
- end
442
-
443
526
  def find_package_by_id(id)
444
527
  begin
445
528
  json_response = @library_cluster_packages_interface.get(id.to_i)
@@ -453,22 +536,6 @@ class Morpheus::Cli::LibraryClusterPackagesCommand
453
536
  end
454
537
  end
455
538
 
456
- def find_package_by_name(name)
457
- packages = @library_cluster_packages_interface.list({name: name.to_s})['clusterPackages']
458
- if packages.empty?
459
- print_red_alert "Cluster package not found by name #{name}"
460
- return nil
461
- elsif packages.size > 1
462
- print_red_alert "#{packages.size} cluster packages found by name #{name}"
463
- print_packages_table(packages, {color: red})
464
- print_red_alert "Try using ID instead"
465
- print reset,"\n"
466
- return nil
467
- else
468
- return packages[0]
469
- end
470
- end
471
-
472
539
  def print_packages_table(packages, opts={})
473
540
  columns = [
474
541
  {"ID" => lambda {|package| package['id'] } },
@@ -1505,7 +1505,8 @@ EOT
1505
1505
  # this should be fixed on the api side, so it automatically extracts this input from the config
1506
1506
  begin
1507
1507
  instance_type_code = nil
1508
- catalog_item_type = find_by_id(:catalog_item_type, catalog_item_type_id.to_i)
1508
+ catalog_item_type = record
1509
+ #catalog_item_type = find_by_id(:catalog_item_type, catalog_item_type_id.to_i)
1509
1510
  if catalog_item_type
1510
1511
  if catalog_item_type['type'] == 'instance'
1511
1512
  if catalog_item_type['config'] && catalog_item_type['config']['type']
@@ -76,7 +76,8 @@ module Morpheus
76
76
  option_type['type'] = 'multiText'
77
77
  end
78
78
  # swap types to multiSelect when flag is set..
79
- if option_type["config"] && ["true","on"].include?(option_type["config"]["multiSelect"].to_s)
79
+ config_multi_select = option_type["config"] && ["true","on"].include?(option_type["config"]["multiSelect"].to_s)
80
+ if config_multi_select
80
81
  if option_type["type"] == "typeahead"
81
82
  option_type["type"] = "multiTypeahead"
82
83
  elsif option_type["type"] == "select"
@@ -175,10 +176,9 @@ module Morpheus
175
176
  }
176
177
  end
177
178
 
179
+ depends_on_field_key = depends_on_code
178
180
  if depends_on_option_type
179
181
  depends_on_field_key = depends_on_option_type['fieldContext'].nil? || depends_on_option_type['fieldContext'].empty? ? "#{depends_on_option_type['fieldName']}" : "#{depends_on_option_type['fieldContext']}.#{depends_on_option_type['fieldName']}"
180
- else
181
- depends_on_field_key = depends_on_code
182
182
  end
183
183
 
184
184
  field_value = get_object_value(results, depends_on_field_key) ||
@@ -198,6 +198,53 @@ module Morpheus
198
198
  next if !found_dep_value
199
199
  end
200
200
 
201
+ # respect optionType.requireOnCode
202
+ require_option_check_value = option_type['requireOnCode']
203
+ if !require_option_check_value.to_s.empty?
204
+ # require_on_code = check_require_on_code(option_type, option_types, options)
205
+
206
+ match_type = 'any'
207
+
208
+ if require_option_check_value.include?('::')
209
+ match_type = 'all' if require_option_check_value.start_with?('matchAll')
210
+ require_option_check_value = require_option_check_value[require_option_check_value.index('::') + 2..-1]
211
+ end
212
+
213
+ found_dep_value = match_type == 'all' ? true : false
214
+ require_option_check_value.sub(',', ' ').split(' ').each do |value|
215
+ parts = value.split(':')
216
+ depends_on_code = parts[0]
217
+ depends_on_value = parts.count > 1 ? parts[1].to_s.strip : nil
218
+ depends_on_option_type = option_types.find {|it| it["code"] == depends_on_code }
219
+ if !depends_on_option_type
220
+ depends_on_option_type = option_types.find {|it|
221
+ (it['fieldContext'] ? "#{it['fieldContext']}.#{it['fieldName']}" : it['fieldName']) == depends_on_code
222
+ }
223
+ end
224
+
225
+ depends_on_field_key = depends_on_code
226
+ if depends_on_option_type
227
+ depends_on_field_key = depends_on_option_type['fieldContext'].nil? || depends_on_option_type['fieldContext'].empty? ? "#{depends_on_option_type['fieldName']}" : "#{depends_on_option_type['fieldContext']}.#{depends_on_option_type['fieldName']}"
228
+ end
229
+
230
+ field_value = get_object_value(results, depends_on_field_key) ||
231
+ get_object_value(options, depends_on_field_key) ||
232
+ get_object_value(api_params, depends_on_field_key)
233
+
234
+ if field_value.nil? && !options['_object_key'].nil?
235
+ field_value = get_object_value({options['_object_key'] => results}, depends_on_field_key)
236
+ end
237
+
238
+ if !field_value.nil? && (depends_on_value.nil? || depends_on_value.empty? || field_value.to_s.match?(depends_on_value))
239
+ found_dep_value = true if match_type != 'all'
240
+ else
241
+ found_dep_value = false if match_type == 'all'
242
+ end
243
+ end
244
+
245
+ option_type = option_type.merge({'required' => found_dep_value})
246
+ end
247
+
201
248
  # build parameters for option source api request
202
249
  option_params = (option_type['noParams'] ? {} : (api_params || {}).deep_merge(results))
203
250
  option_params.merge!(option_type['optionParams']) if option_type['optionParams']
@@ -316,6 +363,23 @@ module Morpheus
316
363
  value = typeahead_prompt(option_type, api_client, option_params, true)
317
364
  value_found = !!value
318
365
  end
366
+ if option_type['type'] == 'hidden'
367
+ if option_type['optionSource'].nil?
368
+ value = option_type['defaultValue']
369
+ else
370
+ select_options = load_source_options(option_type['optionSource'], option_type['optionSourceType'], api_client, option_params)
371
+ config_multi_select = option_type["config"] && ["true","on"].include?(option_type["config"]["multiSelect"].to_s)
372
+ if config_multi_select
373
+ value = select_options.collect { |it| it['value'] }
374
+ elsif select_options.is_a?(Array)
375
+ value = select_options[0] ? select_options[0]['value'] : nil
376
+ elsif select_options.is_a?(Hash)
377
+ value = select_options['value']
378
+ else
379
+ value = select_options
380
+ end
381
+ end
382
+ end
319
383
  if !value_found && !ignore_empty
320
384
  if option_type['required']
321
385
  print Term::ANSIColor.red, "\nMissing Required Option\n\n", Term::ANSIColor.reset
@@ -384,7 +448,17 @@ module Morpheus
384
448
  if option_type['optionSource'].nil?
385
449
  value = option_type['defaultValue']
386
450
  else
387
- value = load_source_options(option_type['optionSource'], option_type['optionSourceType'], api_client, api_params || {})
451
+ select_options = load_source_options(option_type['optionSource'], option_type['optionSourceType'], api_client, option_params)
452
+ config_multi_select = option_type["config"] && ["true","on"].include?(option_type["config"]["multiSelect"].to_s)
453
+ if config_multi_select
454
+ value = select_options.collect { |it| it['value'] }
455
+ elsif select_options.is_a?(Array)
456
+ value = select_options[0] ? select_options[0]['value'] : nil
457
+ elsif select_options.is_a?(Hash)
458
+ value = select_options['value']
459
+ else
460
+ value = select_options
461
+ end
388
462
  end
389
463
  elsif option_type['type'] == 'file'
390
464
  value = file_prompt(option_type)
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "6.3.1"
4
+ VERSION = "6.3.3"
5
5
  end
6
6
  end
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: 6.3.1
4
+ version: 6.3.3
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-11-14 00:00:00.000000000 Z
14
+ date: 2024-01-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler