handle difference between plc userbane and nova/keystone username
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Fri, 16 Nov 2012 17:19:28 +0000 (12:19 -0500)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Fri, 16 Nov 2012 17:19:28 +0000 (12:19 -0500)
PLC/Method.py
PLC/NovaShell.py

index 23edff6..60f0871 100644 (file)
@@ -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()
index 68940ad..ae444ac 100644 (file)
@@ -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):