Commit 8870ad63 by Dudás Ádám

vm: move access protocols' definition to config

parent 25746914
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
from os import environ from os import environ
from os.path import abspath, basename, dirname, join, normpath from os.path import abspath, basename, dirname, join, normpath
from json import loads from json import loads
from socket import SOCK_STREAM from socket import SOCK_STREAM
from sys import path from sys import path
...@@ -292,3 +292,11 @@ WSGI_APPLICATION = '%s.wsgi.application' % SITE_NAME ...@@ -292,3 +292,11 @@ WSGI_APPLICATION = '%s.wsgi.application' % SITE_NAME
FIREWALL_SETTINGS = loads(get_env_variable('DJANGO_FIREWALL_SETTINGS')) FIREWALL_SETTINGS = loads(get_env_variable('DJANGO_FIREWALL_SETTINGS'))
CRISPY_TEMPLATE_PACK = 'bootstrap3' CRISPY_TEMPLATE_PACK = 'bootstrap3'
# format: id: (name, port, protocol)
VM_ACCESS_PROTOCOLS = loads(get_env_variable('DJANGO_VM_ACCESS_PROTOCOLS',
default={
'rdp': ('rdp', 3389, 'tcp'),
'nx': ('nx', 22, 'tcp'),
'ssh': ('ssh', 22, 'tcp'),
}))
...@@ -4,6 +4,7 @@ from datetime import timedelta ...@@ -4,6 +4,7 @@ from datetime import timedelta
import logging import logging
from netaddr import EUI from netaddr import EUI
import django.conf
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db import models from django.db import models
from django.db.models.signals import pre_delete from django.db.models.signals import pre_delete
...@@ -21,13 +22,7 @@ from . import tasks ...@@ -21,13 +22,7 @@ from . import tasks
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
pwgen = User.objects.make_random_password pwgen = User.objects.make_random_password
# TODO get this from config ACCESS_PROTOCOLS = django.conf.settings.VM_ACCESS_PROTOCOLS
ACCESS_PROTOCOLS = {
# format: id: (name, port, protocol)
'rdp': ('rdp', 3389, 'tcp'),
'nx': ('nx', 22, 'tcp'),
'ssh': ('ssh', 22, 'tcp'),
}
ACCESS_METHODS = [(k, ap[0]) for k, ap in ACCESS_PROTOCOLS.iteritems()] ACCESS_METHODS = [(k, ap[0]) for k, ap in ACCESS_PROTOCOLS.iteritems()]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment