morpheus-cli 7.0.6 → 7.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cbee8120b32418f3b60a0b82950f9a3fc1eb2ad2101a905aea6ba6ca4cc67eb
4
- data.tar.gz: 98038ba726c03fa7aeb3af77efdedcb535e6f4506fb26f0ccd5cb70456dd55f2
3
+ metadata.gz: 5e2f97549864e50c22d2a7f9e04ccf0cafb76ed6b833aef1271a8e0003716d90
4
+ data.tar.gz: a8924722ef5ab2feeb455ea7008f9681a374bf5f739a34b15131748371848889
5
5
  SHA512:
6
- metadata.gz: 68c0c1c2c18173314f6d8fe73a184631609ad8b9a55d95bf35a2b797814ba5a65f2037b6638917c5c09640d7e91674a0356825849b04c375c4c88a35b715e5a3
7
- data.tar.gz: 776cc9c571fac5fec546836d4ff6fd06e55c7635c7c63f8ed529e0880c96efa21c2d087fa7baac1bdf90c16b40ef4eaa847c7bc3fcf13c5092d4ebe3afcec303
6
+ metadata.gz: d7fafa4ba44a2c600055b47bc5178c3b667ca238b5080d355c01682679124ee71b12991d5b52bd85958b429ab2747f680e27a47fe1192179b8c5ff417b486035
7
+ data.tar.gz: 50d06718a2b68a42ac4997a1bf6248c0ae4ce9b975747f972bfa4e718b4c6514af31a06a59bc70ad2e1642b8252896ead095b1a93b512f7d7c6d9cc963807c5e
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
1
  FROM ruby:2.7.5
2
2
 
3
- RUN gem install morpheus-cli -v 7.0.6
3
+ RUN gem install morpheus-cli -v 7.0.7
4
4
 
5
5
  ENTRYPOINT ["morpheus"]
@@ -526,12 +526,7 @@ class Morpheus::Cli::Clusters
526
526
  resourceName = options[:resourceName]
527
527
 
528
528
  if !resourceName
529
- if options[:no_prompt]
530
- print_red_alert "No resource name provided"
531
- exit 1
532
- else
533
- resourceName = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'resourceName', 'type' => 'text', 'fieldLabel' => 'Resource Name', 'required' => true, 'description' => 'Resource Name.'}],options[:options],@api_client,{})['resourceName']
534
- end
529
+ resourceName = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'resourceName', 'type' => 'text', 'fieldLabel' => 'Resource Name', 'required' => false, 'description' => 'Resource Name.'}],options[:options],@api_client,{})['resourceName']
535
530
  end
536
531
 
537
532
  server_payload['name'] = resourceName
@@ -594,9 +589,17 @@ class Morpheus::Cli::Clusters
594
589
  # Provision Type
595
590
  provision_type = (layout && layout['provisionType'] ? layout['provisionType'] : nil) || get_provision_type_for_zone_type(cloud['zoneType']['id'])
596
591
  provision_type = @provision_types_interface.get(provision_type['id'])['provisionType'] if !provision_type.nil?
597
-
598
592
  api_params = {zoneId: cloud['id'], siteId: group['id'], layoutId: layout['id'], groupTypeId: cluster_type['id'], provisionType: provision_type['code'], provisionTypeId: provision_type['id']}
599
593
 
594
+ # Service Plan
595
+ service_plan = prompt_service_plan(api_params, options)
596
+ if service_plan
597
+ server_payload['plan'] = {'id' => service_plan['id'], 'code' => service_plan['code']}
598
+ api_params['planId'] = service_plan['id']
599
+ plan_opts = prompt_service_plan_options(service_plan, provision_type, options)
600
+ server_payload['servicePlanOptions'] = plan_opts if plan_opts && !plan_opts.empty?
601
+ end
602
+
600
603
  # Controller type
601
604
  server_types = @server_types_interface.list({computeTypeId: cluster_type['controllerTypes'].first['id'], zoneTypeId: cloud['zoneType']['id'], useZoneProvisionTypes: true})['serverTypes'].reject {|it| it['provisionType']['code'] == 'manual'}
602
605
  controller_provision_type = nil
@@ -613,7 +616,7 @@ class Morpheus::Cli::Clusters
613
616
  end
614
617
  end
615
618
 
616
- if controller_provision_type && resource_pool = prompt_resource_pool(group, cloud, nil, controller_provision_type, options)
619
+ if controller_provision_type && resource_pool = prompt_resource_pool(group, cloud, service_plan, controller_provision_type, options)
617
620
  server_payload['config']['resourcePoolId'] = resource_pool['id']
618
621
  api_params['config'] ||= {}
619
622
  api_params['config']['resourcePool'] = resource_pool['id']
@@ -622,16 +625,6 @@ class Morpheus::Cli::Clusters
622
625
  end
623
626
  end
624
627
 
625
- # Service Plan
626
- service_plan = prompt_service_plan(api_params, options)
627
-
628
- if service_plan
629
- server_payload['plan'] = {'id' => service_plan['id'], 'code' => service_plan['code']}
630
- api_params['planId'] = service_plan['id']
631
- plan_opts = prompt_service_plan_options(service_plan, provision_type, options)
632
- server_payload['servicePlanOptions'] = plan_opts if plan_opts && !plan_opts.empty?
633
- end
634
-
635
628
  # Multi-disk / prompt for volumes
636
629
  if provision_type['hasVolumes']
