morpheus-cli 4.0.0.1 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/morpheus/api.rb +10 -0
  3. data/lib/morpheus/api/api_client.rb +24 -3
  4. data/lib/morpheus/api/clouds_interface.rb +15 -0
  5. data/lib/morpheus/api/clusters_interface.rb +276 -0
  6. data/lib/morpheus/api/library_compute_type_layouts_interface.rb +26 -0
  7. data/lib/morpheus/api/logs_interface.rb +6 -0
  8. data/lib/morpheus/api/network_subnet_types_interface.rb +26 -0
  9. data/lib/morpheus/api/network_subnets_interface.rb +47 -0
  10. data/lib/morpheus/api/provision_types_interface.rb +6 -0
  11. data/lib/morpheus/api/security_groups_interface.rb +12 -3
  12. data/lib/morpheus/api/servers_interface.rb +15 -0
  13. data/lib/morpheus/api/service_plans_interface.rb +30 -0
  14. data/lib/morpheus/api/subnets_interface.rb +47 -0
  15. data/lib/morpheus/cli.rb +1 -0
  16. data/lib/morpheus/cli/apps.rb +20 -18
  17. data/lib/morpheus/cli/cli_command.rb +5 -1
  18. data/lib/morpheus/cli/clusters.rb +3952 -0
  19. data/lib/morpheus/cli/containers_command.rb +70 -2
  20. data/lib/morpheus/cli/hosts.rb +69 -53
  21. data/lib/morpheus/cli/instances.rb +33 -33
  22. data/lib/morpheus/cli/library_container_types_command.rb +2 -1
  23. data/lib/morpheus/cli/library_option_lists_command.rb +13 -8
  24. data/lib/morpheus/cli/mixins/accounts_helper.rb +43 -0
  25. data/lib/morpheus/cli/mixins/print_helper.rb +10 -2
  26. data/lib/morpheus/cli/mixins/provisioning_helper.rb +53 -3
  27. data/lib/morpheus/cli/networks_command.rb +883 -36
  28. data/lib/morpheus/cli/option_types.rb +37 -14
  29. data/lib/morpheus/cli/roles.rb +78 -77
  30. data/lib/morpheus/cli/user_settings_command.rb +34 -5
  31. data/lib/morpheus/cli/version.rb +1 -1
  32. metadata +10 -2
@@ -12,12 +12,13 @@ class Morpheus::Cli::ContainersCommand
12
12
 
13
13
  set_command_name :containers
14
14
 
15
- register_subcommands :get, :stop, :start, :restart, :suspend, :eject, :action, :actions
15
+ register_subcommands :get, :stop, :start, :restart, :suspend, :eject, :action, :actions, :logs
16
16
  register_subcommands :exec => :execution_request
17
17
 
18
18
  def connect(opts)
19
19
  @api_client = establish_remote_appliance_connection(opts)
20
20
  @containers_interface = @api_client.containers
21
+ @logs_interface = @api_client.logs
21
22
  @execution_request_interface = @api_client.execution_request
22
23
  end
23
24
 
@@ -28,7 +29,7 @@ class Morpheus::Cli::ContainersCommand
28
29
  def get(args)
29
30
  options = {}
30
31
  optparse = Morpheus::Cli::OptionParser.new do |opts|
31
- opts.banner = subcommand_usage("[name]")
32
+ opts.banner = subcommand_usage("[id]")
32
33
  opts.on( nil, '--actions', "Display Available Actions" ) do
33
34
  options[:include_available_actions] = true
34
35
  end
@@ -504,6 +505,73 @@ class Morpheus::Cli::ContainersCommand
504
505
  return 0
505
506
  end
506
507
 
