From f1ae7e1014abb536e27adfd1607d4fa1c4513354 Mon Sep 17 00:00:00 2001 From: Modulos Date: Tue, 9 May 2017 05:54:10 +0200 Subject: [PATCH] Fix _get_or_create_user --- hosting/opennebula_functions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hosting/opennebula_functions.py b/hosting/opennebula_functions.py index 1d241d59..a00bb037 100644 --- a/hosting/opennebula_functions.py +++ b/hosting/opennebula_functions.py @@ -72,7 +72,6 @@ class OpenNebulaManager: def _get_or_create_user(self, email, password): try: - user_pool = oca.UserPool(self.oneadmin_client) user_pool.info() opennebula_user = user_pool.get_by_name(email) @@ -80,12 +79,14 @@ class OpenNebulaManager: except WrongNameError as wrong_name_err: # TODO: Store this password so that we can use it later to # connect to opennebula - return oca.User.allocate(self.oneadmin_client, email, password) + opennebula_user = self.oneadmin_client.call(oca.User.METHODS['allocate'], email, + password, 'core') logger.debug( "User {0} does not exist. Created the user. User id = {1}", email, opennebula_user ) + return opennebula_user except OpenNebulaException as err: logger.error("Error : {0}".format(err))