lib/app42/base/util.rb in app42-0.5.10 vs lib/app42/base/util.rb in app42-0.6.0
- old
+ new
@@ -298,11 +298,11 @@
end
# Check whether +uploadbackup+ path is valid OR not
# predefined extension are allowed only like .sql, .zip, .dump etc
def validate_upload_backup_path path
- if path.include?('.zip') || path.include?('.sql') || path.include?('.tar.gz') || path.include?('.gzip') || path.include?('.dump')
+ if path.include?('.zip') || path.include?('.sql') || path.include?('.tar.gz') || path.include?('.gzip') || path.include?('.dump') || path.include?('.rdb')
return path
else
message "Please provide valid file.", true, 'red'
return false
end
@@ -401,9 +401,53 @@
message "#{Message::GIT_URL_NOT_VALID}", true, 'red'
return false
else
return git_url
end
+ end
+
+ # Get flavour for upgrade
+ def get_flavour_upgrade 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']}
+
+ 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']}
+
+ 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
+
+ flavour_id = nil
+ flavour_hash.each_pair{|fl| flavour_id = fl[0] if fl[1] == flavour}
+ return flavour_id
end
end
end
end
\ No newline at end of file