Skip to content

Commit

Permalink
linter
Browse files Browse the repository at this point in the history
  • Loading branch information
BenediktMKuehne committed Jul 11, 2024
1 parent d7e5c04 commit 80385a4
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 17 deletions.
1 change: 1 addition & 0 deletions embark/embark/context_processor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.conf import settings


def embark_version(request):
return {'EMBARK_VERSION': settings.VERSION[0], 'EMBA_VERSION': settings.VERSION[1]}
13 changes: 7 additions & 6 deletions embark/embark/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = ""
Expand All @@ -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 = ""
Expand Down
2 changes: 1 addition & 1 deletion embark/embark/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
'level': 'WARNING',
'handlers': ['info_handler', 'console_handler'],
},
'updater': {
'updater': {
'handlers': ['debug_handler', 'info_handler', 'console_handler'],
'level': 'DEBUG',
},
Expand Down
3 changes: 0 additions & 3 deletions embark/templates/updater/check.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{% load django_bootstrap5 %}

<div class="box">


<form action="{% url 'embark-updater-check' %}" method="post" id="form">
{% csrf_token %}
<div class="innerBlock">
Expand All @@ -11,5 +9,4 @@
<button type="submit" class="btn btn-primary">Check</button>
</div>
</form>

</div>
3 changes: 0 additions & 3 deletions embark/updater/models.py

This file was deleted.

6 changes: 4 additions & 2 deletions embark/updater/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions embark/uploader/boundedexecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -396,7 +396,6 @@ def emba_check(cls, option):
"message": {f"EMBA dep check {option}": return_code}
}
)


@classmethod
def submit_zip(cls, uuid):
Expand Down

0 comments on commit 80385a4

Please sign in to comment.