lib/app42/base/util.rb in app42-0.6.1 vs lib/app42/base/util.rb in app42-0.6.2

- old
+ new

@@ -418,50 +418,32 @@ return git_url end end # Get flavour for upgrade - def get_flavour_upgrade setup_name + def get_flavour_for_upgrade_or_downgrade setup_name, type flavour_hash = {} - flavour_type = App42::Command::Config.new.get_flavour_type_fm_server + flavour_type = App42::Command::Config.new.get_flavour_type_fm_server_for_upgrade_or_downgrade setup_name, type flavour_type['flavours'].select {|each_flavour| flavour_hash["#{each_flavour['id']}"] = each_flavour['name']} - query_params = params - query_params.store('setupName', setup_name) - wordpress_info = build_get_request query_params, 'setup', "#{setup_name}" - - flavour_hash.delete 'light' if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE.first - ['light','medium'].each{|f| flavour_hash.delete f} if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE[1] - message "#{Message::HIGHLY_CONF}", true, 'red' if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE[2] - exit! if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE[2] - flavour = input "Select Flavour", flavour_hash.values, true flavour_id = nil flavour_hash.each_pair{|fl| flavour_id = fl[0] if fl[1] == flavour} return flavour_id end - # Get flavour for downgrade - def get_flavour_downgrade setup_name - flavour_hash = {} - flavour_type = App42::Command::Config.new.get_flavour_type_fm_server - flavour_type['flavours'].select {|each_flavour| flavour_hash["#{each_flavour['id']}"] = each_flavour['name']} + # Get instance configuration + def get_instance_config_for_upgrade_or_downgrade iaas, vm_type, setup_name, type + instance_config_hash = {} + instance_config_type = App42::Command::Config.new.get_instance_config_for_upgrade_or_downgrade iaas, vm_type, setup_name, type + instance_config_type['IMList'].select {|each_instance_config| instance_config_hash["#{each_instance_config['id']}"] = each_instance_config['name']} + instance_config = input "Select Instance Configuration", instance_config_hash.values, true - query_params = params - query_params.store('setupName', setup_name) - wordpress_info = build_get_request query_params, 'setup', "#{setup_name}" - - message "#{Message::LOW_CONF}", true, 'red' if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE.first - exit! if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE.first - ['heavy','medium'].each{|f| flavour_hash.delete f} if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE[1] - ['heavy'].each{|f| flavour_hash.delete f} if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE[2] - - flavour = input "Select Flavour", flavour_hash.values, true + instance_config_id = nil + instance_config_hash.each_pair{|ic| instance_config_id = ic[0] if ic[1] == instance_config} - flavour_id = nil - flavour_hash.each_pair{|fl| flavour_id = fl[0] if fl[1] == flavour} - return flavour_id + return instance_config_id end end end end \ No newline at end of file