def __init__(self, api,caller=None):
self.name = self.__class__.__name__
self.api = api
- self.api.admin_shell = NovaShell()
self.api.client_shell = None
if caller:
def authenticate(self, auth):
# establish nova connection
- self.api.client_shell = NovaShell(user=auth['Username'],
+ self.api.client_shell = NovaShell(username=auth['Username'],
password=auth['AuthString'],
tenant=auth['Tenant'])
self.api.client_shell.authenticate()
- self.caller = Person(self.api, object=self.api.client_shell.keystone.users.find(name=auth['Username']))
+ persons = Persons(self.api, {'email': auth['Username']})
+ if not persons:
+ raise PLCAuthenticationFailure, "Username not found"
+ self.caller = persons[0]
+ keystone_user = self.api.client_shell.keystone.users.find(id=self.caller['keystone_id'])
self.caller_tenant = self.api.client_shell.keystone.tenants.find(name=auth['Tenant'])
caller_roles = self.api.client_shell.keystone.roles.roles_for_user(self.caller, self.caller_tenant)
role_names = [role.name for role in caller_roles]