From c32a96c371cc4b0bbba23430e2f9c6180af0b48a Mon Sep 17 00:00:00 2001 From: Tony Mack <tmack@paris.CS.Princeton.EDU> Date: Fri, 16 Nov 2012 12:19:28 -0500 Subject: [PATCH] handle difference between plc userbane and nova/keystone username --- PLC/Method.py | 3 ++- PLC/NovaShell.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) 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): -- 2.47.0