508
+ def logs(args)
509
+ options = {}
510
+ optparse = Morpheus::Cli::OptionParser.new do |opts|
511
+ opts.banner = subcommand_usage("[id]")
512
+ build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
513
+ opts.footer = "List logs for a container.\n" +
514
+ "[id] is required. This is the id of a container."
515
+ end
516
+ optparse.parse!(args)
517
+ if args.count < 1
518
+ puts_error "[id] argument is required"
519
+ puts_error optparse
520
+ return 1
521
+ end
522
+ connect(options)
523
+ id_list = parse_id_list(args)
524
+ begin
525
+ containers = id_list # heh
526
+ params = {}
527
+ params.merge!(parse_list_options(options))
528
+ params[:query] = params.delete(:phrase) unless params[:phrase].nil?
529
+ @logs_interface.setopts(options)
530
+ if options[:dry_run]
531
+ print_dry_run @logs_interface.dry.container_logs(containers, params)
532
+ return
533
+ end
534
+ json_response = @logs_interface.container_logs(containers, params)
535
+ render_result = render_with_format(json_response, options, 'data')
536
+ return 0 if render_result
537
+
538
+ logs = json_response
539
+ title = "Container Logs: #{containers.join(', ')}"
540
+ subtitles = parse_list_subtitles(options)
541
+ if params[:query]
542
+ subtitles << "Search: #{params[:query]}".strip
543
+ end
544
+ # todo: startMs, endMs, sorts insteaad of sort..etc
545
+ print_h1 title, subtitles, options
546
+ if logs['data'].empty?
547
+ puts "#{cyan}No logs found.#{reset}"
548
+ else
549
+ logs['data'].reverse.each do |log_entry|
550
+ log_level = ''
551
+ case log_entry['level']
552
+ when 'INFO'
553
+ log_level = "#{blue}#{bold}INFO#{reset}"
554
+ when 'DEBUG'
555
+ log_level = "#{white}#{bold}DEBUG#{reset}"
556
+ when 'WARN'
557
+ log_level = "#{yellow}#{bold}WARN#{reset}"
558
+ when 'ERROR'
559
+ log_level = "#{red}#{bold}ERROR#{reset}"
560
+ when 'FATAL'
561
+ log_level = "#{red}#{bold}FATAL#{reset}"
562
+ end
563
+ puts "[#{log_entry['ts']}] #{log_level} - #{log_entry['message'].to_s.strip}"
564
+ end
565
+ print_results_pagination({'meta'=>{'total'=>json_response['total'],'size'=>json_response['data'].size,'max'=>(json_response['max'] || options[:max]),'offset'=>(json_response['offset'] || options[:offset] || 0)}})
566
+ end
567
+ print reset,"\n"
568
+ return 0
569
+ rescue RestClient::Exception => e
570
+ print_rest_exception(e, options)
571
+ exit 1
572
+ end
573
+ end
574
+
507
575
  def execution_request(args)
508
576
  options = {}
509
577
  params = {}
@@ -39,6 +39,7 @@ class Morpheus::Cli::Hosts
39
39
  @accounts_interface = Morpheus::APIClient.new(@access_token,nil,nil, @appliance_url).accounts
40
40
  @active_group_id = Morpheus::Cli::Groups.active_group
41
41
  @execution_request_interface = @api_client.execution_request
42
+ @clusters_interface = @api_client.clusters
42
43
  end
43
44
 
44
45
  def handle(args)
@@ -74,6 +75,10 @@ class Morpheus::Cli::Hosts
74
75
  opts.on( '-i', '--ip IPADDRESS', "Filter by IP Address" ) do |val|
75
76
  params[:ip] = val
76
77
  end
78
+ opts.on( '--cluster CLUSTER', '--cluster CLUSTER', "Filter by Cluster Name or ID" ) do |val|
79
+ # params[:clusterId] = val
80
+ options[:cluster] = val
81
+ end
77
82
  opts.on( '', '--vm', "Show only virtual machines" ) do |val|
78
83
  params[:vm] = true
79
84
  end
@@ -134,6 +139,17 @@ class Morpheus::Cli::Hosts
134
139
  return if created_by_ids.nil?
