diff --git a/embark/embark/context_processor.py b/embark/embark/context_processor.py index 735cf1e2..b1a88453 100644 --- a/embark/embark/context_processor.py +++ b/embark/embark/context_processor.py @@ -1,4 +1,5 @@ from django.conf import settings + def embark_version(request): return {'EMBARK_VERSION': settings.VERSION[0], 'EMBA_VERSION': settings.VERSION[1]} diff --git a/embark/embark/helper.py b/embark/embark/helper.py index be8a3fa8..0028b0de 100644 --- a/embark/embark/helper.py +++ b/embark/embark/helper.py @@ -9,6 +9,7 @@ # from embark.settings.deploy import EMBA_ROOT EMBA_ROOT = os.path.join('/home/benedikt/embark', 'emba') + def rnd_rgb_color(): """ Used for html colors ONLY @@ -67,13 +68,13 @@ def get_version_strings(): # gets us the currently installed version if Path(EMBA_ROOT + "/external/onlinechecker").exists(): # get the latest version nnumbers - with open(Path(EMBA_ROOT + "/external/onlinechecker/EMBA_VERSION.txt"),'r', encoding='UTF-8') as emba_version_file: + with open(Path(EMBA_ROOT + "/external/onlinechecker/EMBA_VERSION.txt"), 'r', encoding='UTF-8') as emba_version_file: stable_emba_version = emba_version_file.read().splitlines()[0] - with open(Path(EMBA_ROOT + "/external/onlinechecker/EMBA_CONTAINER_HASH.txt"),'r', encoding='UTF-8') as container_version_file: + with open(Path(EMBA_ROOT + "/external/onlinechecker/EMBA_CONTAINER_HASH.txt"), 'r', encoding='UTF-8') as container_version_file: container_version = container_version_file.read().splitlines()[0] - with open(Path(EMBA_ROOT + "/external/onlinechecker/NVD_HASH.txt"),'r', encoding='UTF-8') as nvd_version_file: + with open(Path(EMBA_ROOT + "/external/onlinechecker/NVD_HASH.txt"), 'r', encoding='UTF-8') as nvd_version_file: nvd_version = nvd_version_file.read().splitlines()[0] - with open(Path(EMBA_ROOT + "/external/onlinechecker/EMBA_GITHUB_HASH.txt"),'r', encoding='UTF-8') as emba_github_version_file: + with open(Path(EMBA_ROOT + "/external/onlinechecker/EMBA_GITHUB_HASH.txt"), 'r', encoding='UTF-8') as emba_github_version_file: github_emba_version = emba_github_version_file.read().splitlines()[0] else: stable_emba_version = "" @@ -82,13 +83,13 @@ def get_version_strings(): github_emba_version = "" if Path(EMBA_ROOT + "/config/VERSION.txt").exists(): - with open(Path(EMBA_ROOT + "/config/VERSION.txt"),'r', encoding='UTF-8') as emba_version_file: + with open(Path(EMBA_ROOT + "/config/VERSION.txt"), 'r', encoding='UTF-8') as emba_version_file: emba_version = emba_version_file.read().splitlines()[0] else: emba_version = "" if Path("./VERSION.txt").exists(): - with open(Path("./VERSION.txt"),'r', encoding='UTF-8') as embark_version_file: + with open(Path("./VERSION.txt"), 'r', encoding='UTF-8') as embark_version_file: embark_version = embark_version_file.read().splitlines()[0] else: embark_version = "" diff --git a/embark/embark/settings/dev.py b/embark/embark/settings/dev.py index eecb9e06..5395b322 100644 --- a/embark/embark/settings/dev.py +++ b/embark/embark/settings/dev.py @@ -142,7 +142,7 @@ 'level': 'WARNING', 'handlers': ['info_handler', 'console_handler'], }, - 'updater': { + 'updater': { 'handlers': ['debug_handler', 'info_handler', 'console_handler'], 'level': 'DEBUG', }, diff --git a/embark/templates/updater/check.html b/embark/templates/updater/check.html index 5b3e2ddd..2748adb1 100644 --- a/embark/templates/updater/check.html +++ b/embark/templates/updater/check.html @@ -1,8 +1,6 @@ {% load django_bootstrap5 %}
- -
{% csrf_token %}
@@ -11,5 +9,4 @@
-
diff --git a/embark/updater/models.py b/embark/updater/models.py deleted file mode 100644 index 71a83623..00000000 --- a/embark/updater/models.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.db import models - -# Create your models here. diff --git a/embark/updater/views.py b/embark/updater/views.py index 1de1493f..7c45c639 100644 --- a/embark/updater/views.py +++ b/embark/updater/views.py @@ -24,7 +24,7 @@ def updater_home(request): emba_check_form = CheckForm() # get into the progress.html f"{settings.EMBA_LOG_ROOT}/emba_check.html" try: - with open(f"{settings.EMBA_LOG_ROOT}/emba_check.html", 'r') as in_file_: + with open(f"{settings.EMBA_LOG_ROOT}/emba_check.html", 'r', encoding='UTF-8') as in_file_: log_content = in_file_.read() except FileNotFoundError: logger.error('No dep check file exists yet') @@ -49,8 +49,9 @@ def check_update(request): form = CheckForm(request.POST) if form.is_valid(): option = form.cleaned_data["option"] + check_option = 1 if option == 'BOTH': - check_option = 1 + pass elif option == 'CONTAINER': check_option = 2 logger.debug("Got option %d for emba dep check", check_option) @@ -104,6 +105,7 @@ def progress(request): """ return render(request, 'updater/progress.html', {}) + @csrf_protect @require_http_methods(["GET"]) @login_required(login_url='/' + settings.LOGIN_URL) diff --git a/embark/uploader/boundedexecutor.py b/embark/uploader/boundedexecutor.py index 6e6af491..d80f0764 100644 --- a/embark/uploader/boundedexecutor.py +++ b/embark/uploader/boundedexecutor.py @@ -375,7 +375,7 @@ def emba_check(cls, option): try: cmd = f"{EMBA_SCRIPT_LOCATION} -d{option} | ansifilter -H -o {settings.EMBA_LOG_ROOT}/emba_check.html -s 5pt" - with open(f"{settings.EMBA_LOG_ROOT}/emba_check.log", "w+", encoding="utf-8") as file: # File should be empty + with open(f"{settings.EMBA_LOG_ROOT}/emba_check.log", "w+", encoding="utf-8") as file: proc = Popen(cmd, stdin=PIPE, stdout=file, stderr=file, shell=True) # nosec # wait for completion proc.communicate() @@ -396,7 +396,6 @@ def emba_check(cls, option): "message": {f"EMBA dep check {option}": return_code} } ) - @classmethod def submit_zip(cls, uuid):