dealing with passwords
This commit is contained in:
parent
9cebb7f7c0
commit
e64f9806bb
2 changed files with 7 additions and 4 deletions
|
@ -9,9 +9,10 @@ import json
|
|||
import ioconfig
|
||||
import utils
|
||||
|
||||
def addclient(vmid, vmname, clientid, clientname):
|
||||
def addclient(vmid, vmname, clientid, clientname, srvuser, srvpass):
|
||||
""" add new client to the clientsdb.json """
|
||||
clientsdb = readclientsdb()
|
||||
|
||||
if str(clientid) in clientsdb:
|
||||
ioconfig.logger.info('clients> client ' + clientid + ' already exists. merging.')
|
||||
else:
|
||||
|
@ -19,10 +20,10 @@ def addclient(vmid, vmname, clientid, clientname):
|
|||
vcard = { 'name':str(clientname) }
|
||||
newclient = { str(clientid):vcard }
|
||||
clientsdb.update(newclient)
|
||||
|
||||
ioconfig.logger.info('clients> vmid ' + vmid + ' will be owned by ' + clientid + ' (' + clientname + ')')
|
||||
vmdata = { 'name':str(vmname), 'vmid':str(vmid), 'ownerid':str(clientid) }
|
||||
vmdata = { 'name':str(vmname), 'vmid':str(vmid), 'ownerid':str(clientid), 'username':str(srvuser), 'password': str(srvpass) }
|
||||
clientsdb[str(clientid)][str(vmid)] = vmdata
|
||||
|
||||
writeclientsdb(clientsdb)
|
||||
|
||||
|
||||
|
|
|
@ -119,7 +119,9 @@ def vmcreate(req):
|
|||
#populate the client db and vm journal
|
||||
client_id = req['clientid']
|
||||
client_name = req['clientname']
|
||||
clientsdb.addclient(vm_id, vm_name, client_id, client_name)
|
||||
srv_user = req['username']
|
||||
srv_pass = req['password']
|
||||
clientsdb.addclient(vm_id, vm_name, client_id, client_name, srv_user, srv_pass)
|
||||
journaldb.createjnode(vm_id, region_id, slave_id)
|
||||
|
||||
#start the machihe
|
||||
|
|
Loading…
Reference in a new issue