637
630
  volumes = options[:volumes] || prompt_volumes(service_plan, provision_type, options, @api_client, api_params)
@@ -653,6 +646,8 @@ class Morpheus::Cli::Clusters
653
646
  metadata_option_type = option_type_list.find {|type| type['fieldName'] == 'metadata' }
654
647
  option_type_list = option_type_list.reject {|type| type['fieldName'] == 'metadata' }
655
648
 
649
+ server_count = layout['serverCount']
650
+
656
651
  # KLUDGE: google zone required for network selection
657
652
  if option_type = option_type_list.find {|type| type['code'] == 'computeServerType.googleLinux.googleZoneId'}
658
653
  server_payload.deep_merge!(Morpheus::Cli::OptionTypes.prompt([option_type], options[:options], @api_client, api_params))
@@ -684,6 +679,10 @@ class Morpheus::Cli::Clusters
684
679
  # Layout template options
685
680
  cluster_payload.deep_merge!(Morpheus::Cli::OptionTypes.prompt(load_layout_options(cluster_payload), options[:options], @api_client, api_params, options[:no_prompt], true))
686
681
 
682
+ # Set node count for ssh hosts
683
+ ssh_host_option = option_type_list.select{|it| it['fieldName'] == 'sshHosts'}.first
684
+ ssh_host_option['minCount'] = server_count unless ssh_host_option.nil?
685
+
687
686
  # Server options
688
687
  server_payload.deep_merge!(Morpheus::Cli::OptionTypes.prompt(option_type_list, options[:options].deep_merge({:context_map => {'domain' => ''}}), @api_client, api_params, options[:no_prompt], true))
689
688
 
@@ -729,7 +728,7 @@ class Morpheus::Cli::Clusters
729
728
 
730
729
  # Host / Domain
731
730
  server_payload['networkDomain'] = options[:domain] || Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'networkDomain', 'fieldLabel' => 'Network Domain', 'type' => 'select', 'required' => false, 'optionSource' => 'networkDomains'}], options[:options], @api_client, api_params)['networkDomain']
732
- server_payload['hostname'] = options[:hostname] || Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'hostname', 'fieldLabel' => 'Hostname', 'type' => 'text', 'required' => true, 'description' => 'Hostname', 'defaultValue' => resourceName}], options[:options], @api_client, api_params)['hostname']
731
+ server_payload['hostname'] = options[:hostname] || Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'hostname', 'fieldLabel' => 'Hostname', 'type' => 'text', 'required' => false, 'description' => 'Hostname', 'defaultValue' => resourceName}], options[:options], @api_client, api_params)['hostname']
733
732
 
734
733
  # Kube Default Repo
735
734
  if cluster_payload['type'] == 'kubernetes-cluster'
@@ -16,7 +16,7 @@ class Morpheus::Cli::PluginsCommand
16
16
  params = {}
17
17
  filename = nil
18
18
  optparse = Morpheus::Cli::OptionParser.new do|opts|
19
- opts.banner = subcommand_usage("[name] [file]")
19
+ opts.banner = subcommand_usage("[file]")
20
20
  build_standard_post_options(opts, options)
21
21
  opts.footer = <<-EOT
22
22
  Upload a plugin file.
@@ -55,7 +55,7 @@ EOT
55
55
  params = {}
56
56
  filename = nil
57
57
  optparse = Morpheus::Cli::OptionParser.new do|opts|
58
- opts.banner = subcommand_usage("[name] [file]")
58
+ opts.banner = subcommand_usage("")
59
59
  build_standard_post_options(opts, options)
60
60
  opts.footer = <<-EOT
61
61
  Check for installed plugins that have available updates.
@@ -1324,15 +1324,19 @@ module Morpheus
1324
1324
 
1325
1325
  # supports multi-part fields via config.fields
1326
1326
  # {"fields": [{"name":"tag", "required":true, "label": "Tag"}, {"name":"value", "required":false, "label": "Scope"}]}
1327
+ min_count = option_type['minCount'] || 1
1328
+ count = 0
1329
+
1327
1330
  if option_type['config']['fields']
1328
- while (option_type['required'] && rtn.empty?) || self.confirm("Add#{rtn.empty? ? '': ' more'} #{option_type['fieldLabel']}?", {:default => false})
1331
+ while (option_type['required'] && (rtn.empty? || count < min_count)) || self.confirm("Add#{rtn.empty? ? '': ' more'} #{option_type['fieldLabel']}?", {:default => false})
1329
1332
  rtn ||= []
1330
1333
  value = {}
1331
1334
  option_type['config']['fields'].each do |field|
1332
1335
  field_label = field['label'] || field['name'].capitalize
1333
- value[field['name']] = generic_prompt(option_type.merge({'fieldLabel' => field_label, 'required' => field['required'], 'description' => "#{option_type['fieldLabel']} #{field_label}"}))
1336
+ value[field['name']] = generic_prompt(option_type.merge({'fieldLabel' => min_count > 1 ? "#{field_label} #{count + 1}" : field_label, 'required' => field['required'], 'description' => "#{option_type['fieldLabel']} #{field_label}"}))
1334
1337
  end
1335
1338
  rtn << value
1339
+ count += 1
1336
1340
  end
1337
1341
  else
1338
1342
  if rtn = generic_prompt(option_type)
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "7.0.6"
4
+ VERSION = "7.0.7"
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: 7.0.6
4
+ version: 7.0.7
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: 2024-09-11 00:00:00.000000000 Z
14
+ date: 2024-10-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: public_suffix