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:
3 files changed
+91
-23
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user