Skip to content

Commit

Permalink
Allow submission of tenantName, required for compatiblity with non-ra…
Browse files Browse the repository at this point in the history
…ckspace installs
  • Loading branch information
devicenull committed Feb 6, 2013
1 parent 4ed8a55 commit 0326c6c
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions lib/openstack.inc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,6 @@ class OpenStack extends \OpenCloud\Base {
$overlimit_timeout=RAXSDK_OVERLIMIT_TIMEOUT;

private
$template = <<<ENDAUTHTEMPLATE
{
"auth": {
"passwordCredentials": {
"username":"%s",
"password":"%s"
}
}
}
ENDAUTHTEMPLATE
,
$_user_write_progress_callback_func,
$_user_read_progress_callback_func,
/**
Expand Down Expand Up @@ -261,11 +250,25 @@ ENDAUTHTEMPLATE
*/
public function Credentials() {
if (isset($this->secret['username']) &&
isset($this->secret['password']))
return sprintf(
$this->template,
$this->secret['username'],
$this->secret['password']);
isset($this->secret['password']))
{
$credentials =
array( 'auth' =>
array( 'passwordCredentials' =>
array(
'username' => $this->secret['username'],
'password'=>$this->secret['password']
)
)
);

if (isset($this->secret['tenantName']))
{
$credentials['auth']['tenantName'] = $this->secret['tenantName'];
}

return json_encode($credentials);
}
else
throw new CredentialError(
_('Unrecognized credential secret'));
Expand Down

0 comments on commit 0326c6c

Please sign in to comment.