From ac69aebf4ee09a86e39216c347af5f5f2e3b480c Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 21 Oct 2018 11:36:32 +0200 Subject: [PATCH] Display online packages in setup-apps --- basic/srv/vm/mgr/__init__.py | 4 ++-- basic/srv/vm/mgr/pkgmgr.py | 4 ++-- basic/srv/vm/mgr/wsgiapp.py | 5 ++++- basic/srv/vm/templates/setup-apps.html | 25 +++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/basic/srv/vm/mgr/__init__.py b/basic/srv/vm/mgr/__init__.py index 7384532..b301316 100644 --- a/basic/srv/vm/mgr/__init__.py +++ b/basic/srv/vm/mgr/__init__.py @@ -4,9 +4,9 @@ import os import shutil import subprocess -from . import config from . import tools from . import validator +from .config import Config VERSION = '0.0.1' @@ -123,7 +123,7 @@ subjectAltName=DNS:{domain},DNS:*.{domain}" class VMMgr: def __init__(self): # Load JSON configuration - self.conf = config.Config() + self.conf = Config() self.domain = self.conf['host']['domain'] self.port = self.conf['host']['port'] diff --git a/basic/srv/vm/mgr/pkgmgr.py b/basic/srv/vm/mgr/pkgmgr.py index fd6d0b1..56d887d 100644 --- a/basic/srv/vm/mgr/pkgmgr.py +++ b/basic/srv/vm/mgr/pkgmgr.py @@ -14,7 +14,7 @@ from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import ec from cryptography.hazmat.primitives.serialization import load_pem_public_key -from . import config +from .config import Config PUB_FILE = '/srv/vm/packages.pub' LXC_ROOT = '/var/lib/lxc' @@ -22,7 +22,7 @@ LXC_ROOT = '/var/lib/lxc' class PackageManager: def __init__(self): # Load JSON configuration - self.conf = config.Config() + self.conf = Config() self.repo_url = self.conf['host']['repo'] self.online_packages = {} diff --git a/basic/srv/vm/mgr/wsgiapp.py b/basic/srv/vm/mgr/wsgiapp.py index 5bb6335..143116a 100644 --- a/basic/srv/vm/mgr/wsgiapp.py +++ b/basic/srv/vm/mgr/wsgiapp.py @@ -12,6 +12,7 @@ from jinja2 import Environment, FileSystemLoader from . import VMMgr, CERT_PUB_FILE from . import tools +from .pkgmgr import PackageManager from .validator import InvalidValueException from .wsgilang import WSGILang from .wsgisession import WSGISession @@ -135,7 +136,9 @@ class WSGIApp(object): def setup_apps_view(self, request): # Application manager view. - return self.render_template('setup-apps.html', request) + pkgmgr = PackageManager() + pkgmgr.fetch_online_packages() + return self.render_template('setup-apps.html', request, online_packages=pkgmgr.online_packages) def update_host_action(self, request): # Update domain and port, then restart nginx diff --git a/basic/srv/vm/templates/setup-apps.html b/basic/srv/vm/templates/setup-apps.html index b853bea..8906492 100644 --- a/basic/srv/vm/templates/setup-apps.html +++ b/basic/srv/vm/templates/setup-apps.html @@ -56,6 +56,31 @@ +
+

Správce balíků

+

Vyberte které aplikace mají být nainstalovány nebo aktualizovány z distribučního serveru.

+ + + + + + + + + + {% for pkg in online_packages|sort %} + {% if 'title' in online_packages[pkg] %} + + + + + + {% endif %} + {% endfor %} + +
AplikaceNainstalovánaStav
{{ online_packages[pkg]['title'] }}
+
+

Správce virtuálního stroje

Změna hesla k šifrovanému diskovému oddílu a administračnímu rozhraní.