diff --git a/src/sunstone/public/app/utils/vcenter/clusters.js b/src/sunstone/public/app/utils/vcenter/clusters.js index 9d0954c483..5d36ba4580 100644 --- a/src/sunstone/public/app/utils/vcenter/clusters.js +++ b/src/sunstone/public/app/utils/vcenter/clusters.js @@ -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(""); diff --git a/src/sunstone/public/app/utils/vcenter/datastores.js b/src/sunstone/public/app/utils/vcenter/datastores.js index 7232a3bbd8..e2e801010f 100644 --- a/src/sunstone/public/app/utils/vcenter/datastores.js +++ b/src/sunstone/public/app/utils/vcenter/datastores.js @@ -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(""); diff --git a/src/sunstone/public/app/utils/vcenter/images.js b/src/sunstone/public/app/utils/vcenter/images.js index eef98b48ff..137a639c90 100644 --- a/src/sunstone/public/app/utils/vcenter/images.js +++ b/src/sunstone/public/app/utils/vcenter/images.js @@ -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(""); diff --git a/src/sunstone/public/app/utils/vcenter/networks.js b/src/sunstone/public/app/utils/vcenter/networks.js index ec71e6fe5b..4a159c4796 100644 --- a/src/sunstone/public/app/utils/vcenter/networks.js +++ b/src/sunstone/public/app/utils/vcenter/networks.js @@ -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(""); diff --git a/src/sunstone/public/app/utils/vcenter/templates.js b/src/sunstone/public/app/utils/vcenter/templates.js index 75d262ec10..0b71ff9cc2 100644 --- a/src/sunstone/public/app/utils/vcenter/templates.js +++ b/src/sunstone/public/app/utils/vcenter/templates.js @@ -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(""); diff --git a/src/sunstone/routes/vcenter.rb b/src/sunstone/routes/vcenter.rb index 090da656c8..f144878124 100644 --- a/src/sunstone/routes/vcenter.rb +++ b/src/sunstone/routes/vcenter.rb @@ -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)