From 76a023f7f9e86dfe3aa1b81a4bbfadcba03b7533 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 23 Mar 2018 16:52:03 +0100 Subject: [PATCH 1/5] feat(password):added method to set password --- .../VirtualMachineHandler.py | 22 +- .../VirtualMachineServer.py | 1 + .../VirtualMachineService-remote | 9 +- .../VirtualMachineService.py | 226 ++++++++++++++++-- gen-py/VirtualMachineService/ttypes.py | 52 ++-- 5 files changed, 266 insertions(+), 44 deletions(-) diff --git a/gen-py/VirtualMachineService/VirtualMachineHandler.py b/gen-py/VirtualMachineService/VirtualMachineHandler.py index da5602cc..1e581cac 100644 --- a/gen-py/VirtualMachineService/VirtualMachineHandler.py +++ b/gen-py/VirtualMachineService/VirtualMachineHandler.py @@ -2,6 +2,9 @@ from ttypes import * from constants import VERSION from openstack import connection +from keystoneauth1.identity import v3 +from keystoneauth1 import session +from keystoneclient.v3 import client import urllib import os @@ -64,9 +67,22 @@ def __init__(self): self.JUMPHOST_BASE= cfg['openstack_connection']['jumphost_base'] self.JUMPHOST_IP= cfg['openstack_connection']['jumphost_ip'] - self.conn = self.create_connection() - - + #self.conn = self.create_connection() + + def setUserPassword(self, user, password): + auth=v3.Password(auth_url=self.AUTH_URL,username=self.USERNAME,password=self.PASSWORD,project_name=self.PROJECT_NAME,user_domain_id='default',project_domain_id='default') + + + sess=session.Session(auth=auth) + def findUser(keystone,name): + users=keystone.users.list() + for user in users: + if user.__dict__['name'] == name: + return user + keystone= client.Client(session=sess) + user=findUser(keystone,user) + keystone.users.update(user,password=password) + return password def get_Flavors(self): self.logger.info("Get Flavors") flavors = list() diff --git a/gen-py/VirtualMachineService/VirtualMachineServer.py b/gen-py/VirtualMachineService/VirtualMachineServer.py index 7f4adb10..9e9d9235 100644 --- a/gen-py/VirtualMachineService/VirtualMachineServer.py +++ b/gen-py/VirtualMachineService/VirtualMachineServer.py @@ -24,3 +24,4 @@ server = TServer.TSimpleServer(processor, transport, tfactory, pfactory) server.serve() + diff --git a/gen-py/VirtualMachineService/VirtualMachineService-remote b/gen-py/VirtualMachineService/VirtualMachineService-remote index 2481bdfa..eadc1209 100755 --- a/gen-py/VirtualMachineService/VirtualMachineService-remote +++ b/gen-py/VirtualMachineService/VirtualMachineService-remote @@ -24,6 +24,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]') print('') print('Functions:') + print(' string setUserPassword(string user, string password)') print(' bool check_Version(double version)') print(' string import_keypair(string keyname, string public_key)') print(' string generate_SSH_Login_String(string servername)') @@ -117,7 +118,13 @@ protocol = TBinaryProtocol(transport) client = VirtualMachineService.Client(protocol) transport.open() -if cmd == 'check_Version': +if cmd == 'setUserPassword': + if len(args) != 2: + print('setUserPassword requires 2 args') + sys.exit(1) + pp.pprint(client.setUserPassword(args[0], args[1],)) + +elif cmd == 'check_Version': if len(args) != 1: print('check_Version requires 1 args') sys.exit(1) diff --git a/gen-py/VirtualMachineService/VirtualMachineService.py b/gen-py/VirtualMachineService/VirtualMachineService.py index 646eb535..1cd0d246 100755 --- a/gen-py/VirtualMachineService/VirtualMachineService.py +++ b/gen-py/VirtualMachineService/VirtualMachineService.py @@ -20,8 +20,21 @@ class Iface(object): This VirtualMachiine service deploys methods for creating,deleting,stopping etc. VirtualMachines in Openstack. """ + def setUserPassword(self, user, password): + """ + Parameters: + - user + - password + """ + pass + def check_Version(self, version): """ + This Method compares the version of the Portal-Client with the Version of the Client from the Cloud-Portal-Client-Connector. + + param: version The Version of the Client from the Connector + + Parameters: - version """ @@ -29,8 +42,8 @@ def check_Version(self, version): def import_keypair(self, keyname, public_key): """ - @ This Method imports a new keypair. + @param version Parameters: - keyname @@ -122,8 +135,7 @@ def create_connection(self, username, password, auth_url, project_name, user_dom def start_server(self, flavor, image, public_key, servername, elixir_id): """ - @ - This Method starts a VirtualMachine. + This Method starts a VirtualMachine . Parameters: - flavor @@ -136,7 +148,7 @@ def start_server(self, flavor, image, public_key, servername, elixir_id): def get_server(self, servername): """ - This Method returns a Server with specific Openstack_ID + This Method returns a VirtualMachine with a specific Name. Parameters: - servername @@ -145,8 +157,7 @@ def get_server(self, servername): def stop_server(self, openstack_id): """ - @ - This Method stops a VirtualMachine. + This Method stops a VirtualMachine with a specific Openstack-ID. Parameters: - openstack_id @@ -156,7 +167,7 @@ def stop_server(self, openstack_id): def resume_server(self, openstack_id): """ @ - This Method unpause a VirtualMachine. + This Method unpause a VirtualMachine with a specific Openstack-ID. Parameters: - openstack_id @@ -175,8 +186,46 @@ def __init__(self, iprot, oprot=None): self._oprot = oprot self._seqid = 0 + def setUserPassword(self, user, password): + """ + Parameters: + - user + - password + """ + self.send_setUserPassword(user, password) + return self.recv_setUserPassword() + + def send_setUserPassword(self, user, password): + self._oprot.writeMessageBegin('setUserPassword', TMessageType.CALL, self._seqid) + args = setUserPassword_args() + args.user = user + args.password = password + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_setUserPassword(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = setUserPassword_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + raise TApplicationException(TApplicationException.MISSING_RESULT, "setUserPassword failed: unknown result") + def check_Version(self, version): """ + This Method compares the version of the Portal-Client with the Version of the Client from the Cloud-Portal-Client-Connector. + + param: version The Version of the Client from the Connector + + Parameters: - version """ @@ -208,8 +257,8 @@ def recv_check_Version(self): def import_keypair(self, keyname, public_key): """ - @ This Method imports a new keypair. + @param version Parameters: - keyname @@ -536,8 +585,7 @@ def recv_create_connection(self): def start_server(self, flavor, image, public_key, servername, elixir_id): """ - @ - This Method starts a VirtualMachine. + This Method starts a VirtualMachine . Parameters: - flavor @@ -592,7 +640,7 @@ def recv_start_server(self): def get_server(self, servername): """ - This Method returns a Server with specific Openstack_ID + This Method returns a VirtualMachine with a specific Name. Parameters: - servername @@ -627,8 +675,7 @@ def recv_get_server(self): def stop_server(self, openstack_id): """ - @ - This Method stops a VirtualMachine. + This Method stops a VirtualMachine with a specific Openstack-ID. Parameters: - openstack_id @@ -664,7 +711,7 @@ def recv_stop_server(self): def resume_server(self, openstack_id): """ @ - This Method unpause a VirtualMachine. + This Method unpause a VirtualMachine with a specific Openstack-ID. Parameters: - openstack_id @@ -702,6 +749,7 @@ class Processor(Iface, TProcessor): def __init__(self, handler): self._handler = handler self._processMap = {} + self._processMap["setUserPassword"] = Processor.process_setUserPassword self._processMap["check_Version"] = Processor.process_check_Version self._processMap["import_keypair"] = Processor.process_import_keypair self._processMap["generate_SSH_Login_String"] = Processor.process_generate_SSH_Login_String @@ -732,6 +780,25 @@ def process(self, iprot, oprot): self._processMap[name](self, seqid, iprot, oprot) return True + def process_setUserPassword(self, seqid, iprot, oprot): + args = setUserPassword_args() + args.read(iprot) + iprot.readMessageEnd() + result = setUserPassword_result() + try: + result.success = self._handler.setUserPassword(args.user, args.password) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("setUserPassword", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + def process_check_Version(self, seqid, iprot, oprot): args = check_Version_args() args.read(iprot) @@ -1049,6 +1116,137 @@ def process_resume_server(self, seqid, iprot, oprot): # HELPER FUNCTIONS AND STRUCTURES +class setUserPassword_args(object): + """ + Attributes: + - user + - password + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'user', 'UTF8', None, ), # 1 + (2, TType.STRING, 'password', 'UTF8', None, ), # 2 + ) + + def __init__(self, user=None, password=None,): + self.user = user + self.password = password + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.user = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.password = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('setUserPassword_args') + if self.user is not None: + oprot.writeFieldBegin('user', TType.STRING, 1) + oprot.writeString(self.user.encode('utf-8') if sys.version_info[0] == 2 else self.user) + oprot.writeFieldEnd() + if self.password is not None: + oprot.writeFieldBegin('password', TType.STRING, 2) + oprot.writeString(self.password.encode('utf-8') if sys.version_info[0] == 2 else self.password) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + +class setUserPassword_result(object): + """ + Attributes: + - success + """ + + thrift_spec = ( + (0, TType.STRING, 'success', 'UTF8', None, ), # 0 + ) + + def __init__(self, success=None,): + self.success = success + + def read(self, iprot): + if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: + iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRING: + self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot._fast_encode is not None and self.thrift_spec is not None: + oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('setUserPassword_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.items()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + + class check_Version_args(object): """ Attributes: diff --git a/gen-py/VirtualMachineService/ttypes.py b/gen-py/VirtualMachineService/ttypes.py index 21f428fe..f9bedc75 100755 --- a/gen-py/VirtualMachineService/ttypes.py +++ b/gen-py/VirtualMachineService/ttypes.py @@ -18,12 +18,12 @@ class Flavor(object): This Struct defines a Flavor. Attributes: - - vcpus - - ram - - disk - - name - - openstack_id - - description + - vcpus: The vcpus of the flavor + - ram: The ram of the flavor + - disk: The disk of the flavor + - name: The name of the flavor + - openstack_id: The openstack_id of the flavor + - description: The description of the flavor """ thrift_spec = ( @@ -150,15 +150,15 @@ class Image(object): This Struct defines an Image. Attributes: - - name - - min_disk - - min_ram - - status - - created_at - - updated_at - - openstack_id - - description - - default_user + - name: The name of the image + - min_disk: The min_diks of the image + - min_ram: The min_ram of the image + - status: The status of the image + - created_at: The creation time of the image + - updated_at: The updated time of the image + - openstack_id: The openstack_id the image + - description: The description of the image + - default_user: The defaut_user of the image """ thrift_spec = ( @@ -318,17 +318,17 @@ class VM(object): This Struct defines a VirtualMachine. Attributes: - - flav - - img - - status - - metadata - - project_id - - keyname - - openstack_id - - name - - created_at - - floating_ip - - fixed_ip + - flav: The flavor of the VM + - img: The image of the VM + - status: The status of the VM + - metadata: The metadata of the VM + - project_id: The project_id of the VM + - keyname: The keyname from the public key of the VM + - openstack_id: The openstack_id of the VM + - name: The name of the VM + - created_at: The the creation time of the VM + - floating_ip: The floating ip of the VM + - fixed_ip: The fixed ips of the VM """ thrift_spec = ( From d3c4c6c94e011e5b2234648b9180b27ba518121d Mon Sep 17 00:00:00 2001 From: root Date: Sat, 24 Mar 2018 17:57:43 +0100 Subject: [PATCH 2/5] fix (handler): some fixes --- .../VirtualMachineHandler.py | 10 +++++++--- .../VirtualMachineService.py | 20 ++++++++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/gen-py/VirtualMachineService/VirtualMachineHandler.py b/gen-py/VirtualMachineService/VirtualMachineHandler.py index 1e581cac..089fa121 100644 --- a/gen-py/VirtualMachineService/VirtualMachineHandler.py +++ b/gen-py/VirtualMachineService/VirtualMachineHandler.py @@ -25,8 +25,9 @@ def create_connection(self): conn = connection.Connection(username=self.USERNAME, password=self.PASSWORD, auth_url=self.AUTH_URL, project_name=self.PROJECT_NAME, user_domain_name=self.USER_DOMAIN_NAME, project_domain_name='default') - conn.authorize() - except Exception: + #conn.authorize() + except Exception as e: + print(e.__str__) self.logger.error('Client failed authentication at Openstack') raise authenticationException(Reason='Client failed authentication at Openstack') @@ -67,9 +68,10 @@ def __init__(self): self.JUMPHOST_BASE= cfg['openstack_connection']['jumphost_base'] self.JUMPHOST_IP= cfg['openstack_connection']['jumphost_ip'] - #self.conn = self.create_connection() + self.conn = self.create_connection() def setUserPassword(self, user, password): + try: auth=v3.Password(auth_url=self.AUTH_URL,username=self.USERNAME,password=self.PASSWORD,project_name=self.PROJECT_NAME,user_domain_id='default',project_domain_id='default') @@ -83,6 +85,8 @@ def findUser(keystone,name): user=findUser(keystone,user) keystone.users.update(user,password=password) return password + except Exception as e: + raise otherException(Reason=str(e)) def get_Flavors(self): self.logger.info("Get Flavors") flavors = list() diff --git a/gen-py/VirtualMachineService/VirtualMachineService.py b/gen-py/VirtualMachineService/VirtualMachineService.py index 1cd0d246..b92630b8 100755 --- a/gen-py/VirtualMachineService/VirtualMachineService.py +++ b/gen-py/VirtualMachineService/VirtualMachineService.py @@ -217,6 +217,8 @@ def recv_setUserPassword(self): iprot.readMessageEnd() if result.success is not None: return result.success + if result.e is not None: + raise result.e raise TApplicationException(TApplicationException.MISSING_RESULT, "setUserPassword failed: unknown result") def check_Version(self, version): @@ -790,6 +792,9 @@ def process_setUserPassword(self, seqid, iprot, oprot): msg_type = TMessageType.REPLY except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): raise + except otherException as e: + msg_type = TMessageType.REPLY + result.e = e except Exception as ex: msg_type = TMessageType.EXCEPTION logging.exception(ex) @@ -1192,14 +1197,17 @@ class setUserPassword_result(object): """ Attributes: - success + - e """ thrift_spec = ( (0, TType.STRING, 'success', 'UTF8', None, ), # 0 + (1, TType.STRUCT, 'e', (otherException, otherException.thrift_spec), None, ), # 1 ) - def __init__(self, success=None,): + def __init__(self, success=None, e=None,): self.success = success + self.e = e def read(self, iprot): if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: @@ -1215,6 +1223,12 @@ def read(self, iprot): self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString() else: iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.e = otherException() + self.e.read(iprot) + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -1229,6 +1243,10 @@ def write(self, oprot): oprot.writeFieldBegin('success', TType.STRING, 0) oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success) oprot.writeFieldEnd() + if self.e is not None: + oprot.writeFieldBegin('e', TType.STRUCT, 1) + self.e.write(oprot) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() From da43732b86c5f046393e322ffde53f9c1371220a Mon Sep 17 00:00:00 2001 From: sgiller Date: Wed, 28 Mar 2018 16:08:38 +0200 Subject: [PATCH 3/5] feat(pass): changed req.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 54b26ddd..73e8025d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ thrift >= 0.10.0,<0.20.0 openstacksdk >= 0.9.19, < 1.0.0 +python-keystoneclient From 7ba8e99b4886995a4006b236958a0de69e430a5e Mon Sep 17 00:00:00 2001 From: root Date: Thu, 5 Apr 2018 10:49:36 +0200 Subject: [PATCH 4/5] feat(password): added tag if client is allowed to set password --- config.yml | 1 + .../VirtualMachineHandler.py | 36 ++++++++++--------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/config.yml b/config.yml index 56c46e79..34a49088 100644 --- a/config.yml +++ b/config.yml @@ -4,6 +4,7 @@ openstack_connection: jumphost_base: 30000 jumphost_ip: 172.21.40.14 use_jumphost: True + set_password: False network: portalnetzwerk floating_ip_network: cebitec certfile: ../../test/keys/server.pem diff --git a/gen-py/VirtualMachineService/VirtualMachineHandler.py b/gen-py/VirtualMachineService/VirtualMachineHandler.py index 089fa121..5fc95461 100644 --- a/gen-py/VirtualMachineService/VirtualMachineHandler.py +++ b/gen-py/VirtualMachineService/VirtualMachineHandler.py @@ -63,6 +63,7 @@ def __init__(self): self.NETWORK = cfg['openstack_connection']['network'] self.FLOATING_IP_NETWORK = cfg['openstack_connection']['floating_ip_network'] self.FLAVOR_FILTER = cfg['openstack_connection']['flavor_filter'] + self.SET_PASSWORD = cfg['openstack_connection']['set_password'] if 'True' == str(self.USE_JUMPHOST): self.JUMPHOST_BASE= cfg['openstack_connection']['jumphost_base'] @@ -71,22 +72,25 @@ def __init__(self): self.conn = self.create_connection() def setUserPassword(self, user, password): - try: - auth=v3.Password(auth_url=self.AUTH_URL,username=self.USERNAME,password=self.PASSWORD,project_name=self.PROJECT_NAME,user_domain_id='default',project_domain_id='default') - - - sess=session.Session(auth=auth) - def findUser(keystone,name): - users=keystone.users.list() - for user in users: - if user.__dict__['name'] == name: - return user - keystone= client.Client(session=sess) - user=findUser(keystone,user) - keystone.users.update(user,password=password) - return password - except Exception as e: - raise otherException(Reason=str(e)) + if self.SET_PASSWORD == 'True': + try: + auth=v3.Password(auth_url=self.AUTH_URL,username=self.USERNAME,password=self.PASSWORD,project_name=self.PROJECT_NAME,user_domain_id='default',project_domain_id='default') + + + sess=session.Session(auth=auth) + def findUser(keystone,name): + users=keystone.users.list() + for user in users: + if user.__dict__['name'] == name: + return user + keystone= client.Client(session=sess) + user=findUser(keystone,user) + keystone.users.update(user,password=password) + return password + except Exception as e: + raise otherException(Reason=str(e)) + else : + return {'Error':'Not allowed'} def get_Flavors(self): self.logger.info("Get Flavors") flavors = list() From c9fd3fde26dc5f7b9dc16cdb589d427887bca8ea Mon Sep 17 00:00:00 2001 From: root Date: Fri, 6 Apr 2018 13:45:11 +0200 Subject: [PATCH 5/5] fix(password):fixed an issue --- .../VirtualMachineService/VirtualMachineHandler.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gen-py/VirtualMachineService/VirtualMachineHandler.py b/gen-py/VirtualMachineService/VirtualMachineHandler.py index 5fc95461..08ef8262 100644 --- a/gen-py/VirtualMachineService/VirtualMachineHandler.py +++ b/gen-py/VirtualMachineService/VirtualMachineHandler.py @@ -71,12 +71,11 @@ def __init__(self): self.conn = self.create_connection() + def setUserPassword(self, user, password): - if self.SET_PASSWORD == 'True': + if str(self.SET_PASSWORD) == 'True': try: auth=v3.Password(auth_url=self.AUTH_URL,username=self.USERNAME,password=self.PASSWORD,project_name=self.PROJECT_NAME,user_domain_id='default',project_domain_id='default') - - sess=session.Session(auth=auth) def findUser(keystone,name): users=keystone.users.list() @@ -88,9 +87,12 @@ def findUser(keystone,name): keystone.users.update(user,password=password) return password except Exception as e: - raise otherException(Reason=str(e)) + self.logger.error("Set Password for user {0} failed : {1}".format(user,str(e))) + return otherException(Reason=str(e)) else : - return {'Error':'Not allowed'} + raise otherException(Reason='Not allowed') + + def get_Flavors(self): self.logger.info("Get Flavors") flavors = list()