From: Tony Mack Date: Fri, 16 Nov 2012 17:19:28 +0000 (-0500) Subject: handle difference between plc userbane and nova/keystone username X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=c32a96c371cc4b0bbba23430e2f9c6180af0b48a;p=plcapi.git handle difference between plc userbane and nova/keystone username --- diff --git a/PLC/Method.py b/PLC/Method.py index 23edff64..60f08716 100644 --- a/PLC/Method.py +++ b/PLC/Method.py @@ -320,7 +320,8 @@ w def authenticate(self, auth): # establish nova connection - self.api.client_shell = NovaShell(username=auth['Username'], + keystone_name = auth['Username'][:auth['Username'].index('@')] + self.api.client_shell = NovaShell(username=keystone_name, password=auth['AuthString'], tenant=auth['Tenant']) self.api.client_shell.authenticate() diff --git a/PLC/NovaShell.py b/PLC/NovaShell.py index 68940ad0..ae444ac0 100644 --- a/PLC/NovaShell.py +++ b/PLC/NovaShell.py @@ -26,7 +26,7 @@ class Client: if config: config = Config(config) else: - config = Config() + config = Config() self.username = config.nova_admin_user self.password = config.nova_admin_password self.tenant = config.nova_admin_tenant @@ -39,7 +39,10 @@ class Client: if tenant: self.tenant = tenant if url: - self.url = url + self.url = url + + if '@' in self.username: + self.username = self.username[:self.username.index('@')] class KeystoneClient(Client): def __init__(self, *args, **kwds):