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 committed 2026-04-30 01:10:00 -04:00
1 parent cdbc91048a
commit e9a53ac82d
3 files changed
+91 -23

No files matched your search

+8 -3
View File
@@ -295,12 +295,17 @@ func CommandExec(input CommandExecInput) error {
Args: triggerArgs,
StreamStdio: true,
})
if err != nil {
return err
}
// common.CallExecCommand wraps a non-zero exit code as an error, but
// for storage:exec the underlying tool's exit code IS the signal we
// want to surface - it's how `dokku storage:exec demo -- exit 42`
// reaches the user as exit 42. Check ExitCode first so that branch
// runs before err collapses to LogFailWithError → exit 1.
if results.ExitCode != 0 {
os.Exit(results.ExitCode)
}
if err != nil {
return err
}
return nil
}