1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 03:54:15 +00:00

Fixed PEP8

This commit is contained in:
Retspen 2015-06-08 22:45:56 +03:00
parent 2a5618ca2e
commit 5714f0945a

View file

@ -23,7 +23,7 @@ class MyTCPServerHandler(SocketServer.BaseRequestHandler):
data = json.loads(self.request.recv(1024).strip()) data = json.loads(self.request.recv(1024).strip())
# GuestFS # GuestFS
gfs = guestfs.GuestFS (python_return_dict=True) gfs = guestfs.GuestFS(python_return_dict=True)
try: try:
gfs.add_domain(data['vname']) gfs.add_domain(data['vname'])
gfs.launch() gfs.launch()
@ -41,7 +41,7 @@ class MyTCPServerHandler(SocketServer.BaseRequestHandler):
self.request.sendall(json.dumps({'return': 'success'})) self.request.sendall(json.dumps({'return': 'success'}))
if data['action'] == 'publickey': if data['action'] == 'publickey':
if not gfs.is_dir('/root/.ssh'): if not gfs.is_dir('/root/.ssh'):
gfs.mkdir ('/root/.ssh') gfs.mkdir('/root/.ssh')
gfs.chmod(0700, "/root/.ssh") gfs.chmod(0700, "/root/.ssh")
gfs.write('/root/.ssh/authorized_keys', data['key']) gfs.write('/root/.ssh/authorized_keys', data['key'])
gfs.chmod(0600, '/root/.ssh/authorized_keys') gfs.chmod(0600, '/root/.ssh/authorized_keys')