diff options
-rw-r--r-- | components/congress/test-webapp/setup/install_congress_testserver.sh | 1 | ||||
-rw-r--r-- | components/congress/test-webapp/www/proxy/index.php | 10 |
2 files changed, 8 insertions, 3 deletions
diff --git a/components/congress/test-webapp/setup/install_congress_testserver.sh b/components/congress/test-webapp/setup/install_congress_testserver.sh index 78c0256..cd09e87 100644 --- a/components/congress/test-webapp/setup/install_congress_testserver.sh +++ b/components/congress/test-webapp/setup/install_congress_testserver.sh @@ -92,6 +92,7 @@ echo "Point proxy.php to the Congress server" sed -i -- "s/CONGRESS_HOST/$CONGRESS_HOST/g" /tmp/copper/copper/components/congress/test-webapp/www/proxy/index.php echo "Add parameters for API authentication" sed -i -- "s/KEYSTONE_HOST/$KEYSTONE_HOST/g" /tmp/copper/copper/components/congress/test-webapp/www/proxy/index.php +sed -i -- "s/OS_TENANT_NAME/$OS_TENANT_NAME/g" /tmp/copper/copper/components/congress/test-webapp/www/proxy/index.php sed -i -- "s/OS_USERNAME/$OS_USERNAME/g" /tmp/copper/copper/components/congress/test-webapp/www/proxy/index.php sed -i -- "s/OS_PASSWORD/$OS_PASSWORD/g" /tmp/copper/copper/components/congress/test-webapp/www/proxy/index.php diff --git a/components/congress/test-webapp/www/proxy/index.php b/components/congress/test-webapp/www/proxy/index.php index af86f1a..39d54d3 100644 --- a/components/congress/test-webapp/www/proxy/index.php +++ b/components/congress/test-webapp/www/proxy/index.php @@ -23,8 +23,12 @@ if ($method == 'OPTIONS') { exit(); } -$token = file_get_contents("/tmp/os_token"); -if ($token === false) { + +if (file_exists("/tmp/os_token")) { + $token = file_get_contents("/tmp/os_token"); + file_put_contents("/tmp/".date('ymd').".log", "proxy.php, auth token=".$token."\n",FILE_APPEND); +} +else { $url = "http://KEYSTONE_HOST:5000/v2.0/tokens"; $curlop = curl_init(); curl_setopt($curlop, CURLOPT_URL, $url); @@ -33,7 +37,7 @@ if ($token === false) { curl_setopt($curlop, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curlop, CURLINFO_HEADER_OUT, true); curl_setopt($curlop, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); - $body = '{"auth": {"passwordCredentials": {"username": "OS_USERNAME", "password": "OS_PASSWORD"}}}'; + $body = '{"auth": {"tenantName": "OS_TENANT_NAME", "passwordCredentials": {"username": "OS_USERNAME", "password": "OS_PASSWORD"}}}'; curl_setopt($curlop, CURLOPT_POSTFIELDS, $body); $req_time=time(); $result = file_put_contents("/tmp/".date('ymd').".log", "proxy.php, ".$req_time.", ".$url.", ".$type.", ".$body."\n",FILE_APPEND); |