Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
53 changes: 0 additions & 53 deletions Vagrantfile

This file was deleted.

1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

3 changes: 0 additions & 3 deletions accounts/admin.py

This file was deleted.

13 changes: 0 additions & 13 deletions accounts/backends.py

This file was deleted.

7 changes: 2 additions & 5 deletions accounts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
from django.conf import settings

Expand All @@ -19,8 +16,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=models.CASCADE)),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)),
],
options={
},
Expand Down
3 changes: 0 additions & 3 deletions accounts/migrations/0002_auto_20150325_0846.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations


Expand Down
5 changes: 1 addition & 4 deletions accounts/migrations/0003_usersshkey.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
from django.conf import settings

Expand All @@ -19,7 +16,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=models.CASCADE)),
],
),
]
5 changes: 1 addition & 4 deletions accounts/migrations/0004_userattributes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
from django.conf import settings

Expand All @@ -20,7 +17,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=models.CASCADE)),
],
),
]
3 changes: 0 additions & 3 deletions accounts/migrations/0004_userinstance_is_vnc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
3 changes: 0 additions & 3 deletions accounts/migrations/0006_userattributes_max_disk_size.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
3 changes: 0 additions & 3 deletions accounts/migrations/0007_auto_20160426_0635.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
8 changes: 1 addition & 7 deletions accounts/migrations/0008_merge.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -10,6 +7,3 @@ class Migration(migrations.Migration):
('accounts', '0004_userinstance_is_vnc'),
('accounts', '0007_auto_20160426_0635'),
]

operations = [
]
3 changes: 0 additions & 3 deletions accounts/migrations/0009_auto_20171026_0805.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
4 changes: 0 additions & 4 deletions accounts/migrations/0010_auto_20180625_1236.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
4 changes: 0 additions & 4 deletions accounts/migrations/0011_auto_20180625_1313.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 0 additions & 4 deletions accounts/migrations/0012_auto_20180625_1331.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 0 additions & 4 deletions accounts/migrations/0013_auto_20180625_1358.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 0 additions & 4 deletions accounts/migrations/0014_auto_20180808_1436.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
7 changes: 1 addition & 6 deletions accounts/migrations/0015_auto_20180808_1449.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# -*- 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


class Migration(migrations.Migration):
Expand All @@ -17,6 +12,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=models.DO_NOTHING),
),
]
5 changes: 3 additions & 2 deletions accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)])
Expand All @@ -48,7 +49,7 @@ def add_default_instances(user):
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)
Expand Down
3 changes: 0 additions & 3 deletions accounts/tests.py

This file was deleted.

11 changes: 6 additions & 5 deletions accounts/views.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -11,7 +11,6 @@
from django.core.validators import ValidationError



@login_required
def profile(request):
"""
Expand Down Expand Up @@ -70,6 +69,7 @@ def profile(request):
return HttpResponseRedirect(request.get_full_path())
return render(request, 'profile.html', locals())


@login_required
def accounts(request):
"""
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions computes/admin.py

This file was deleted.

2 changes: 1 addition & 1 deletion computes/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
Loading