mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
Python3 & Django 2.2 Migration - Fix & Updates
This commit is contained in:
parent
fc8612c604
commit
4d40de1b55
98 changed files with 1525 additions and 6658 deletions
|
|
@ -3,7 +3,7 @@
|
|||
# gstfsd - WebVirtCloud daemon for managing VM's filesystem
|
||||
#
|
||||
|
||||
import SocketServer
|
||||
import socketserver
|
||||
import json
|
||||
import guestfs
|
||||
import re
|
||||
|
|
@ -13,11 +13,11 @@ PORT = 16510
|
|||
ADDRESS = "0.0.0.0"
|
||||
|
||||
|
||||
class MyTCPServer(SocketServer.ThreadingTCPServer):
|
||||
class MyTCPServer(socketserver.ThreadingTCPServer):
|
||||
allow_reuse_address = True
|
||||
|
||||
|
||||
class MyTCPServerHandler(SocketServer.BaseRequestHandler):
|
||||
class MyTCPServerHandler(socketserver.BaseRequestHandler):
|
||||
def handle(self):
|
||||
# recive data
|
||||
data = json.loads(self.request.recv(1024).strip())
|
||||
|
|
@ -42,9 +42,9 @@ class MyTCPServerHandler(SocketServer.BaseRequestHandler):
|
|||
if data['action'] == 'publickey':
|
||||
if not gfs.is_dir('/root/.ssh'):
|
||||
gfs.mkdir('/root/.ssh')
|
||||
gfs.chmod(0700, "/root/.ssh")
|
||||
gfs.chmod(700, "/root/.ssh")
|
||||
gfs.write('/root/.ssh/authorized_keys', data['key'])
|
||||
gfs.chmod(0600, '/root/.ssh/authorized_keys')
|
||||
gfs.chmod(600, '/root/.ssh/authorized_keys')
|
||||
self.request.sendall(json.dumps({'return': 'success'}))
|
||||
gfs.umount(part)
|
||||
except RuntimeError:
|
||||
|
|
@ -52,7 +52,7 @@ class MyTCPServerHandler(SocketServer.BaseRequestHandler):
|
|||
gfs.shutdown()
|
||||
gfs.close()
|
||||
except RuntimeError as err:
|
||||
self.request.sendall(json.dumps({'return': 'error', 'message': err.message}))
|
||||
self.request.sendall(json.dumps({'return': 'error', 'message': err}))
|
||||
|
||||
|
||||
server = MyTCPServer((ADDRESS, PORT), MyTCPServerHandler)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
Django==1.11.26
|
||||
Django==2.2.10
|
||||
websockify==0.9.0
|
||||
gunicorn==19.9.0
|
||||
lxml==4.4.2
|
||||
libvirt-python==5.10.0
|
||||
gunicorn==20.0.4
|
||||
lxml==4.5.0
|
||||
libvirt-python==6.1.0
|
||||
six
|
||||
pytz
|
||||
rwlock
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import random, string
|
||||
|
||||
haystack = string.ascii_letters + string.digits + string.punctuation
|
||||
print(''.join([random.SystemRandom().choice(haystack.replace('/','').replace('\'', '').replace('\"','')) for _ in range(50)]))
|
||||
print(''.join([random.SystemRandom().choice(haystack.replace('/', '').replace('\'', '').replace('\"', '')) for _ in range(50)]))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[program:gstfsd]
|
||||
command=/usr/bin/python /usr/local/bin/gstfsd
|
||||
command=/srv/webvirtcloud/venv/bin/python3 /usr/local/bin/gstfsd
|
||||
directory=/usr/local/bin
|
||||
user=root
|
||||
autostart=true
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ autorestart=true
|
|||
redirect_stderr=true
|
||||
|
||||
[program:novncd]
|
||||
command=/srv/webvirtcloud/venv/bin/python /srv/webvirtcloud/console/novncd
|
||||
command=/srv/webvirtcloud/venv/bin/python3 /srv/webvirtcloud/console/novncd
|
||||
directory=/srv/webvirtcloud
|
||||
user=www-data
|
||||
autostart=true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue