Commit 45609571 authored by MARGERY David's avatar MARGERY David
Browse files

Update handling of tls options for kadeploy

parent e4dcae97
......@@ -127,13 +127,12 @@ module Grid5000
def cancel_workflow!
raise "cancel_workflow!" if !user or !base_uri # Ugly hack
http = EM::HttpRequest.new(File.join(base_uri,uid)).delete(
:timeout => 15,
connect_options={:timeout => 15,:tls => tls_options}
http = EM::HttpRequest.new(File.join(base_uri,uid), connect_options).delete(
:head => {
#'Accept' => '*/*',
'X-Remote-Ident' => user,
},
:tls => tls_options
}
)
http.errback{ error("Unable to contact #{File.join(base_uri,uid)}"); raise self.output+"\n" }
......@@ -156,8 +155,8 @@ module Grid5000
case scheme
when 'http','https'
begin
http = EM::HttpRequest.new(environment).get(:timeout=>10,
:tls => tls_options)
connect_options={:timeout => 10,:tls => tls_options}
http = EM::HttpRequest.new(environment, connect_options).get()
params['environment'] = YAML.load(http.response)
params['environment']['kind'] = 'anonymous'
rescue Exception => e
......@@ -171,15 +170,14 @@ module Grid5000
end
Rails.logger.info "Submitting: #{params.inspect}"
http = EM::HttpRequest.new(base_uri).post(
:timeout => 20,
connect_options={:timeout => 20,:tls => tls_options}
http = EM::HttpRequest.new(base_uri, connect_options).post(
:body => params.to_json,
:head => {
'Content-Type' => Mime::Type.lookup_by_extension(:json).to_s,
'Accept' => Mime::Type.lookup_by_extension(:json).to_s,
'X-Remote-Ident' => user,
},
:tls => tls_options
}
)
http.errback{ error("Unable to contact #{base_uri}"); raise self.output+"\n" }
......@@ -195,13 +193,12 @@ module Grid5000
end
def touch!
http = EM::HttpRequest.new(File.join(base_uri,uid)).get(
:timeout => 10,
connect_options={:timeout => 10,:tls => tls_options}
http = EM::HttpRequest.new(File.join(base_uri,uid), connect_options).get(
:head => {
'Accept' => Mime::Type.lookup_by_extension(:json).to_s,
'X-Remote-Ident' => user,
},
:tls => tls_options
}
)
http.errback{ error("Unable to contact #{File.join(base_uri,uid)}"); raise self.output+"\n" }
......@@ -209,13 +206,12 @@ module Grid5000
item = JSON.parse(http.response)
unless item['error']
http = EM::HttpRequest.new(File.join(base_uri,uid,'state')).get(
:timeout => 15,
connect_options={:timeout => 15,:tls => tls_options}
http = EM::HttpRequest.new(File.join(base_uri,uid,'state'), connect_options).get(
:head => {
'Accept' => Mime::Type.lookup_by_extension(:json).to_s,
'X-Remote-Ident' => user,
},
:tls => tls_options
}
)
http.errback{ error("Unable to contact #{File.join(base_uri,uid,'state')}"); raise self.output+"\n" }
res = JSON.parse(http.response)
......@@ -225,13 +221,12 @@ module Grid5000
end
self.result = res
else
http = EM::HttpRequest.new(File.join(base_uri,uid,'error')).get(
:timeout => 15,
connect_options={:timeout => 15,:tls => tls_options}
http = EM::HttpRequest.new(File.join(base_uri,uid,'error'), connect_options).get(
:head => {
#'Accept' => '*/*',
'X-Remote-Ident' => user,
},
:tls => tls_options
}
)
error(get_kaerror(http.response,http.response_header))
http.errback{ error("Unable to contact #{File.join(base_uri,uid,'error')}"); raise self.output+"\n" }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment