Skip to content

Commit

Permalink
Fix: if volumes exists and is null, the previous code was failing
Browse files Browse the repository at this point in the history
  • Loading branch information
lvarin committed Aug 26, 2024
1 parent d85ad37 commit d5bcad2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tesk_core/taskmaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d5bcad2

Please sign in to comment.