diff --git a/Dockerfile b/Dockerfile
index 0c04c68..271abeb 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -8,37 +8,37 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -qyy install \
-o APT::Install-Suggests=false \
git python-virtualenv python-dev python-lxml libvirt-dev zlib1g-dev nginx libsasl2-modules
-ADD . /srv/webvirtcloud
-RUN chown -R www-data:www-data /srv/webvirtcloud
+ADD . /srv/webvirt
+RUN chown -R www-data:www-data /srv/webvirt
-# Setup webvirtcloud
-RUN cd /srv/webvirtcloud && \
+# Setup webvirt
+RUN cd /srv/webvirt && \
virtualenv venv && \
. venv/bin/activate && \
pip install -U pip && \
pip install -r conf/requirements.txt && \
- chown -R www-data:www-data /srv/webvirtcloud
+ chown -R www-data:www-data /srv/webvirt
-RUN cd /srv/webvirtcloud && . venv/bin/activate && \
+RUN cd /srv/webvirt && . venv/bin/activate && \
python manage.py migrate && \
- chown -R www-data:www-data /srv/webvirtcloud
+ chown -R www-data:www-data /srv/webvirt
# Setup Nginx
RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
rm /etc/nginx/sites-enabled/default && \
chown -R www-data:www-data /var/lib/nginx
-ADD conf/nginx/webvirtcloud.conf /etc/nginx/conf.d/
+ADD conf/nginx/webvirt.conf /etc/nginx/conf.d/
# Register services to runit
RUN mkdir /etc/service/nginx && \
mkdir /etc/service/nginx-log-forwarder && \
- mkdir /etc/service/webvirtcloud && \
+ mkdir /etc/service/webvirt && \
mkdir /etc/service/novnc
ADD conf/runit/nginx /etc/service/nginx/run
ADD conf/runit/nginx-log-forwarder /etc/service/nginx-log-forwarder/run
ADD conf/runit/novncd.sh /etc/service/novnc/run
-ADD conf/runit/webvirtcloud.sh /etc/service/webvirtcloud/run
+ADD conf/runit/webvirt.sh /etc/service/webvirt/run
EXPOSE 80
EXPOSE 6080
diff --git a/Vagrantfile b/Vagrantfile
deleted file mode 100644
index 21819f3..0000000
--- a/Vagrantfile
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- mode: ruby -*-
-# vi: set ft=ruby :
-
-Vagrant.configure(2) do |config|
- # Default machine, if name not specified...
- config.vm.define "dev", primary: true do |dev|
- dev.vm.box = "ubuntu/bionic64"
- dev.vm.hostname = "webvirtcloud"
- dev.vm.network "private_network", ip: "192.168.33.10"
- dev.vm.provision "shell", inline: <<-SHELL
- sudo sh /vagrant/dev/libvirt-bootstrap.sh
- sudo sed -i 's/auth_tcp = \"sasl\"/auth_tcp = \"none\"/g' /etc/libvirt/libvirtd.conf
- sudo service libvirt-bin restart
- sudo adduser vagrant libvirtd
- sudo apt-get -y install python-virtualenv python-dev python-lxml libvirt-dev zlib1g-dev
- virtualenv /vagrant/venv
- source /vagrant/venv/bin/activate
- pip install -r /vagrant/dev/requirements.txt
- SHELL
- end
- # To start this machine run "vagrant up prod"
- # To enter this machine run "vagrant ssh prod"
- config.vm.define "prod", autostart: false do |prod|
- prod.vm.box = "ubuntu/bionic64"
- prod.vm.hostname = "webvirtcloud"
- prod.vm.network "private_network", ip: "192.168.33.11"
- #prod.vm.synced_folder ".", "/srv/webvirtcloud"
- prod.vm.provision "shell", inline: <<-SHELL
- sudo mkdir /srv/webvirtcloud
- sudo cp -R /vagrant/* /srv/webvirtcloud
- sudo sh /srv/webvirtcloud/dev/libvirt-bootstrap.sh
- sudo sed -i 's/auth_tcp = \"sasl\"/auth_tcp = \"none\"/g' /etc/libvirt/libvirtd.conf
- sudo service libvirt-bin restart
- sudo adduser vagrant libvirtd
- sudo chown -R vagrant:vagrant /srv/webvirtcloud
- sudo apt-get -y install python-virtualenv python-dev python-lxml python-pip libvirt-dev zlib1g-dev libxslt1-dev nginx supervisor libsasl2-modules gcc pkg-config python-guestfs
- virtualenv /srv/webvirtcloud/venv
- source /srv/webvirtcloud/venv/bin/activate
- pip install -r /srv/webvirtcloud/dev/requirements.txt
- sudo cp /srv/webvirtcloud/conf/supervisor/webvirtcloud.conf /etc/supervisor/conf.d
- sudo cp /srv/webvirtcloud/conf/nginx/webvirtcloud.conf /etc/nginx/conf.d
- sudo cp /srv/webvirtcloud/webvirtcloud/settings.py.template /srv/webvirtcloud/webvirtcloud/settings.py
- sudo sed "s/SECRET_KEY = ''/SECRET_KEY = '"`python /srv/webvirtcloud/conf/runit/secret_generator.py`"'/" -i /srv/webvirtcloud/webvirtcloud/settings.py
- python /srv/webvirtcloud/manage.py migrate
- sudo rm /etc/nginx/sites-enabled/default
- sudo chown -R www-data:www-data /srv/webvirtcloud
- sudo service nginx restart
- sudo service supervisor restart
- SHELL
- end
-end
-
-
diff --git a/_config.yml b/_config.yml
deleted file mode 100644
index c419263..0000000
--- a/_config.yml
+++ /dev/null
@@ -1 +0,0 @@
-theme: jekyll-theme-cayman
\ No newline at end of file
diff --git a/accounts/admin.py b/accounts/admin.py
deleted file mode 100644
index 8c38f3f..0000000
--- a/accounts/admin.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.contrib import admin
-
-# Register your models here.
diff --git a/accounts/backends.py b/accounts/backends.py
deleted file mode 100644
index e66b94a..0000000
--- a/accounts/backends.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from django.contrib.auth.backends import RemoteUserBackend
-from accounts.models import UserInstance, UserAttributes
-from instances.models import Instance
-
-class MyRemoteUserBackend(RemoteUserBackend):
-
- #create_unknown_user = True
-
- def configure_user(self, user):
- #user.is_superuser = True
- UserAttributes.configure_user(user)
- return user
-
diff --git a/accounts/migrations/0001_initial.py b/accounts/migrations/0001_initial.py
index 3989532..0431499 100644
--- a/accounts/migrations/0001_initial.py
+++ b/accounts/migrations/0001_initial.py
@@ -1,8 +1,6 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
from django.conf import settings
+from django.db.models import CASCADE
class Migration(migrations.Migration):
@@ -19,8 +17,8 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('is_change', models.BooleanField(default=False)),
('is_delete', models.BooleanField(default=False)),
- ('instance', models.ForeignKey(to='instances.Instance')),
- ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
+ ('instance', models.ForeignKey(to='instances.Instance', on_delete=CASCADE)),
+ ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=CASCADE)),
],
options={
},
diff --git a/accounts/migrations/0002_auto_20150325_0846.py b/accounts/migrations/0002_auto_20150325_0846.py
index 8780f97..3432ca9 100644
--- a/accounts/migrations/0002_auto_20150325_0846.py
+++ b/accounts/migrations/0002_auto_20150325_0846.py
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import migrations
diff --git a/accounts/migrations/0003_usersshkey.py b/accounts/migrations/0003_usersshkey.py
index b00bc62..1a21de6 100644
--- a/accounts/migrations/0003_usersshkey.py
+++ b/accounts/migrations/0003_usersshkey.py
@@ -1,8 +1,6 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
from django.conf import settings
+from django.db.models import CASCADE
class Migration(migrations.Migration):
@@ -19,7 +17,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('keyname', models.CharField(max_length=25)),
('keypublic', models.CharField(max_length=500)),
- ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
+ ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=CASCADE)),
],
),
]
diff --git a/accounts/migrations/0004_userattributes.py b/accounts/migrations/0004_userattributes.py
index fb32539..021857b 100644
--- a/accounts/migrations/0004_userattributes.py
+++ b/accounts/migrations/0004_userattributes.py
@@ -1,8 +1,6 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
from django.conf import settings
+from django.db.models import CASCADE
class Migration(migrations.Migration):
@@ -20,7 +18,7 @@ class Migration(migrations.Migration):
('max_instances', models.IntegerField(default=0)),
('max_cpus', models.IntegerField(default=0)),
('max_memory', models.IntegerField(default=0)),
- ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)),
+ ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL, on_delete=CASCADE)),
],
),
]
diff --git a/accounts/migrations/0004_userinstance_is_vnc.py b/accounts/migrations/0004_userinstance_is_vnc.py
index 9c1c9b8..5e3ecd2 100644
--- a/accounts/migrations/0004_userinstance_is_vnc.py
+++ b/accounts/migrations/0004_userinstance_is_vnc.py
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import migrations, models
diff --git a/accounts/migrations/0005_userattributes_can_clone_instances.py b/accounts/migrations/0005_userattributes_can_clone_instances.py
index 4539657..df1a2d5 100644
--- a/accounts/migrations/0005_userattributes_can_clone_instances.py
+++ b/accounts/migrations/0005_userattributes_can_clone_instances.py
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
diff --git a/accounts/migrations/0006_userattributes_max_disk_size.py b/accounts/migrations/0006_userattributes_max_disk_size.py
index 3d21f5f..f1374a5 100644
--- a/accounts/migrations/0006_userattributes_max_disk_size.py
+++ b/accounts/migrations/0006_userattributes_max_disk_size.py
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
diff --git a/accounts/migrations/0007_auto_20160426_0635.py b/accounts/migrations/0007_auto_20160426_0635.py
index 2f92aba..78c7d76 100644
--- a/accounts/migrations/0007_auto_20160426_0635.py
+++ b/accounts/migrations/0007_auto_20160426_0635.py
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import migrations, models
diff --git a/accounts/migrations/0008_merge.py b/accounts/migrations/0008_merge.py
index 8edf672..ce22255 100644
--- a/accounts/migrations/0008_merge.py
+++ b/accounts/migrations/0008_merge.py
@@ -1,7 +1,4 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
-from django.db import migrations, models
+from django.db import migrations
class Migration(migrations.Migration):
@@ -10,6 +7,3 @@ class Migration(migrations.Migration):
('accounts', '0004_userinstance_is_vnc'),
('accounts', '0007_auto_20160426_0635'),
]
-
- operations = [
- ]
diff --git a/accounts/migrations/0009_auto_20171026_0805.py b/accounts/migrations/0009_auto_20171026_0805.py
index 7d035c7..fd3da75 100644
--- a/accounts/migrations/0009_auto_20171026_0805.py
+++ b/accounts/migrations/0009_auto_20171026_0805.py
@@ -1,6 +1,3 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import migrations, models
diff --git a/accounts/migrations/0010_auto_20180625_1236.py b/accounts/migrations/0010_auto_20180625_1236.py
index 23e1548..17b150f 100644
--- a/accounts/migrations/0010_auto_20180625_1236.py
+++ b/accounts/migrations/0010_auto_20180625_1236.py
@@ -1,7 +1,3 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.13 on 2018-06-25 12:36
-from __future__ import unicode_literals
-
from django.db import migrations, models
diff --git a/accounts/migrations/0011_auto_20180625_1313.py b/accounts/migrations/0011_auto_20180625_1313.py
index 1ee194b..9964539 100644
--- a/accounts/migrations/0011_auto_20180625_1313.py
+++ b/accounts/migrations/0011_auto_20180625_1313.py
@@ -1,7 +1,3 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.13 on 2018-06-25 13:13
-from __future__ import unicode_literals
-
import django.core.validators
from django.db import migrations, models
diff --git a/accounts/migrations/0012_auto_20180625_1331.py b/accounts/migrations/0012_auto_20180625_1331.py
index 827599e..b2507fd 100644
--- a/accounts/migrations/0012_auto_20180625_1331.py
+++ b/accounts/migrations/0012_auto_20180625_1331.py
@@ -1,7 +1,3 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.13 on 2018-06-25 13:31
-from __future__ import unicode_literals
-
import django.core.validators
from django.db import migrations, models
import re
diff --git a/accounts/migrations/0013_auto_20180625_1358.py b/accounts/migrations/0013_auto_20180625_1358.py
index 1fdec50..bfebd27 100644
--- a/accounts/migrations/0013_auto_20180625_1358.py
+++ b/accounts/migrations/0013_auto_20180625_1358.py
@@ -1,7 +1,3 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.13 on 2018-06-25 13:58
-from __future__ import unicode_literals
-
import django.core.validators
from django.db import migrations, models
import re
diff --git a/accounts/migrations/0014_auto_20180808_1436.py b/accounts/migrations/0014_auto_20180808_1436.py
index a4f3c78..dc66a81 100644
--- a/accounts/migrations/0014_auto_20180808_1436.py
+++ b/accounts/migrations/0014_auto_20180808_1436.py
@@ -1,7 +1,3 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.13 on 2018-08-08 11:36
-from __future__ import unicode_literals
-
import django.core.validators
from django.db import migrations, models
diff --git a/accounts/migrations/0015_auto_20180808_1449.py b/accounts/migrations/0015_auto_20180808_1449.py
index d94905a..2bb88fe 100644
--- a/accounts/migrations/0015_auto_20180808_1449.py
+++ b/accounts/migrations/0015_auto_20180808_1449.py
@@ -1,10 +1,6 @@
-# -*- coding: utf-8 -*-
-# Generated by Django 1.11.13 on 2018-08-08 11:49
-from __future__ import unicode_literals
-
from django.conf import settings
from django.db import migrations, models
-import django.db.models.deletion
+from django.db.models import DO_NOTHING
class Migration(migrations.Migration):
@@ -17,6 +13,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='usersshkey',
name='user',
- field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL),
+ field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=DO_NOTHING),
),
]
diff --git a/accounts/models.py b/accounts/models.py
index 42c8051..cdd6b0a 100644
--- a/accounts/models.py
+++ b/accounts/models.py
@@ -24,10 +24,11 @@ class UserSSHKey(models.Model):
def __unicode__(self):
return self.keyname
+
class UserAttributes(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
can_clone_instances = models.BooleanField(default=True)
- max_instances = models.IntegerField(default=1, help_text="-1 for unlimited. Any integer value", validators=[MinValueValidator(-1),])
+ max_instances = models.IntegerField(default=1, help_text="-1 for unlimited. Any integer value", validators=[MinValueValidator(-1)])
max_cpus = models.IntegerField(default=1, help_text="-1 for unlimited. Any integer value", validators=[MinValueValidator(-1)])
max_memory = models.IntegerField(default=2048, help_text="-1 for unlimited. Any integer value", validators=[MinValueValidator(-1)])
max_disk_size = models.IntegerField(default=20, help_text="-1 for unlimited. Any integer value", validators=[MinValueValidator(-1)])
@@ -48,7 +49,7 @@ class UserAttributes(models.Model):
instance = Instance.objects.get(name=instance_name)
user_instance = UserInstance(user=user, instance=instance)
user_instance.save()
-
+
@staticmethod
def configure_user(user):
UserAttributes.create_missing_userattributes(user)
diff --git a/accounts/tests.py b/accounts/tests.py
deleted file mode 100644
index 7ce503c..0000000
--- a/accounts/tests.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/accounts/views.py b/accounts/views.py
index 494bdd6..6cc57e0 100644
--- a/accounts/views.py
+++ b/accounts/views.py
@@ -1,6 +1,6 @@
from django.shortcuts import render
from django.http import HttpResponseRedirect
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
@@ -11,7 +11,6 @@ from django.conf import settings
from django.core.validators import ValidationError
-
@login_required
def profile(request):
"""
@@ -70,6 +69,7 @@ def profile(request):
return HttpResponseRedirect(request.get_full_path())
return render(request, 'profile.html', locals())
+
@login_required
def accounts(request):
"""
@@ -103,7 +103,8 @@ def accounts(request):
user_pass = request.POST.get('user_pass', '')
user_edit = User.objects.get(id=user_id)
- if user_pass != '': user_edit.set_password(user_pass)
+ if user_pass != '':
+ user_edit.set_password(user_pass)
user_edit.is_staff = CHECKBOX_MAPPING.get(request.POST.get('user_is_staff', 'off'))
user_edit.is_superuser = CHECKBOX_MAPPING.get(request.POST.get('user_is_superuser', 'off'))
user_edit.save()
@@ -185,12 +186,12 @@ def account(request, user_id):
return HttpResponseRedirect(request.get_full_path())
if 'add' in request.POST:
inst_id = request.POST.get('inst_id', '')
-
+
if settings.ALLOW_INSTANCE_MULTIPLE_OWNER:
check_inst = UserInstance.objects.filter(instance_id=int(inst_id), user_id=int(user_id))
else:
check_inst = UserInstance.objects.filter(instance_id=int(inst_id))
-
+
if check_inst:
msg = _("Instance already added")
error_messages.append(msg)
diff --git a/computes/admin.py b/computes/admin.py
deleted file mode 100644
index 8c38f3f..0000000
--- a/computes/admin.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.contrib import admin
-
-# Register your models here.
diff --git a/computes/forms.py b/computes/forms.py
index ff8e9b9..9b33d52 100644
--- a/computes/forms.py
+++ b/computes/forms.py
@@ -154,7 +154,7 @@ class ComputeAddSocketForm(forms.Form):
name = forms.CharField(error_messages={'required': _('No hostname has been entered')},
max_length=20)
details = forms.CharField(error_messages={'required': _('No details has been entred')},
- max_length=50)
+ max_length=50)
def clean_name(self):
name = self.cleaned_data['name']
diff --git a/computes/migrations/0001_initial.py b/computes/migrations/0001_initial.py
index e8d6139..1f30959 100644
--- a/computes/migrations/0001_initial.py
+++ b/computes/migrations/0001_initial.py
@@ -1,14 +1,8 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
class Migration(migrations.Migration):
- dependencies = [
- ]
-
operations = [
migrations.CreateModel(
name='Compute',
@@ -20,8 +14,6 @@ class Migration(migrations.Migration):
('password', models.CharField(max_length=14, null=True, blank=True)),
('type', models.IntegerField()),
],
- options={
- },
bases=(models.Model,),
),
]
diff --git a/computes/migrations/0002_compute_details.py b/computes/migrations/0002_compute_details.py
index 1e0fdf5..45f287c 100644
--- a/computes/migrations/0002_compute_details.py
+++ b/computes/migrations/0002_compute_details.py
@@ -1,8 +1,6 @@
-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
+
class Migration(migrations.Migration):
dependencies = [
diff --git a/computes/tests.py b/computes/tests.py
deleted file mode 100644
index 7ce503c..0000000
--- a/computes/tests.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/computes/views.py b/computes/views.py
index 1253541..3cd2938 100644
--- a/computes/views.py
+++ b/computes/views.py
@@ -1,8 +1,7 @@
-import time
import json
from django.utils import timezone
from django.http import HttpResponse, HttpResponseRedirect
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required
from computes.models import Compute
@@ -44,7 +43,7 @@ def computes(request):
error_messages = []
computes = Compute.objects.filter().order_by('name')
computes_info = get_hosts_status(computes)
-
+
if request.method == 'POST':
if 'host_del' in request.POST:
compute_id = request.POST.get('host_id', '')
@@ -213,13 +212,12 @@ def get_compute_disk_buses(request, compute_id, disk):
if disk == 'disk':
data['bus'] = sorted(disk_device_types)
elif disk == 'cdrom':
- data['bus'] = ['ide', 'sata', 'scsi',]
+ data['bus'] = ['ide', 'sata', 'scsi']
elif disk == 'floppy':
- data['bus'] = ['fdc',]
+ data['bus'] = ['fdc']
elif disk == 'lun':
- data['bus'] = ['scsi',]
+ data['bus'] = ['scsi']
except libvirtError:
pass
return HttpResponse(json.dumps(data))
-
diff --git a/conf/daemon/gstfsd b/conf/daemon/gstfsd
index 2e68312..a933779 100644
--- a/conf/daemon/gstfsd
+++ b/conf/daemon/gstfsd
@@ -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,17 +42,17 @@ 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(0o700, "/root/.ssh")
gfs.write('/root/.ssh/authorized_keys', data['key'])
- gfs.chmod(0600, '/root/.ssh/authorized_keys')
+ gfs.chmod(0o600, '/root/.ssh/authorized_keys')
self.request.sendall(json.dumps({'return': 'success'}))
gfs.umount(part)
except RuntimeError:
pass
gfs.shutdown()
gfs.close()
- except RuntimeError, err:
- self.request.sendall(json.dumps({'return': 'error', 'message': err.message}))
+ except RuntimeError as err:
+ self.request.sendall(json.dumps({'return': 'error', 'message': err}))
server = MyTCPServer((ADDRESS, PORT), MyTCPServerHandler)
server.serve_forever()
diff --git a/conf/requirements.txt b/conf/requirements.txt
index 05f2743..4718285 100644
--- a/conf/requirements.txt
+++ b/conf/requirements.txt
@@ -1,7 +1,6 @@
-Django==1.11.21
+Django==2.2.4
websockify==0.8.0
gunicorn==19.9.0
lxml==4.2.5
libvirt-python==5.3.0
pytz
-rwlock
diff --git a/console/admin.py b/console/admin.py
deleted file mode 100644
index 8c38f3f..0000000
--- a/console/admin.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.contrib import admin
-
-# Register your models here.
diff --git a/console/models.py b/console/models.py
deleted file mode 100644
index 71a8362..0000000
--- a/console/models.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.db import models
-
-# Create your models here.
diff --git a/console/novncd b/console/novncd
index e017898..59068b8 100755
--- a/console/novncd
+++ b/console/novncd
@@ -7,7 +7,7 @@ import django
DIR_PATH = os.path.dirname(os.path.abspath(__file__))
ROOT_PATH = os.path.abspath(os.path.join(DIR_PATH, '..', ''))
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webvirtcloud.settings")
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webvirt.settings")
CERT = DIR_PATH + '/cert.pem'
if ROOT_PATH not in sys.path:
@@ -20,11 +20,11 @@ django.setup()
# sys.path.append(VENV_PATH)
import re
-import Cookie
+import http.cookies
import socket
-from webvirtcloud.settings import WS_PORT, WS_HOST, WS_CERT
+from webvirt.settings import WS_PORT, WS_HOST, WS_CERT
from vrtManager.connection import CONN_SSH, CONN_SOCKET
-from tunnel import Tunnel
+from console.tunnel import Tunnel
from optparse import OptionParser
parser = OptionParser()
@@ -120,7 +120,7 @@ def get_connection_infos(token):
console_host = conn.get_console_listen_addr()
console_port = conn.get_console_port()
console_socket = conn.get_console_socket()
- except Exception, e:
+ except Exception as e:
logging.error('Fail to retrieve console connection infos for token %s : %s' % (token, e))
raise
return (connhost, connport, connuser, conntype, console_host,
@@ -129,7 +129,7 @@ def get_connection_infos(token):
class CompatibilityMixIn(object):
def _new_client(self, daemon, socket_factory):
- cookie = Cookie.SimpleCookie()
+ cookie = http.cookies.SimpleCookie()
cookie.load(self.headers.getheader('cookie'))
if 'token' not in cookie:
self.msg('No token cookie found !')
diff --git a/console/templates/console-base.html b/console/templates/console-base.html
index 694da9b..40da526 100644
--- a/console/templates/console-base.html
+++ b/console/templates/console-base.html
@@ -6,7 +6,7 @@
-
+