fix: propagate storage:exec exit codes and route legacy mounts to attachments

CallExecCommand wraps non-zero exit codes as errors with the code populated on the response, so storage:exec was returning the wrapped error and being collapsed to exit 1 by LogFailWithError before the os.Exit branch ran. Both storage's CommandExec and scheduler-docker-local's TriggerSchedulerStorageExec now check ExitCode before err so the underlying tool's status flows through verbatim. Separately, the legacy host:container colon form of storage:mount used to write straight into docker-options, but storage:list now reads only attachments, so newly mounted legacy-form storage was invisible. CommandMount and CommandUnmount route the colon form through LegacyMountToEntry plus AddAttachment / RemoveAttachment, making storage:list show every mount regardless of form while preserving the existing "Mount path already exists." / "Mount path does not exist." error wording.
This commit is contained in:
Jose Diaz-Gonzalez
2026-04-30 01:10:00 -04:00
parent cdbc91048a
commit e9a53ac82d
3 changed files with 91 additions and 23 deletions

View File

@@ -64,12 +64,16 @@ func TriggerSchedulerStorageExec(scheduler string, input StorageExecInput) error
Args: args,
StreamStdio: true,
})
if err != nil {
return err
}
// CallExecCommand wraps non-zero exit as an error; for storage:exec
// the docker-run exit code is the signal we want to forward to the
// caller. Propagate it before falling through to the err return,
// which would otherwise be collapsed to exit 1 by the dispatcher.
if result.ExitCode != 0 {
os.Exit(result.ExitCode)
}
if err != nil {
return err
}
return nil
}