135
140
  params['createdBy'] = created_by_ids
136
141
  end
142
+
143
+ cluster = nil
144
+ if options[:cluster]
145
+ if options[:cluster].to_s =~ /\A\d{1,}\Z/
146
+ params['clusterId'] = options[:cluster]
147
+ else
148
+ cluster = find_cluster_by_name_or_id(options[:cluster])
149
+ return 1 if cluster.nil?
150
+ params['clusterId'] = cluster['id']
151
+ end
152
+ end
137
153
 
138
154
  @servers_interface.setopts(options)
139
155
  if options[:dry_run]
@@ -171,6 +187,11 @@ class Morpheus::Cli::Hosts
171
187
  if cloud
172
188
  subtitles << "Cloud: #{cloud['name']}".strip
173
189
  end
190
+ if cluster
191
+ subtitles << "Cluster: #{cluster['name']}".strip
192
+ elsif params['clusterId']
193
+ subtitles << "Cluster: #{params['clusterId']}".strip
194
+ end
174
195
  subtitles += parse_list_subtitles(options)
175
196
  print_h1 title, subtitles, options
176
197
  if servers.empty?
@@ -182,10 +203,12 @@ class Morpheus::Cli::Hosts
182
203
  all_stats = json_response['stats'] || {}
183
204
  servers.each do |it|
184
205
  found_stats = all_stats[it['id'].to_s] || all_stats[it['id']]
185
- if !it['stats']
186
- it['stats'] = found_stats # || {}
187
- else
188
- it['stats'] = found_stats.merge!(it['stats'])
206
+ if found_stats
207
+ if !it['stats']
208
+ it['stats'] = found_stats # || {}
209
+ else
210
+ it['stats'] = found_stats.merge!(it['stats'])
211
+ end
189
212
  end
190
213
  end
191
214
 
@@ -214,7 +237,7 @@ class Morpheus::Cli::Hosts
214
237
  cloud: server['zone'] ? server['zone']['name'] : '',
215
238
  type: server['computeServerType'] ? server['computeServerType']['name'] : 'unmanaged',
216
239
  nodes: server['containers'] ? server['containers'].size : '',
217
- status: format_host_status(server, cyan),
240
+ status: format_server_status(server, cyan),
218
241
  power: format_server_power_state(server, cyan),
219
242
  cpu: cpu_usage_str + cyan,
220
243
  memory: memory_usage_str + cyan,
@@ -431,7 +454,7 @@ class Morpheus::Cli::Hosts
431
454
  "Platform" => lambda {|it| it['serverOs'] ? it['serverOs']['name'].upcase : 'N/A' },
432
455
  "Plan" => lambda {|it| it['plan'] ? it['plan']['name'] : '' },
433
456
  "Agent" => lambda {|it| it['agentInstalled'] ? "#{server['agentVersion'] || ''} updated at #{format_local_dt(server['lastAgentUpdate'])}" : '(not installed)' },
434
- "Status" => lambda {|it| format_host_status(it) },
457
+ "Status" => lambda {|it| format_server_status(it) },
435
458
  "Nodes" => lambda {|it| it['containers'] ? it['containers'].size : 0 },
436
459
  "Power" => lambda {|it| format_server_power_state(it) },
437
460
  }, server)
@@ -524,7 +547,7 @@ class Morpheus::Cli::Hosts
524
547
  title = "Host Stats: #{server['name']} (#{server['computeServerType'] ? server['computeServerType']['name'] : 'unmanaged'})"
525
548
  print_h1 title, [], options
526
549
  puts cyan + "Power: ".rjust(12) + format_server_power_state(server).to_s
527
- puts cyan + "Status: ".rjust(12) + format_host_status(server).to_s
550
+ puts cyan + "Status: ".rjust(12) + format_server_status(server).to_s
528
551
  puts cyan + "Nodes: ".rjust(12) + (server['containers'] ? server['containers'].size : '').to_s
529
552
  #print_h2 "Host Usage", options
530
553
  print_stats_usage(stats, {label_width: 10})
@@ -541,7 +564,7 @@ class Morpheus::Cli::Hosts
541
564
  options = {}
542
565
  optparse = Morpheus::Cli::OptionParser.new do |opts|
543
566
  opts.banner = subcommand_usage("[name]")
544
- build_common_options(opts, options, [:list, :json, :dry_run, :remote])
567
+ build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
545
568
  end
546
569
  optparse.parse!(args)
547
570
  if args.count < 1
@@ -552,29 +575,30 @@ class Morpheus::Cli::Hosts
552
575
  begin
553
576
  server = find_host_by_name_or_id(args[0])
554
577
  params = {}
555
- [:phrase, :offset, :max, :sort, :direction].each do |k|
556
- params[k] = options[k] unless options[k].nil?
557
- end
578
+ params.merge!(parse_list_options(options))
558
579
  params[:query] = params.delete(:phrase) unless params[:phrase].nil?
559
580
  @logs_interface.setopts(options)
560
581
  if options[:dry_run]
561
582
  print_dry_run @logs_interface.dry.server_logs([server['id']], params)
562
583
  return
563
584
  end
564
- logs = @logs_interface.server_logs([server['id']], params)
565
- output = ""
566
- if options[:json]
567
- output << JSON.pretty_generate(logs)
585
+ json_response = @logs_interface.server_logs([server['id']], params)
586
+ render_result = render_with_format(json_response, options, 'data')
587
+ return 0 if render_result
588
+
589
+ logs = json_response
590
+ title = "Host Logs: #{server['name']} (#{server['computeServerType'] ? server['computeServerType']['name'] : 'unmanaged'})"
591
+ subtitles = parse_list_subtitles(options)
592
+ if params[:query]
593
+ subtitles << "Search: #{params[:query]}".strip
594
+ end
595
+ # todo: startMs, endMs, sorts insteaad of sort..etc
596
+ print_h1 title, subtitles, options
597
+ if logs['data'].empty?
598
+ puts "#{cyan}No logs found.#{reset}"
568
599
  else
569
- title = "Host Logs: #{server['name']} (#{server['computeServerType'] ? server['computeServerType']['name'] : 'unmanaged'})"
570
- subtitles = []
571
- if params[:query]
572
- subtitles << "Search: #{params[:query]}".strip
573
- end
574
- # todo: startMs, endMs, sorts insteaad of sort..etc
575
- print_h1 title, subtitles, options
576
600
  if logs['data'].empty?
577
- output << "#{cyan}No logs found.#{reset}\n"
601
+ puts "#{cyan}No logs found.#{reset}"
578
602
  else
579
603
  logs['data'].reverse.each do |log_entry|
580
604
  log_level = ''
@@ -590,11 +614,13 @@ class Morpheus::Cli::Hosts
590
614
  when 'FATAL'
591
615
  log_level = "#{red}#{bold}FATAL#{reset}"
592
616
  end
593
- output << "[#{log_entry['ts']}] #{log_level} - #{log_entry['message'].to_s.strip}\n"
617
+ puts "[#{log_entry['ts']}] #{log_level} - #{log_entry['message'].to_s.strip}"
594
618
  end
619
+ print_results_pagination({'meta'=>{'total'=>json_response['total'],'size'=>json_response['data'].size,'max'=>(json_response['max'] || options[:max]),'offset'=>(json_response['offset'] || options[:offset] || 0)}})
595
620
  end
621
+ print reset, "\n"
622
+ return 0
596
623
  end
597
- print output, reset, "\n"
598
624
  rescue RestClient::Exception => e
599
625
  print_rest_exception(e, options)
600
626
  exit 1
@@ -749,7 +775,7 @@ class Morpheus::Cli::Hosts
749
775
  end
