1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-12 09:17:41 +03:00

L #-: Lint fixes for vcenter support.rb

This commit is contained in:
Tino Vazquez 2019-11-19 15:56:17 +01:00
parent 8834d29c67
commit 03b4312be4
No known key found for this signature in database
GPG Key ID: 2FE9C32E94AEABBE

View File

@ -253,16 +253,17 @@ get '/support/check/version' do
$conf[:one_version_time] = 0 if $conf[:one_version_time].nil?
$conf[:one_last_version] = '0' if $conf[:one_last_version].nil?
def returnRoute(version,httpCode=200)
return [httpCode, JSON.pretty_generate(:version => version )]
def return_route(version, http_code = 200)
[http_code, JSON.pretty_generate(:version => version)]
end
find = 'release-'
validate_time = Time.now.to_i - $conf[:one_version_time]
if validate_time < 86400
return returnRoute($conf[:one_last_version])
return return_route($conf[:one_last_version])
end
begin
http = Curl.get(GITHUB_TAGS_URL) do |request|
if !$conf[:proxy].nil? && !$conf[:proxy].empty?
@ -271,7 +272,7 @@ get '/support/check/version' do
request.headers['User-Agent'] = 'OpenNebula Version Validation'
end
rescue StandardError
return returnRoute(0, 400)
return return_route(0, 400)
end
if !http.nil? && http.response_code == 200
@ -294,8 +295,8 @@ get '/support/check/version' do
split_version[1].to_i.even?
if gem_git_version > gem_local_version
$conf[:one_last_version] = git_version
$conf[:one_version_time] = Time.now.to_i
$conf[:one_last_version] = git_version
$conf[:one_version_time] = Time.now.to_i
end
return returnRoute($conf[:one_last_version])
end