feat: allow storage:mount --replace to vary fields per mount
`storage:mount --replace` writes one process type's whole attachment set in a single call, but only part of an attachment could vary between the mounts in that call: each mount carried its own `ro` and Docker mount options while `--phase`, `--volume-subpath` and `--volume-chown` were fixed for the whole call, so an app whose mounts differ only in subpath still needed one call per mount, which is the non-atomic convergence `--replace` exists to remove. Each mount's option list now also carries `phase=`, `volume-subpath=` and `volume-chown=` tokens alongside `ro`, its new opposite `rw` and the Docker options it already passed through, and so that each attribute has exactly one spelling the five matching flags are now rejected with `--replace` - one of which, `--volume-options`, was previously accepted and silently dropped. `--process-type` still scopes the whole call, since it selects which mounts the call is authoritative over rather than describing any one of them. Every mount is parsed and validated before anything is written, so a rejected token leaves the stored mounts untouched. The documentation added for `--replace` was also marked as new in 0.38.28 in four places, but it shipped in 0.38.29.
This commit is contained in:
6 files changed
+699
-88
No files matched your search
@@ -218,12 +218,12 @@ func main() {
|
||||
case "mount":
|
||||
args := flag.NewFlagSet("storage:mount", flag.ExitOnError)
|
||||
containerDir := args.String("container-dir", "", "--container-dir: container path (named-entry form)")
|
||||
phases := args.StringSlice("phase", nil, "--phase: phase to mount in (deploy, run; default both)")
|
||||
phases := args.StringSlice("phase", nil, "--phase: phase to mount in (deploy, run; default both); not valid with --replace")
|
||||
processType := args.String("process-type", "", "--process-type: process type to mount for")
|
||||
subpath := args.String("volume-subpath", "", "--volume-subpath: subpath within the entry")
|
||||
readonly := args.Bool("volume-readonly", false, "--volume-readonly: mount the volume read-only")
|
||||
volumeChown := args.String("volume-chown", "", "--volume-chown: chown option applied at mount time")
|
||||
volumeOptions := args.String("volume-options", "", "--volume-options: comma-separated mount options (e.g. Z, noexec,nosuid)")
|
||||
subpath := args.String("volume-subpath", "", "--volume-subpath: subpath within the entry; not valid with --replace")
|
||||
readonly := args.Bool("volume-readonly", false, "--volume-readonly: mount the volume read-only; not valid with --replace")
|
||||
volumeChown := args.String("volume-chown", "", "--volume-chown: chown option applied at mount time; not valid with --replace")
|
||||
volumeOptions := args.String("volume-options", "", "--volume-options: comma-separated mount options (e.g. Z, noexec,nosuid); not valid with --replace")
|
||||
replace := args.Bool("replace", false, "--replace: replace the entire mount set for the process type")
|
||||
args.Parse(os.Args[2:])
|
||||
input := storage.CommandMountInput{
|
||||
|
||||
Reference in new issue
Block a user