Module: Morpheus::Cli::ProvisioningHelper
- Included in:
- AppTemplates, Apps, Hosts, Instances
- Defined in:
- lib/morpheus/cli/mixins/provisioning_helper.rb
Overview
Provides common methods for provisioning instances
Class Method Summary collapse
Instance Method Summary collapse
- #api_client ⇒ Object
- #find_cloud_by_id_for_provisioning(group_id, val) ⇒ Object
- #find_cloud_by_name_for_provisioning(group_id, val) ⇒ Object
- #find_cloud_by_name_or_id_for_provisioning(group_id, val) ⇒ Object
- #find_group_by_id_for_provisioning(val) ⇒ Object
- #find_group_by_name_for_provisioning(val) ⇒ Object
- #find_group_by_name_or_id_for_provisioning(val) ⇒ Object
- #find_instance_by_id(id) ⇒ Object
- #find_instance_by_name(name) ⇒ Object
- #find_instance_by_name_or_id(val) ⇒ Object
- #find_instance_type_by_code(code) ⇒ Object
- #find_instance_type_by_name(name) ⇒ Object
- #get_available_clouds(group_id, refresh = false) ⇒ Object
- #get_available_groups(refresh = false) ⇒ Object
- #instance_context_options ⇒ Object
- #instance_types_interface ⇒ Object
- #instances_interface ⇒ Object
- #options_interface ⇒ Object
-
#prompt_evars(options = {}) ⇒ Object
Prompts user for environment variables for new instance returns array of evar objects null, name: “VAR”, value: “somevalue”.
-
#prompt_network_interfaces(zone_id, provision_type_id, options = {}) ⇒ Object
This recreates the behavior of multi_networks.js This is used by both ‘instances add` and `hosts add` returns array of networkInterfaces based on provision type and cloud settings.
-
#prompt_new_instance(options = {}) ⇒ Object
prompts user for all the configuartion options for a particular instance returns payload of data for a new instance.
-
#prompt_resize_volumes(current_volumes, plan_info, options = {}) ⇒ Object
This recreates the behavior of multi_disk.js returns array of volumes based on service plan options (plan_info).
-
#prompt_volumes(plan_info, options = {}, api_client = nil, api_params = {}) ⇒ Object
This recreates the behavior of multi_disk.js returns array of volumes based on service plan options (plan_info).
-
#reject_networking_option_types(option_types) ⇒ Object
reject old networking option types these will eventually get removed from the associated optionTypes.
-
#reject_service_plan_option_types(option_types) ⇒ Object
reject old option types that now come from the selected service plan these will eventually get removed from the associated optionTypes.
-
#reject_volume_option_types(option_types) ⇒ Object
reject old volume option types these will eventually get removed from the associated optionTypes.
Class Method Details
.included(klass) ⇒ Object
7 8 9 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 7 def self.included(klass) klass.send :include, Morpheus::Cli::PrintHelper end |
Instance Method Details
#api_client ⇒ Object
11 12 13 14 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 11 def api_client raise "#{self.class} has not defined @api_client" if @api_client.nil? @api_client end |
#find_cloud_by_id_for_provisioning(group_id, val) ⇒ Object
93 94 95 96 97 98 99 100 101 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 93 def find_cloud_by_id_for_provisioning(group_id, val) clouds = get_available_clouds(group_id) cloud = clouds.find {|it| it["id"].to_s == val.to_s } if !cloud print_red_alert "Cloud not found by id #{val}" exit 1 end return cloud end |
#find_cloud_by_name_for_provisioning(group_id, val) ⇒ Object
103 104 105 106 107 108 109 110 111 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 103 def find_cloud_by_name_for_provisioning(group_id, val) clouds = get_available_clouds(group_id) cloud = clouds.find {|it| it["name"].to_s.downcase == val.to_s.downcase } if !cloud print_red_alert "Cloud not found by name #{val}" exit 1 end return cloud end |
#find_cloud_by_name_or_id_for_provisioning(group_id, val) ⇒ Object
113 114 115 116 117 118 119 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 113 def find_cloud_by_name_or_id_for_provisioning(group_id, val) if val.to_s =~ /\A\d{1,}\Z/ return find_cloud_by_id_for_provisioning(group_id, val) else return find_cloud_by_name_for_provisioning(group_id, val) end end |
#find_group_by_id_for_provisioning(val) ⇒ Object
65 66 67 68 69 70 71 72 73 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 65 def find_group_by_id_for_provisioning(val) groups = get_available_groups() group = groups.find {|it| it["id"].to_s == val.to_s } if !group print_red_alert "Group not found by id #{val}" exit 1 end return group end |
#find_group_by_name_for_provisioning(val) ⇒ Object
75 76 77 78 79 80 81 82 83 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 75 def find_group_by_name_for_provisioning(val) groups = get_available_groups() group = groups.find {|it| it["name"].to_s.downcase == val.to_s.downcase } if !group print_red_alert "Group not found by name #{val}" exit 1 end return group end |
#find_group_by_name_or_id_for_provisioning(val) ⇒ Object
85 86 87 88 89 90 91 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 85 def find_group_by_name_or_id_for_provisioning(val) if val.to_s =~ /\A\d{1,}\Z/ return find_group_by_id_for_provisioning(val) else return find_group_by_name_for_provisioning(val) end end |
#find_instance_by_id(id) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 148 def find_instance_by_id(id) begin json_response = instances_interface.get(id.to_i) return json_response['instance'] rescue RestClient::Exception => e if e.response && e.response.code == 404 print_red_alert "Instance not found by id #{id}" exit 1 else raise e end end end |
#find_instance_by_name(name) ⇒ Object
162 163 164 165 166 167 168 169 170 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 162 def find_instance_by_name(name) json_results = instances_interface.get({name: name.to_s}) if json_results['instances'].empty? print_red_alert "Instance not found by name #{name}" exit 1 end instance = json_results['instances'][0] return instance end |
#find_instance_by_name_or_id(val) ⇒ Object
140 141 142 143 144 145 146 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 140 def find_instance_by_name_or_id(val) if val.to_s =~ /\A\d{1,}\Z/ return find_instance_by_id(val) else return find_instance_by_name(val) end end |
#find_instance_type_by_code(code) ⇒ Object
120 121 122 123 124 125 126 127 128 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 120 def find_instance_type_by_code(code) results = instance_types_interface.get({code: code}) if results['instanceTypes'].empty? print_red_alert "Instance Type not found by code #{code}" # return nil exit 1 end return results['instanceTypes'][0] end |
#find_instance_type_by_name(name) ⇒ Object
130 131 132 133 134 135 136 137 138 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 130 def find_instance_type_by_name(name) results = instance_types_interface.get({name: name}) if results['instanceTypes'].empty? print_red_alert "Instance Type not found by name #{name}" # return nil exit 1 end return results['instanceTypes'][0] end |
#get_available_clouds(group_id, refresh = false) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 45 def get_available_clouds(group_id, refresh=false) if !group_id option_results = .('clouds', {}) return option_results['data'].collect {|it| {"id" => it["value"], "name" => it["name"], "value" => it["value"], "zoneTypeId" => it["zoneTypeId"]} } end group = find_group_by_id_for_provisioning(group_id) if !group return [] end if !group["clouds"] || refresh option_results = .('clouds', {groupId: group_id}) group["clouds"] = option_results['data'].collect {|it| {"id" => it["value"], "name" => it["name"], "value" => it["value"], "zoneTypeId" => it["zoneTypeId"]} } end return group["clouds"] end |
#get_available_groups(refresh = false) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 34 def get_available_groups(refresh=false) if !@available_groups || refresh option_results = .('groups',{}) @available_groups = option_results['data'].collect {|it| {"id" => it["value"], "name" => it["name"], "value" => it["value"]} } end #puts "get_available_groups() rtn: #{@available_groups.inspect}" return @available_groups end |
#instance_context_options ⇒ Object
938 939 940 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 938 def [{'name' => 'Dev', 'value' => 'dev'}, {'name' => 'Test', 'value' => 'qa'}, {'name' => 'Staging', 'value' => 'staging'}, {'name' => 'Production', 'value' => 'production'}] end |
#instance_types_interface ⇒ Object
28 29 30 31 32 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 28 def instance_types_interface # @api_client.instance_types raise "#{self.class} has not defined @instance_types_interface" if @instance_types_interface.nil? @instance_types_interface end |
#instances_interface ⇒ Object
16 17 18 19 20 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 16 def instances_interface # @api_client.instances raise "#{self.class} has not defined @instances_interface" if @instances_interface.nil? @instances_interface end |
#options_interface ⇒ Object
22 23 24 25 26 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 22 def # @api_client.options raise "#{self.class} has not defined @options_interface" if @options_interface.nil? @options_interface end |
#prompt_evars(options = {}) ⇒ Object
Prompts user for environment variables for new instance returns array of evar objects null, name: “VAR”, value: “somevalue”
883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 883 def prompt_evars(={}) #puts "Configure Environment Variables:" no_prompt = ([:no_prompt] || ([:options] && [:options][:no_prompt])) evars = [] evar_index = 0 has_another_evar = [:options] && [:options]["evar#{evar_index}"] add_another_evar = has_another_evar || (!no_prompt && Morpheus::Cli::OptionTypes.confirm("Add an environment variable?", {default: false})) while add_another_evar do field_context = "evar#{evar_index}" evar = {} evar['id'] = nil evar_label = evar_index == 0 ? "ENV" : "ENV [#{evar_index+1}]" v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'name', 'type' => 'text', 'fieldLabel' => "#{evar_label} Name", 'required' => true, 'description' => 'Environment Variable Name.', 'defaultValue' => evar['name']}], [:options]) evar['name'] = v_prompt[field_context]['name'] v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'value', 'type' => 'text', 'fieldLabel' => "#{evar_label} Value", 'required' => true, 'description' => 'Environment Variable Value', 'defaultValue' => evar['value']}], [:options]) evar['value'] = v_prompt[field_context]['value'] evars << evar evar_index += 1 has_another_evar = [:options] && [:options]["evar#{evar_index}"] add_another_evar = has_another_evar || (!no_prompt && Morpheus::Cli::OptionTypes.confirm("Add another environment variable?", {default: false})) end return evars end |
#prompt_network_interfaces(zone_id, provision_type_id, options = {}) ⇒ Object
This recreates the behavior of multi_networks.js This is used by both ‘instances add` and `hosts add` returns array of networkInterfaces based on provision type and cloud settings
787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 787 def prompt_network_interfaces(zone_id, provision_type_id, ={}) #puts "Configure Networks:" no_prompt = ([:no_prompt] || ([:options] && [:options][:no_prompt])) network_interfaces = [] = api_client..('zoneNetworkOptions', {zoneId: zone_id, provisionTypeId: provision_type_id}) # puts "zoneNetworkOptions JSON" # puts JSON.pretty_generate(zone_network_options_json) zone_network_data = ['data'] || {} networks = zone_network_data['networks'] network_interface_types = (zone_network_data['networkTypes'] || []).sort { |x,y| x['displayOrder'] <=> y['displayOrder'] } enable_network_type_selection = (zone_network_data['enableNetworkTypeSelection'] == 'on' || zone_network_data['enableNetworkTypeSelection'] == true) has_networks = zone_network_data["hasNetworks"] == true max_networks = zone_network_data["maxNetworks"] ? zone_network_data["maxNetworks"].to_i : nil # skip unless provision type supports networks if !has_networks return nil end # no networks available, shouldn't happen if networks.empty? return network_interfaces end = [] networks.each do |opt| if !opt.nil? << {'name' => opt['name'], 'value' => opt['id']} end end = [] network_interface_types.each do |opt| if !opt.nil? << {'name' => opt['name'], 'value' => opt['id']} end end interface_index = 1 add_another_interface = true while add_another_interface do # if !no_prompt # if interface_index == 1 # puts "Configure Network Interface" # else # puts "Configure Network Interface #{interface_index}" # end # end field_context = interface_index == 1 ? "networkInterface" : "networkInterface#{interface_index}" network_interface = {} # choose network v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'networkId', 'type' => 'select', 'fieldLabel' => "Network", 'selectOptions' => , 'required' => true, 'skipSingleOption' => false, 'description' => 'Choose a network for this interface.', 'defaultValue' => network_interface['networkId']}], [:options]) network_interface['network'] = {} network_interface['network']['id'] = v_prompt[field_context]['networkId'].to_i selected_network = networks.find {|it| it["id"] == network_interface['network']['id'] } # if !selected_network # print_red_alert "Network not found by id #{network_interface['network']['id']}!" # exit 1 # end # choose network interface type if enable_network_type_selection && !.empty? v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'networkInterfaceTypeId', 'type' => 'select', 'fieldLabel' => "Network Interface Type", 'selectOptions' => , 'required' => true, 'skipSingleOption' => true, 'description' => 'Choose a network interface type.', 'defaultValue' => network_interface['networkInterfaceTypeId']}], [:options]) network_interface['networkInterfaceTypeId'] = v_prompt[field_context]['networkInterfaceTypeId'].to_i end # choose IP unless network has a pool configured if selected_network['pool'] puts "IP Address: Using pool '#{selected_network['pool']['name']}'" if !no_prompt elsif selected_network['dhcpServer'] puts "IP Address: Using DHCP" if !no_prompt else v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'ipAddress', 'type' => 'text', 'fieldLabel' => "IP Address", 'required' => true, 'description' => 'Enter an IP for this network interface. x.x.x.x', 'defaultValue' => network_interface['ipAddress']}], [:options]) network_interface['ipAddress'] = v_prompt[field_context]['ipAddress'] end network_interfaces << network_interface interface_index += 1 has_another_interface = [:options] && [:options]["networkInterface#{interface_index}"] add_another_interface = has_another_interface || (!no_prompt && Morpheus::Cli::OptionTypes.confirm("Add another network interface?", {:default => false})) if max_networks && network_interfaces.size >= max_networks add_another_interface = false end end return network_interfaces end |
#prompt_new_instance(options = {}) ⇒ Object
prompts user for all the configuartion options for a particular instance returns payload of data for a new instance
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 174 def prompt_new_instance(={}) # Group group_id = nil group = [:group] ? find_group_by_name_or_id_for_provisioning([:group]) : nil if group group_id = group["id"] else # print_red_alert "Group not found or specified!" # exit 1 group_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'group', 'type' => 'select', 'fieldLabel' => 'Group', 'selectOptions' => get_available_groups(), 'required' => true, 'description' => 'Select Group.'}],[:options],api_client,{}) group_id = group_prompt['group'] end # Cloud cloud_id = nil cloud = [:cloud] ? find_cloud_by_name_or_id_for_provisioning(group_id, [:cloud]) : nil if cloud cloud_id = cloud["id"] else # print_red_alert "Cloud not specified!" # exit 1 cloud_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'cloud', 'type' => 'select', 'fieldLabel' => 'Cloud', 'selectOptions' => get_available_clouds(group_id), 'required' => true, 'description' => 'Select Cloud.'}],[:options],api_client,{groupId: group_id}) cloud_id = cloud_prompt['cloud'] end # Instance Type instance_type_code = nil if [:instance_type_code] instance_type_code = [:instance_type_code] else instance_type_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'type', 'type' => 'select', 'fieldLabel' => 'Type', 'optionSource' => 'instanceTypes', 'required' => true, 'description' => 'Select Instance Type.'}],[:options],api_client,{groupId: group_id}) instance_type_code = instance_type_prompt['type'] end instance_type = find_instance_type_by_code(instance_type_code) # Instance Name instance_name = nil if [:instance_name] instance_name = [:instance_name] else name_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'name', 'fieldLabel' => 'Instance Name', 'type' => 'text', 'required' => [:name_required]}], [:options]) instance_name = name_prompt['name'] || '' end payload = { :zoneId => cloud_id, :instance => { :name => instance_name, :site => { :id => group_id }, :instanceType => { :code => instance_type_code } } } # Description v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text', 'required' => false}], [:options]) payload[:instance][:description] = v_prompt['description'] if !v_prompt['description'].empty? # Environment v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'instanceContext', 'fieldLabel' => 'Environment', 'type' => 'select', 'required' => false, 'selectOptions' => ()}], [:options]) payload[:instance][:instanceContext] = v_prompt['instanceContext'] if !v_prompt['instanceContext'].empty? # Tags v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'tags', 'fieldLabel' => 'Tags', 'type' => 'text', 'required' => false}], [:options]) payload[:instance][:tags] = v_prompt['tags'].split(',').collect {|it| it.to_s.strip }.compact.uniq if !v_prompt['tags'].empty? # Version and Layout version_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'version', 'type' => 'select', 'fieldLabel' => 'Version', 'optionSource' => 'instanceVersions', 'required' => true, 'skipSingleOption' => true, 'description' => 'Select which version of the instance type to be provisioned.'}],[:options],api_client,{groupId: group_id, cloudId: cloud_id, instanceTypeId: instance_type['id']}) layout_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'layout', 'type' => 'select', 'fieldLabel' => 'Layout', 'optionSource' => 'layoutsForCloud', 'required' => true, 'description' => 'Select which configuration of the instance type to be provisioned.'}],[:options],api_client,{groupId: group_id, cloudId: cloud_id, instanceTypeId: instance_type['id'], version: version_prompt['version']}) layout_id = layout_prompt['layout'] layout = instance_type['instanceTypeLayouts'].find{ |lt| lt['id'] == layout_id.to_i} payload[:instance][:layout] = {id: layout['id']} # prompt for service plan service_plans_json = @instances_interface.service_plans({zoneId: cloud_id, layoutId: layout_id}) service_plans = service_plans_json["plans"] service_plans_dropdown = service_plans.collect {|sp| {'name' => sp["name"], 'value' => sp["id"]} } # already sorted plan_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'servicePlan', 'type' => 'select', 'fieldLabel' => 'Plan', 'selectOptions' => service_plans_dropdown, 'required' => true, 'description' => 'Choose the appropriately sized plan for this instance'}],[:options]) service_plan = service_plans.find {|sp| sp["id"] == plan_prompt['servicePlan'].to_i } # todo: pick one of these three, let's go with the last one... #payload[:servicePlan] = service_plan["id"] # pre-2.10 appliances payload[:instance][:plan] = {id: service_plan["id"]} # prompt for volumes volumes = prompt_volumes(service_plan, , api_client, {}) if !volumes.empty? payload[:volumes] = volumes end if layout["provisionType"] && layout["provisionType"]["id"] && layout["provisionType"]["hasNetworks"] # prompt for network interfaces (if supported) begin network_interfaces = prompt_network_interfaces(cloud_id, layout["provisionType"]["id"], ) if !network_interfaces.empty? payload[:networkInterfaces] = network_interfaces end rescue RestClient::Exception => e print_yellow_warning "Unable to load network options. Proceeding..." print_rest_exception(e, ) if Morpheus::Logging.debug? end end type_payload = {} if !layout['optionTypes'].nil? && !layout['optionTypes'].empty? type_payload = Morpheus::Cli::OptionTypes.prompt(layout['optionTypes'],[:options],api_client,{groupId: group_id, cloudId: cloud_id, zoneId: cloud_id, instanceTypeId: instance_type['id'], version: version_prompt['version']}) elsif !instance_type['optionTypes'].nil? && !instance_type['optionTypes'].empty? type_payload = Morpheus::Cli::OptionTypes.prompt(instance_type['optionTypes'],[:options],api_client,{groupId: group_id, cloudId: cloud_id, zoneId: cloud_id, instanceTypeId: instance_type['id'], version: version_prompt['version']}) end if !type_payload['config'].nil? payload.merge!(type_payload['config']) end provision_payload = {} if !layout['provisionType'].nil? && !layout['provisionType']['optionTypes'].nil? && !layout['provisionType']['optionTypes'].empty? instance_type_option_types = layout['provisionType']['optionTypes'] # remove volume options if volumes were configured if !payload[:volumes].empty? instance_type_option_types = reject_volume_option_types(instance_type_option_types) end # remove networkId option if networks were configured above if !payload[:networkInterfaces].empty? instance_type_option_types = reject_networking_option_types(instance_type_option_types) end provision_payload = Morpheus::Cli::OptionTypes.prompt(instance_type_option_types,[:options],api_client,{groupId: group_id, cloudId: cloud_id, zoneId: cloud_id, instanceTypeId: instance_type['id'], version: version_prompt['version']}) end payload[:config] = provision_payload['config'] || {} if provision_payload['server'] payload[:server] = provision_payload['server'] || {} end # prompt for environment variables evars = prompt_evars() if !evars.empty? payload[:evars] = evars end return payload end |
#prompt_resize_volumes(current_volumes, plan_info, options = {}) ⇒ Object
This recreates the behavior of multi_disk.js returns array of volumes based on service plan options (plan_info)
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 509 def prompt_resize_volumes(current_volumes, plan_info, ={}) #puts "Configure Volumes:" no_prompt = ([:no_prompt] || ([:options] && [:options][:no_prompt])) current_root_volume = current_volumes[0] volumes = [] plan_size = nil if plan_info['maxStorage'] plan_size = plan_info['maxStorage'].to_i / (1024 * 1024 * 1024) end root_storage_types = [] if plan_info['rootStorageTypes'] plan_info['rootStorageTypes'].each do |opt| if !opt.nil? root_storage_types << {'name' => opt['name'], 'value' => opt['id']} end end end storage_types = [] if plan_info['storageTypes'] plan_info['storageTypes'].each do |opt| if !opt.nil? storage_types << {'name' => opt['name'], 'value' => opt['id']} end end end = [] if plan_info['supportsAutoDatastore'] if plan_info['autoOptions'] plan_info['autoOptions'].each do |opt| if !opt.nil? << {'name' => opt['name'], 'value' => opt['id']} end end end end if plan_info['datastores'] plan_info['datastores'].each do |k, v| v.each do |opt| if !opt.nil? << {'name' => "#{k}: #{opt['name']}", 'value' => opt['id']} end end end end #puts "Configure Root Volume" field_context = "rootVolume" if root_storage_types.empty? # this means there's no configuration, just send a single root volume to the server storage_type_id = nil storage_type = nil else #v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'storageType', 'type' => 'select', 'fieldLabel' => 'Root Storage Type', 'selectOptions' => root_storage_types, 'required' => true, 'skipSingleOption' => true, 'description' => 'Choose a storage type.'}], options[:options]) #storage_type_id = v_prompt[field_context]['storageType'] storage_type_id = current_root_volume['type'] || current_root_volume['storageType'] storage_type = plan_info['storageTypes'].find {|i| i['id'] == storage_type_id.to_i } end # sometimes the user chooses sizeId from a list of size options (AccountPrice) and other times it is free form = [] if plan_info['rootCustomSizeOptions'] && plan_info['rootCustomSizeOptions'][storage_type_id.to_s] plan_info['rootCustomSizeOptions'][storage_type_id.to_s].each do |opt| if !opt.nil? << {'name' => opt['value'], 'value' => opt['key']} end end end volume = { 'id' => current_root_volume['id'], 'rootVolume' => true, 'name' => current_root_volume['name'], 'size' => current_root_volume['size'] > plan_size ? current_root_volume['size'] : plan_size, 'sizeId' => nil, 'storageType' => storage_type_id, 'datastoreId' => current_root_volume['datastoreId'] } if plan_info['rootDiskCustomizable'] && storage_type && storage_type['customLabel'] 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]) volume['name'] = v_prompt[field_context]['name'] end if plan_info['rootDiskCustomizable'] && storage_type && storage_type['customSize'] if .empty? v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'size', 'type' => 'number', 'fieldLabel' => 'Root Volume Size (GB)', 'required' => true, 'description' => 'Enter a volume size (GB).', 'defaultValue' => volume['size']}], [:options]) volume['size'] = v_prompt[field_context]['size'] volume['sizeId'] = nil #volume.delete('sizeId') else v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'sizeId', 'type' => 'select', 'fieldLabel' => 'Root Volume Size', 'selectOptions' => , 'required' => true, 'description' => 'Choose a volume size.'}], [:options]) volume['sizeId'] = v_prompt[field_context]['sizeId'] volume['size'] = nil #volume.delete('size') end else # might need different logic here ? =o volume['size'] = plan_size volume['sizeId'] = nil #volume.delete('sizeId') end # if !datastore_options.empty? # 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]) # volume['datastoreId'] = v_prompt[field_context]['datastoreId'] # end volumes << volume # modify or delete existing data volumes (1..(current_volumes.size-1)).each do |volume_index| current_volume = current_volumes[volume_index] if current_volume field_context = "dataVolume#{volume_index}" if no_prompt volume_action = 'keep' else = [{'name' => 'Modify', 'value' => 'modify'}, {'name' => 'Keep', 'value' => 'keep'}, {'name' => 'Delete', 'value' => 'delete'}] v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'action', 'type' => 'select', 'fieldLabel' => "Modify/Keep/Delete volume '#{current_volume['name']}'", 'selectOptions' => , 'required' => true, 'description' => 'Modify, Keep or Delete existing data volume?'}], [:options]) volume_action = v_prompt[field_context]['action'] end if volume_action == 'delete' # deleted volume is just excluded from post params next elsif volume_action == 'keep' volume = { 'id' => current_volume['id'].to_i, 'rootVolume' => false, 'name' => current_volume['name'], 'size' => current_volume['size'] > plan_size ? current_volume['size'] : plan_size, 'sizeId' => nil, 'storageType' => (current_volume['type'] || current_volume['storageType']), 'datastoreId' => current_volume['datastoreId'] } volumes << volume else # 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]) # storage_type_id = v_prompt[field_context]['storageType'] storage_type_id = current_volume['type'] || current_volume['storageType'] storage_type = plan_info['storageTypes'].find {|i| i['id'] == storage_type_id.to_i } # sometimes the user chooses sizeId from a list of size options (AccountPrice) and other times it is free form = [] if plan_info['customSizeOptions'] && plan_info['customSizeOptions'][storage_type_id.to_s] plan_info['customSizeOptions'][storage_type_id.to_s].each do |opt| if !opt.nil? << {'name' => opt['value'], 'value' => opt['key']} end end end volume = { 'id' => current_volume['id'].to_i, 'rootVolume' => false, 'name' => current_volume['name'], 'size' => current_volume['size'] > plan_size ? current_volume['size'] : plan_size, 'sizeId' => nil, 'storageType' => (current_volume['type'] || current_volume['storageType']), 'datastoreId' => current_volume['datastoreId'] } if plan_info['customizeVolume'] && storage_type['customLabel'] 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]) volume['name'] = v_prompt[field_context]['name'] end if plan_info['customizeVolume'] && storage_type['customSize'] if .empty? v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'size', 'type' => 'number', 'fieldLabel' => "Disk #{volume_index} Volume Size (GB)", 'required' => true, 'description' => 'Enter a volume size (GB).', 'defaultValue' => volume['size']}], [:options]) volume['size'] = v_prompt[field_context]['size'] volume['sizeId'] = nil #volume.delete('sizeId') else v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'sizeId', 'type' => 'select', 'fieldLabel' => "Disk #{volume_index} Volume Size", 'selectOptions' => , 'required' => true, 'description' => 'Choose a volume size.'}], [:options]) volume['sizeId'] = v_prompt[field_context]['sizeId'] volume['size'] = nil #volume.delete('size') end else # might need different logic here ? =o volume['size'] = plan_size volume['sizeId'] = nil #volume.delete('sizeId') end # if !datastore_options.empty? # 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]) # volume['datastoreId'] = v_prompt[field_context]['datastoreId'] # end volumes << volume end end end if plan_info['addVolumes'] volume_index = current_volumes.size has_another_volume = [:options] && [:options]["dataVolume#{volume_index}"] add_another_volume = has_another_volume || (!no_prompt && Morpheus::Cli::OptionTypes.confirm("Add data volume?")) while add_another_volume do #puts "Configure Data #{volume_index} Volume" field_context = "dataVolume#{volume_index}" 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]) storage_type_id = v_prompt[field_context]['storageType'] storage_type = plan_info['storageTypes'].find {|i| i['id'] == storage_type_id.to_i } # sometimes the user chooses sizeId from a list of size options (AccountPrice) and other times it is free form = [] if plan_info['customSizeOptions'] && plan_info['customSizeOptions'][storage_type_id.to_s] plan_info['customSizeOptions'][storage_type_id.to_s].each do |opt| if !opt.nil? << {'name' => opt['value'], 'value' => opt['key']} end end end volume_label = (volume_index == 1 ? 'data' : "data #{volume_index}") volume = { 'id' => -1, 'rootVolume' => false, 'name' => volume_label, 'size' => plan_size, 'sizeId' => nil, 'storageType' => storage_type_id, 'datastoreId' => nil } if plan_info['customizeVolume'] && storage_type['customLabel'] 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_label}], [:options]) volume['name'] = v_prompt[field_context]['name'] end if plan_info['customizeVolume'] && storage_type['customSize'] if .empty? v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'size', 'type' => 'number', 'fieldLabel' => "Disk #{volume_index} Volume Size (GB)", 'required' => true, 'description' => 'Enter a volume size (GB).', 'defaultValue' => plan_size}], [:options]) volume['size'] = v_prompt[field_context]['size'] volume['sizeId'] = nil #volume.delete('sizeId') else v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'sizeId', 'type' => 'select', 'fieldLabel' => "Disk #{volume_index} Volume Size", 'selectOptions' => , 'required' => true, 'description' => 'Choose a volume size.'}], [:options]) volume['sizeId'] = v_prompt[field_context]['sizeId'] volume['size'] = nil #volume.delete('size') end else # might need different logic here ? =o volume['size'] = plan_size volume['sizeId'] = nil #volume.delete('sizeId') end if !.empty? v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'datastoreId', 'type' => 'select', 'fieldLabel' => "Disk #{volume_index} Datastore", 'selectOptions' => , 'required' => true, 'description' => 'Choose a datastore.'}], [:options]) volume['datastoreId'] = v_prompt[field_context]['datastoreId'] end volumes << volume # todo: should maxDisk check consider the root volume too? if plan_info['maxDisk'] && volume_index >= plan_info['maxDisk'] add_another_volume = false else volume_index += 1 has_another_volume = [:options] && [:options]["dataVolume#{volume_index}"] add_another_volume = has_another_volume || (!no_prompt && Morpheus::Cli::OptionTypes.confirm("Add another data volume?")) end end end return volumes end |
#prompt_volumes(plan_info, options = {}, api_client = nil, api_params = {}) ⇒ Object
This recreates the behavior of multi_disk.js returns array of volumes based on service plan options (plan_info)
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 320 def prompt_volumes(plan_info, ={}, api_client=nil, api_params={}) #puts "Configure Volumes:" no_prompt = ([:no_prompt] || ([:options] && [:options][:no_prompt])) volumes = [] plan_size = nil if plan_info['maxStorage'] plan_size = plan_info['maxStorage'].to_i / (1024 * 1024 * 1024) end root_storage_types = [] if plan_info['rootStorageTypes'] plan_info['rootStorageTypes'].each do |opt| if !opt.nil? root_storage_types << {'name' => opt['name'], 'value' => opt['id']} end end end storage_types = [] if plan_info['storageTypes'] plan_info['storageTypes'].each do |opt| if !opt.nil? storage_types << {'name' => opt['name'], 'value' => opt['id']} end end end = [] if plan_info['supportsAutoDatastore'] if plan_info['autoOptions'] plan_info['autoOptions'].each do |opt| if !opt.nil? << {'name' => opt['name'], 'value' => opt['id']} end end end end if plan_info['datastores'] plan_info['datastores'].each do |k, v| v.each do |opt| if !opt.nil? << {'name' => "#{k}: #{opt['name']}", 'value' => opt['id']} end end end end #puts "Configure Root Volume" field_context = "rootVolume" if root_storage_types.empty? # this means there's no configuration, just send a single root volume to the server storage_type_id = nil storage_type = nil else v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'storageType', 'type' => 'select', 'fieldLabel' => 'Root Storage Type', 'selectOptions' => root_storage_types, 'required' => true, 'skipSingleOption' => true, 'description' => 'Choose a storage type.'}], [:options]) storage_type_id = v_prompt[field_context]['storageType'] storage_type = plan_info['storageTypes'].find {|i| i['id'] == storage_type_id.to_i } end # sometimes the user chooses sizeId from a list of size options (AccountPrice) and other times it is free form = [] if plan_info['rootCustomSizeOptions'] && plan_info['rootCustomSizeOptions'][storage_type_id.to_s] plan_info['rootCustomSizeOptions'][storage_type_id.to_s].each do |opt| if !opt.nil? << {'name' => opt['value'], 'value' => opt['key']} end end end volume_label = 'root' volume = { 'id' => -1, 'rootVolume' => true, 'name' => volume_label, 'size' => plan_size, 'sizeId' => nil, 'storageType' => storage_type_id, 'datastoreId' => nil } if plan_info['rootDiskCustomizable'] && storage_type && storage_type['customLabel'] 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_label}], [:options]) volume['name'] = v_prompt[field_context]['name'] end if plan_info['rootDiskCustomizable'] && storage_type && storage_type['customSize'] if .empty? v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'size', 'type' => 'number', 'fieldLabel' => 'Root Volume Size (GB)', 'required' => true, 'description' => 'Enter a volume size (GB).', 'defaultValue' => plan_size}], [:options]) volume['size'] = v_prompt[field_context]['size'] volume['sizeId'] = nil #volume.delete('sizeId') else v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'sizeId', 'type' => 'select', 'fieldLabel' => 'Root Volume Size', 'selectOptions' => , 'required' => true, 'description' => 'Choose a volume size.'}], [:options]) volume['sizeId'] = v_prompt[field_context]['sizeId'] volume['size'] = nil #volume.delete('size') end else # might need different logic here ? =o volume['size'] = plan_size volume['sizeId'] = nil #volume.delete('sizeId') end if !.empty? v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'datastoreId', 'type' => 'select', 'fieldLabel' => 'Root Datastore', 'selectOptions' => , 'required' => true, 'description' => 'Choose a datastore.'}], [:options]) volume['datastoreId'] = v_prompt[field_context]['datastoreId'] end volumes << volume if plan_info['addVolumes'] volume_index = 1 has_another_volume = [:options] && [:options]["dataVolume#{volume_index}"] add_another_volume = has_another_volume || (!no_prompt && Morpheus::Cli::OptionTypes.confirm("Add data volume?", {:default => false})) while add_another_volume do #puts "Configure Data #{volume_index} Volume" field_context = "dataVolume#{volume_index}" 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]) storage_type_id = v_prompt[field_context]['storageType'] storage_type = plan_info['storageTypes'].find {|i| i['id'] == storage_type_id.to_i } # sometimes the user chooses sizeId from a list of size options (AccountPrice) and other times it is free form = [] if plan_info['customSizeOptions'] && plan_info['customSizeOptions'][storage_type_id.to_s] plan_info['customSizeOptions'][storage_type_id.to_s].each do |opt| if !opt.nil? << {'name' => opt['value'], 'value' => opt['key']} end end end volume_label = (volume_index == 1 ? 'data' : "data #{volume_index}") volume = { 'id' => -1, 'rootVolume' => false, 'name' => volume_label, 'size' => plan_size, 'sizeId' => nil, 'storageType' => storage_type_id, 'datastoreId' => nil } if plan_info['customizeVolume'] && storage_type['customLabel'] 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_label}], [:options]) volume['name'] = v_prompt[field_context]['name'] end if plan_info['customizeVolume'] && storage_type['customSize'] if .empty? v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'size', 'type' => 'number', 'fieldLabel' => "Disk #{volume_index} Volume Size (GB)", 'required' => true, 'description' => 'Enter a volume size (GB).', 'defaultValue' => plan_size}], [:options]) volume['size'] = v_prompt[field_context]['size'] volume['sizeId'] = nil #volume.delete('sizeId') else v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'sizeId', 'type' => 'select', 'fieldLabel' => "Disk #{volume_index} Volume Size", 'selectOptions' => , 'required' => true, 'description' => 'Choose a volume size.'}], [:options]) volume['sizeId'] = v_prompt[field_context]['sizeId'] volume['size'] = nil #volume.delete('size') end else # might need different logic here ? =o volume['size'] = plan_size volume['sizeId'] = nil #volume.delete('sizeId') end if !.empty? v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'datastoreId', 'type' => 'select', 'fieldLabel' => "Disk #{volume_index} Datastore", 'selectOptions' => , 'required' => true, 'description' => 'Choose a datastore.'}], [:options]) volume['datastoreId'] = v_prompt[field_context]['datastoreId'] end volumes << volume # todo: should maxDisk check consider the root volume too? if plan_info['maxDisk'] && volume_index >= plan_info['maxDisk'] add_another_volume = false else volume_index += 1 has_another_volume = [:options] && [:options]["dataVolume#{volume_index}"] add_another_volume = has_another_volume || (!no_prompt && Morpheus::Cli::OptionTypes.confirm("Add another data volume?", {:default => false})) end end end return volumes end |
#reject_networking_option_types(option_types) ⇒ Object
reject old networking option types these will eventually get removed from the associated optionTypes
921 922 923 924 925 926 927 928 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 921 def reject_networking_option_types(option_types) option_types.reject {|opt| ['networkId', 'networkType', 'ipAddress', 'netmask', 'gateway', 'nameservers', 'vmwareNetworkType', 'vmwareIpAddress', 'vmwareNetmask', 'vmwareGateway', 'vmwareNameservers', 'subnetId' ].include?(opt['fieldName']) } end |
#reject_service_plan_option_types(option_types) ⇒ Object
reject old option types that now come from the selected service plan these will eventually get removed from the associated optionTypes
932 933 934 935 936 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 932 def reject_service_plan_option_types(option_types) option_types.reject {|opt| ['cpuCount', 'memorySize', 'memory'].include?(opt['fieldName']) } end |
#reject_volume_option_types(option_types) ⇒ Object
reject old volume option types these will eventually get removed from the associated optionTypes
910 911 912 913 914 915 916 917 |
# File 'lib/morpheus/cli/mixins/provisioning_helper.rb', line 910 def reject_volume_option_types(option_types) option_types.reject {|opt| ['osDiskSize', 'osDiskType', 'diskSize', 'diskType', 'datastoreId', 'storagePodId' ].include?(opt['fieldName']) } end |