some bugs squashed

This commit is contained in:
deflax 2016-03-31 20:47:21 +03:00
parent 1f405f7990
commit 24eb11bef3
2 changed files with 5 additions and 8 deletions

View file

@ -27,7 +27,7 @@ def addclient(vmid, vmname, clientid, clientname, clientemail, vmpass):
vcard = { 'name':str(clientname), 'email':str(clientemail), 'encpasswd':str(encpasswd) } vcard = { 'name':str(clientname), 'email':str(clientemail), 'encpasswd':str(encpasswd) }
newclient = { str(clientid):vcard } newclient = { str(clientid):vcard }
clientsdb.update(newclient) clientsdb.update(newclient)
#TODO: 1. Send initial email to the user as we wont use the internal auth from now on. #TODO: 1. Send initial email to the user as we will use the internal auth from now on.
#TODO: 2. Sync with proxmaster-admin database (shell command could be used for this one) #TODO: 2. Sync with proxmaster-admin database (shell command could be used for this one)
ioconfig.logger.info('client[{}]> vmid {} is now owned by {} ({})'.format(clientemail, vmid, clientid, clientname)) ioconfig.logger.info('client[{}]> vmid {} is now owned by {} ({})'.format(clientemail, vmid, clientid, clientname))
@ -45,12 +45,11 @@ def setencpasswd(clientemail, newpass):
try: try:
clientsdb = readclientsdb() clientsdb = readclientsdb()
#print(clientsdb)
path = utils.get_path(clientsdb, clientemail) path = utils.get_path(clientsdb, clientemail)
#print(path)
c_id = str(path[0]) c_id = str(path[0])
#check the returned path with forward query #check the returned path with forward query
query = clientsdb[c_id]['email'] query = clientsdb[c_id]['email']
ioconfig.logger.info('client[{}]> found. path={}'.format(clientemail, str(path)))
except: except:
raise raise
@ -59,7 +58,7 @@ def setencpasswd(clientemail, newpass):
raise raise
else: else:
clientsdb[c_id]['encpasswd'] = encpasswd clientsdb[c_id]['encpasswd'] = encpasswd
ioconfig.logger.info('client[{}]> got its management password changed!'.format(clientemail)) ioconfig.logger.info('client[{}]> password changed!'.format(clientemail))
writeclientsdb(clientsdb) writeclientsdb(clientsdb)
#TODO: Send new email to the client to notify the password change. This time sending the password in plain text is not needed. #TODO: Send new email to the client to notify the password change. This time sending the password in plain text is not needed.
@ -106,9 +105,7 @@ def clientvms(vmlist):
response = [] response = []
for vmid,data in vmlist.items(): for vmid,data in vmlist.items():
print(vmid) response = { str(vmid):data }
print(data)
response = { 'vmid':vmid }
return response return response

View file

@ -342,7 +342,7 @@ def query_vm(req_vmid):
logger.error('vm[{}]> type is unknown!'.format(vm_id)) logger.error('vm[{}]> type is unknown!'.format(vm_id))
raise raise
logger.info('vm[{}]> type {} found. path=region={} found.'.format(target, vm_type, str(path))) logger.info('vm[{}]> type {} found. path={} '.format(target, vm_type, str(path)))
return slave_id, vm_type return slave_id, vm_type