mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Bug #4286: Renamed vCenter headers to avoid web server dropping
This commit is contained in:
parent
0a9496cbc2
commit
85d265cad7
@ -67,9 +67,9 @@ define(function(require) {
|
||||
data: {timeout: false},
|
||||
dataType: "json",
|
||||
headers: {
|
||||
"X_VCENTER_USER": opts.vcenter_user,
|
||||
"X_VCENTER_PASSWORD": opts.vcenter_password,
|
||||
"X_VCENTER_HOST": opts.vcenter_host
|
||||
"X-VCENTER-USER": opts.vcenter_user,
|
||||
"X-VCENTER-PASSWORD": opts.vcenter_password,
|
||||
"X-VCENTER-HOST": opts.vcenter_host
|
||||
},
|
||||
success: function(response){
|
||||
$(".vcenter_datacenter_list", context).html("");
|
||||
|
@ -68,9 +68,9 @@ define(function(require) {
|
||||
data: {timeout: false},
|
||||
dataType: "json",
|
||||
headers: {
|
||||
"X_VCENTER_USER": opts.vcenter_user,
|
||||
"X_VCENTER_PASSWORD": opts.vcenter_password,
|
||||
"X_VCENTER_HOST": opts.vcenter_host
|
||||
"X-VCENTER-USER": opts.vcenter_user,
|
||||
"X-VCENTER-PASSWORD": opts.vcenter_password,
|
||||
"X-VCENTER-HOST": opts.vcenter_host
|
||||
},
|
||||
success: function(response){
|
||||
$(".vcenter_datacenter_list", context).html("");
|
||||
|
@ -70,9 +70,9 @@ define(function(require) {
|
||||
data: {timeout: false},
|
||||
dataType: "json",
|
||||
headers: {
|
||||
"X_VCENTER_USER": opts.vcenter_user,
|
||||
"X_VCENTER_PASSWORD": opts.vcenter_password,
|
||||
"X_VCENTER_HOST": opts.vcenter_host
|
||||
"X-VCENTER-USER": opts.vcenter_user,
|
||||
"X-VCENTER-PASSWORD": opts.vcenter_password,
|
||||
"X-VCENTER-HOST": opts.vcenter_host
|
||||
},
|
||||
success: function(response) {
|
||||
$(".vcenter_datacenter_list", context).html("");
|
||||
|
@ -67,9 +67,9 @@ define(function(require) {
|
||||
data: {timeout: false},
|
||||
dataType: "json",
|
||||
headers: {
|
||||
"X_VCENTER_USER": opts.vcenter_user,
|
||||
"X_VCENTER_PASSWORD": opts.vcenter_password,
|
||||
"X_VCENTER_HOST": opts.vcenter_host
|
||||
"X-VCENTER-USER": opts.vcenter_user,
|
||||
"X-VCENTER-PASSWORD": opts.vcenter_password,
|
||||
"X-VCENTER-HOST": opts.vcenter_host
|
||||
},
|
||||
success: function(response) {
|
||||
$(".vcenter_datacenter_list", context).html("");
|
||||
|
@ -68,9 +68,9 @@ define(function(require) {
|
||||
data: {timeout: false},
|
||||
dataType: "json",
|
||||
headers: {
|
||||
"X_VCENTER_USER": opts.vcenter_user,
|
||||
"X_VCENTER_PASSWORD": opts.vcenter_password,
|
||||
"X_VCENTER_HOST": opts.vcenter_host
|
||||
"X-VCENTER-USER": opts.vcenter_user,
|
||||
"X-VCENTER-PASSWORD": opts.vcenter_password,
|
||||
"X-VCENTER-HOST": opts.vcenter_host
|
||||
},
|
||||
success: function(response){
|
||||
$(".vcenter_datacenter_list", context).html("");
|
||||
|
@ -27,16 +27,28 @@ require 'vcenter_driver'
|
||||
|
||||
helpers do
|
||||
def vcenter_client
|
||||
hpref = "HTTP_"
|
||||
head_user = "X_VCENTER_USER"
|
||||
head_pwd = "X_VCENTER_PASSWORD"
|
||||
head_vhost = "X_VCENTER_HOST"
|
||||
hpref = "HTTP-"
|
||||
head_user = "X-VCENTER-USER"
|
||||
head_pwd = "X-VCENTER-PASSWORD"
|
||||
head_vhost = "X-VCENTER-HOST"
|
||||
reqenv = request.env
|
||||
|
||||
vuser = reqenv[head_user] ? reqenv[head_user] : reqenv[hpref+head_user]
|
||||
vpass = reqenv[head_pwd] ? reqenv[head_pwd] : reqenv[hpref+head_pwd]
|
||||
vhost = reqenv[head_vhost] ? reqenv[head_vhost] : reqenv[hpref+head_vhost]
|
||||
|
||||
# Try with underscores
|
||||
if vuser.nil? || vpass.nil? || vhost.nil?
|
||||
hpref = "HTTP_"
|
||||
head_user = "X_VCENTER_USER"
|
||||
head_pwd = "X_VCENTER_PASSWORD"
|
||||
head_vhost = "X_VCENTER_HOST"
|
||||
|
||||
vuser = reqenv[head_user] ? reqenv[head_user] : reqenv[hpref+head_user]
|
||||
vpass = reqenv[head_pwd] ? reqenv[head_pwd] : reqenv[hpref+head_pwd]
|
||||
vhost = reqenv[head_vhost] ? reqenv[head_vhost] : reqenv[hpref+head_vhost]
|
||||
end
|
||||
|
||||
if vuser.nil? || vpass.nil? || vhost.nil?
|
||||
msg = "You have to provide the vCenter username, password and hostname"
|
||||
logger.error("[vCenter] " + msg)
|
||||
|
Loading…
x
Reference in New Issue
Block a user