750
776
 
751
777
  # prompt for volumes
752
- volumes = prompt_volumes(service_plan, options, @api_client, {})
778
+ volumes = prompt_volumes(service_plan, options, @api_client, {zoneId: cloud_id, serverTypeId: server_type['id'], siteId: group_id})
753
779
  if !volumes.empty?
754
780
  payload['volumes'] = volumes
755
781
  end
@@ -1809,40 +1835,30 @@ class Morpheus::Cli::Hosts
1809
1835
  return cloud_type
1810
1836
  end
1811
1837
 
1812
- def find_workflow_by_name_or_id(val)
1838
+ def find_cluster_by_name_or_id(val)
1813
1839
  if val.to_s =~ /\A\d{1,}\Z/
1814
- return find_workflow_by_id(val)
1840
+ find_cluster_by_id(val)
1815
1841
  else
1816
- return find_workflow_by_name(val)
1842
+ find_cluster_by_name(val)
1817
1843
  end
1818
1844
  end
1819
1845
 
1820
- def find_workflow_by_id(id)
1821
- begin
1822
- json_response = @task_sets_interface.get(id.to_i)
1823
- return json_response['taskSet']
1824
- rescue RestClient::Exception => e
1825
- if e.response && e.response.code == 404
1826
- print_red_alert "Workflow not found by id #{id}"
1827
- else
1828
- raise e
1829
- end
1846
+ def find_cluster_by_id(id)
1847
+ json_results = @clusters_interface.get(id.to_i)
1848
+ if json_results['cluster'].empty?
1849
+ print_red_alert "Cluster not found by id #{id}"
1850
+ exit 1
1830
1851
  end
1852
+ json_results['cluster']
1831
1853
  end
1832
1854
 
1833
- def find_workflow_by_name(name)
1834
- workflows = @task_sets_interface.get({name: name.to_s})['taskSets']
1835
- if workflows.empty?
1836
- print_red_alert "Workflow not found by name #{name}"
1837
- return nil
1838
- elsif workflows.size > 1
1839
- print_red_alert "#{workflows.size} workflows by name #{name}"
1840
- print_workflows_table(workflows, {color: red})
1841
- print reset,"\n\n"
1842
- return nil
1843
- else
1844
- return workflows[0]
1855
+ def find_cluster_by_name(name)
1856
+ json_results = @clusters_interface.list({name: name})
1857
+ if json_results['clusters'].empty? || json_results['clusters'].count > 1
1858
+ print_red_alert "Cluster not found by name #{name}"
1859
+ exit 1
1845
1860
  end
1861
+ json_results['clusters'][0]
1846
1862
  end
1847
1863
 
1848
1864
  def format_server_power_state(server, return_color=cyan)
@@ -1852,12 +1868,12 @@ class Morpheus::Cli::Hosts
1852
1868
  elsif server['powerState'] == 'off'
1853
1869
  out << "#{red}OFF#{return_color}"
1854
1870
  else
1855
- out << "#{white}#{server['powerState'].upcase}#{return_color}"
1871
+ out << "#{white}#{server['powerState'].to_s.upcase}#{return_color}"
1856
1872
  end
1857
1873
  out
1858
1874
  end
1859
1875
 
1860
- def format_host_status(server, return_color=cyan)
1876
+ def format_server_status(server, return_color=cyan)
1861
1877
  out = ""
1862
1878
  status_string = server['status']
1863
1879
  # todo: colorize, upcase?
@@ -1017,7 +1017,7 @@ class Morpheus::Cli::Instances
1017
1017
  opts.on( '-n', '--node NODE_ID', "Scope logs to specific Container or VM" ) do |node_id|
1018
1018
  options[:node_id] = node_id.to_i
1019
1019
  end
1020
- build_common_options(opts, options, [:list, :query, :json, :csv, :dry_run, :remote])
1020
+ build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
1021
1021
  end
1022
1022
  optparse.parse!(args)
1023
1023
  if args.count < 1
@@ -1039,42 +1039,42 @@ class Morpheus::Cli::Instances
1039
1039
  print_dry_run @logs_interface.dry.container_logs(container_ids, params)
1040
1040
  return
1041
1041
  end
1042
- logs = @logs_interface.container_logs(container_ids, params)
1043
- output = ""
1044
- if options[:json]
1045
- puts as_json(logs, options)
1046
- return 0
1042
+ json_response = @logs_interface.container_logs(container_ids, params)
1043
+ render_result = render_with_format(json_response, options, 'data')
1044
+ return 0 if render_result
1045
+
1046
+ logs = json_response
1047
+ title = "Instance Logs: #{instance['name']} (#{instance['instanceType'] ? instance['instanceType']['name'] : ''})"
1048
+ subtitles = parse_list_subtitles(options)
1049
+ if params[:query]
1050
+ subtitles << "Search: #{params[:query]}".strip
1051
+ end
1052
+ # todo: startMs, endMs, sorts insteaad of sort..etc
1053
+ print_h1 title, subtitles, options
1054
+ if logs['data'].empty?
1055
+ puts "#{cyan}No logs found.#{reset}"
1047
1056
  else
1048
- title = "Instance Logs: #{instance['name']} (#{instance['instanceType'] ? instance['instanceType']['name'] : ''})"
1049
- subtitles = []
1050
- if params[:query]
1051
- subtitles << "Search: #{params[:query]}".strip
1052
- end
1053
- # todo: startMs, endMs, sorts insteaad of sort..etc
1054
- print_h1 title, subtitles, options
1055
- if logs['data'].empty?
1056
- puts "#{cyan}No logs found.#{reset}"
1057
- else
1058
- logs['data'].reverse.each do |log_entry|
1059
- log_level = ''
1060
- case log_entry['level']
1061
- when 'INFO'
1062
- log_level = "#{blue}#{bold}INFO#{reset}"
1063
- when 'DEBUG'
1064
- log_level = "#{white}#{bold}DEBUG#{reset}"
1065
- when 'WARN'
1066
- log_level = "#{yellow}#{bold}WARN#{reset}"
1067
- when 'ERROR'
1068
- log_level = "#{red}#{bold}ERROR#{reset}"
1069
- when 'FATAL'
1070
- log_level = "#{red}#{bold}FATAL#{reset}"
1071
- end
1072
- puts "[#{log_entry['ts']}] #{log_level} - #{log_entry['message'].to_s.strip}"
1057
+ logs['data'].reverse.each do |log_entry|
1058
+ log_level = ''
1059
+ case log_entry['level']
1060
+ when 'INFO'
1061
+ log_level = "#{blue}#{bold}INFO#{reset}"
1062
+ when 'DEBUG'
1063
+ log_level = "#{white}#{bold}DEBUG#{reset}"
1064
+ when 'WARN'
1065
+ log_level = "#{yellow}#{bold}WARN#{reset}"
1066
+ when 'ERROR'
1067
+ log_level = "#{red}#{bold}ERROR#{reset}"
1068
+ when 'FATAL'
1069
+ log_level = "#{red}#{bold}FATAL#{reset}"
1073
1070
  end
1074
- print output, reset, "\n"
1075
- return 0
1071
+ puts "[#{log_entry['ts']}] #{log_level} - #{log_entry['message'].to_s.strip}"
1076
1072
  end
1073
+ print_results_pagination({'meta'=>{'total'=>json_response['total'],'size'=>json_response['data'].size,'max'=>(json_response['max'] || options[:max]),'offset'=>(json_response['offset'] || options[:offset] || 0)}})
1077
1074
  end
1075
+ print reset, "\n"
1076
+ return 0
1077
+
1078
1078
  rescue RestClient::Exception => e
1079
1079
  print_rest_exception(e, options)
1080
1080
  exit 1
@@ -511,6 +511,7 @@ class Morpheus::Cli::LibraryContainerTypesCommand
511
511
  end
512
512
 
513
513
  def remove(args)
514
+ layout_id = nil
514
515
  options = {}
515
516
  optparse = Morpheus::Cli::OptionParser.new do|opts|
516
517
  opts.banner = subcommand_usage("[name]")
@@ -525,7 +526,7 @@ class Morpheus::Cli::LibraryContainerTypesCommand
525
526
  connect(options)
526
527
 
527
528
  begin
528
- container_type = find_container_type_by_name_or_id(layout_id, id)
529
+ container_type = find_container_type_by_name_or_id(layout_id, args[0])
529
530
  if container_type.nil?
530
531
  return 1
531
532
  end
@@ -196,20 +196,23 @@ class Morpheus::Cli::LibraryOptionListsCommand
196
196
 
197
197
  connect(options)
198
198
  begin
199
+ passed_options = options[:options].reject {|k,v| k.is_a?(Symbol) }
199
200
  payload = nil
200
201
  if options[:payload]
201
202
  payload = options[:payload]
202
203
  # support -O OPTION switch on top of --payload
203
- if options[:options]
204
+ if !passed_options.empty?
204
205
  payload['optionTypeList'] ||= {}
205
- payload['optionTypeList'].deep_merge!(options[:options].reject {|k,v| k.is_a?(Symbol) })
206
+ payload['optionTypeList'].deep_merge!(passed_options)
206
207
  end
207
208
  else
208
209
  if !list_type
209
210
  v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'type', 'fieldLabel' => 'Type', 'type' => 'select', 'selectOptions' => get_available_option_list_types, 'defaultValue' => 'rest', 'required' => true}], options[:options], @api_client, {})
210
211
  list_type = v_prompt['type']
211
212
  end
212
- params = Morpheus::Cli::OptionTypes.prompt(new_option_type_list_option_types(list_type), options[:options], @api_client, options[:params])
213
+ params = passed_options
214
+ v_prompt = Morpheus::Cli::OptionTypes.prompt(new_option_type_list_option_types(list_type), options[:options], @api_client, options[:params])
215
+ params.deep_merge!(v_prompt)
213
216
  params['type'] = list_type
214
217
  if params['type'] == 'rest'
215
218
  # prompt for Source Headers
@@ -259,20 +262,22 @@ class Morpheus::Cli::LibraryOptionListsCommand
259
262
  begin
260
263
  option_type_list = find_option_type_list_by_name_or_id(args[0])
261
264
  exit 1 if option_type_list.nil?
262
-
265
+ passed_options = options[:options].reject {|k,v| k.is_a?(Symbol) }
263
266
  payload = nil
264
267
  if options[:payload]
265
268
  payload = options[:payload]
266
269
  # support -O OPTION switch on top of --payload
267
- if options[:options]
270
+ if !passed_options.empty?
268
271
  payload['optionTypeList'] ||= {}
269
- payload['optionTypeList'].deep_merge!(options[:options].reject {|k,v| k.is_a?(Symbol) })
272
+ payload['optionTypeList'].deep_merge!(passed_options)
270
273
  end
271
274
  else
272
275
  list_type = option_type_list['type']
273
276
  prompt_options = update_option_type_list_option_types(list_type)
274
- #params = options[:options] || {}
275
- params = Morpheus::Cli::OptionTypes.no_prompt(prompt_options, options[:options], @api_client, options[:params])
277
+ params = passed_options
278
+ v_prompt = Morpheus::Cli::OptionTypes.no_prompt(prompt_options, options[:options], @api_client, options[:params])
279
+ params.deep_merge!(v_prompt)
280
+
276
281
  if list_type == 'rest'
277
282
  # parse Source Headers
278
283
  source_headers = prompt_source_headers(options.merge({no_prompt: true}))