18842: Fix syntax errors & error handling
authorPeter Amstutz <peter.amstutz@curii.com>
Tue, 25 Oct 2022 15:58:30 +0000 (11:58 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Tue, 25 Oct 2022 15:58:30 +0000 (11:58 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

lib/crunchrun/crunchrun.go

index 67454cd0ff79dced34d87311e7744a2cdeab86d8..7d57d732de4f0d0621caec8b32ace537ff421e78 100644 (file)
@@ -428,10 +428,12 @@ func (runner *ContainerRunner) SetupMounts() (map[string]bindmount, error) {
        }
 
        if runner.Container.RuntimeConstraints.KeepCacheDisk > 0 {
-               keepcachedir, err = runner.MkTempDir(runner.parentTemp, "keepcache")
+               keepcachedir, err := runner.MkTempDir(runner.parentTemp, "keepcache")
+               if err != nil {
+                       return nil, fmt.Errorf("while creating keep cache temp dir: %v", err)
+               }
                arvMountCmd = append(arvMountCmd, "--disk-cache", "--disk-cache-dir", keepcachedir, "--file-cache", fmt.Sprintf("%d", runner.Container.RuntimeConstraints.KeepCacheDisk))
-       }
-       else if runner.Container.RuntimeConstraints.KeepCacheRAM > 0 {
+       } else if runner.Container.RuntimeConstraints.KeepCacheRAM > 0 {
                arvMountCmd = append(arvMountCmd, "--file-cache", fmt.Sprintf("%d", runner.Container.RuntimeConstraints.KeepCacheRAM))
        }