Skip to content

Commit 0326c6c

Browse files
committed
Allow submission of tenantName, required for compatiblity with non-rackspace installs
1 parent 4ed8a55 commit 0326c6c

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

lib/openstack.inc

100644100755
Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,6 @@ class OpenStack extends \OpenCloud\Base {
113113
$overlimit_timeout=RAXSDK_OVERLIMIT_TIMEOUT;
114114

115115
private
116-
$template = <<<ENDAUTHTEMPLATE
117-
{
118-
"auth": {
119-
"passwordCredentials": {
120-
"username":"%s",
121-
"password":"%s"
122-
}
123-
}
124-
}
125-
ENDAUTHTEMPLATE
126-
,
127116
$_user_write_progress_callback_func,
128117
$_user_read_progress_callback_func,
129118
/**
@@ -261,11 +250,25 @@ ENDAUTHTEMPLATE
261250
*/
262251
public function Credentials() {
263252
if (isset($this->secret['username']) &&
264-
isset($this->secret['password']))
265-
return sprintf(
266-
$this->template,
267-
$this->secret['username'],
268-
$this->secret['password']);
253+
isset($this->secret['password']))
254+
{
255+
$credentials =
256+
array( 'auth' =>
257+
array( 'passwordCredentials' =>
258+
array(
259+
'username' => $this->secret['username'],
260+
'password'=>$this->secret['password']
261+
)
262+
)
263+
);
264+
265+
if (isset($this->secret['tenantName']))
266+
{
267+
$credentials['auth']['tenantName'] = $this->secret['tenantName'];
268+
}
269+
270+
return json_encode($credentials);
271+
}
269272
else
270273
throw new CredentialError(
271274
_('Unrecognized credential secret'));

0 commit comments

Comments
 (0)