Merge pull request #229 from Modulos/fix_create_user
Fix _get_or_create_user
This commit is contained in:
commit
987bf7ae2e
1 changed files with 3 additions and 2 deletions
|
@ -72,7 +72,6 @@ class OpenNebulaManager:
|
||||||
|
|
||||||
def _get_or_create_user(self, email, password):
|
def _get_or_create_user(self, email, password):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
user_pool = oca.UserPool(self.oneadmin_client)
|
user_pool = oca.UserPool(self.oneadmin_client)
|
||||||
user_pool.info()
|
user_pool.info()
|
||||||
opennebula_user = user_pool.get_by_name(email)
|
opennebula_user = user_pool.get_by_name(email)
|
||||||
|
@ -80,12 +79,14 @@ class OpenNebulaManager:
|
||||||
except WrongNameError as wrong_name_err:
|
except WrongNameError as wrong_name_err:
|
||||||
# TODO: Store this password so that we can use it later to
|
# TODO: Store this password so that we can use it later to
|
||||||
# connect to opennebula
|
# 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(
|
logger.debug(
|
||||||
"User {0} does not exist. Created the user. User id = {1}",
|
"User {0} does not exist. Created the user. User id = {1}",
|
||||||
email,
|
email,
|
||||||
opennebula_user
|
opennebula_user
|
||||||
)
|
)
|
||||||
|
return opennebula_user
|
||||||
except OpenNebulaException as err:
|
except OpenNebulaException as err:
|
||||||
logger.error("Error : {0}".format(err))
|
logger.error("Error : {0}".format(err))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue