From d85ad37cc6a8b68410451377c9a633cee325c309 Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Thu, 22 Aug 2024 11:50:52 +0300 Subject: [PATCH 1/4] fix: when volumes exists and it is null, it does not fail anymore --- src/tesk_core/taskmaster.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tesk_core/taskmaster.py b/src/tesk_core/taskmaster.py index 0d1f182..cb1d158 100755 --- a/src/tesk_core/taskmaster.py +++ b/src/tesk_core/taskmaster.py @@ -29,6 +29,10 @@ def run_executor(executor, namespace, pvc=None): mounts = spec['containers'][0].setdefault('volumeMounts', []) mounts.extend(pvc.volume_mounts) volumes = spec.setdefault('volumes', []) + if volumes is None: + spec['volumes'] = [] + # volumes is a refence to spec['volumes'] + # This makes sure the next line does not fail if volumes was originaly "null" volumes.extend([{'name': task_volume_basename, 'persistentVolumeClaim': { 'readonly': False, 'claimName': pvc.name}}]) logger.debug('Created job: ' + jobname) From d5bcad2748ff64e6d924034b6c49157ec1030f6f Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Mon, 26 Aug 2024 08:08:53 +0300 Subject: [PATCH 2/4] Fix: if volumes exists and is null, the previous code was failing --- src/tesk_core/taskmaster.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tesk_core/taskmaster.py b/src/tesk_core/taskmaster.py index cb1d158..4fd506d 100755 --- a/src/tesk_core/taskmaster.py +++ b/src/tesk_core/taskmaster.py @@ -28,12 +28,12 @@ def run_executor(executor, namespace, pvc=None): if pvc is not None: mounts = spec['containers'][0].setdefault('volumeMounts', []) mounts.extend(pvc.volume_mounts) - volumes = spec.setdefault('volumes', []) - if volumes is None: + spec.setdefault('volumes', []) + if spec['volumes'] is None: spec['volumes'] = [] # volumes is a refence to spec['volumes'] # This makes sure the next line does not fail if volumes was originaly "null" - volumes.extend([{'name': task_volume_basename, 'persistentVolumeClaim': { + spec['volumes'].extend([{'name': task_volume_basename, 'persistentVolumeClaim': { 'readonly': False, 'claimName': pvc.name}}]) logger.debug('Created job: ' + jobname) job = Job(executor, jobname, namespace) From 857bf2cce86d1111a6ad800ed43d39e0c14893d6 Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Mon, 26 Aug 2024 08:19:37 +0300 Subject: [PATCH 3/4] Moto version 5 changed the interface --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b66eb91..7b6aa72 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ 'pyfakefs', 'pytest-mock' , 'fs', - 'moto', + 'moto<5', 'pytest-localftpserver' ] From e35a17e9306a5b93656371be20bf6bc36b3935cf Mon Sep 17 00:00:00 2001 From: "alvaro.gonzalez" Date: Mon, 26 Aug 2024 08:29:38 +0300 Subject: [PATCH 4/4] Prevent error when password is used before assigment --- src/tesk_core/filer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tesk_core/filer.py b/src/tesk_core/filer.py index d2fef8b..af6cf93 100755 --- a/src/tesk_core/filer.py +++ b/src/tesk_core/filer.py @@ -240,6 +240,7 @@ def delete(self): def ftp_login(ftp_connection, netloc, netrc_file): user = None + password=None if netrc_file is not None: creds = netrc_file.authenticators(netloc) if creds: