Merge pull request #4671 from thaJeztah/bind_recusrive_no_bool

mount: bind-recursive: remove boolean convenience values
This commit is contained in:
Sebastiaan van Stijn 2023-11-22 11:48:56 +01:00 committed by GitHub
commit 8046bb2d9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 14 deletions

View File

@ -442,10 +442,10 @@ The following options can only be used for bind mounts (`type=bind`):
A value is one of:<br /> A value is one of:<br />
<br /> <br />
<ul> <ul>
<li><<tt>enabled</tt>, <tt>true</tt> or <tt>1</tt>: Enables recursive bind-mount. <li><<tt>enabled</tt>: Enables recursive bind-mount.
Read-only mounts are made recursively read-only if kernel is v5.12 or later. Read-only mounts are made recursively read-only if kernel is v5.12 or later.
Otherwise they are not made recursively read-only.</li> Otherwise they are not made recursively read-only.</li>
<li><<tt>disabled</tt>, <tt>false</tt> or <tt>0</tt>: Disables recursive bind-mount.</li> <li><<tt>disabled</tt>: Disables recursive bind-mount.</li>
<li><<tt>writable</tt>: Enables recursive bind-mount. <li><<tt>writable</tt>: Enables recursive bind-mount.
Read-only mounts are not made recursively read-only.</li> Read-only mounts are not made recursively read-only.</li>
<li><<tt>readonly</tt>: Enables recursive bind-mount. <li><<tt>readonly</tt>: Enables recursive bind-mount.

View File

@ -116,16 +116,7 @@ func (m *MountOpt) Set(value string) error {
} }
logrus.Warn("bind-nonrecursive is deprecated, use bind-recursive=disabled instead") logrus.Warn("bind-nonrecursive is deprecated, use bind-recursive=disabled instead")
case "bind-recursive": case "bind-recursive":
valS := val switch val {
// Allow boolean as an alias to "enabled" or "disabled"
if b, err := strconv.ParseBool(valS); err == nil {
if b {
valS = "enabled"
} else {
valS = "disabled"
}
}
switch valS {
case "enabled": // read-only mounts are recursively read-only if Engine >= v25 && kernel >= v5.12, otherwise writable case "enabled": // read-only mounts are recursively read-only if Engine >= v25 && kernel >= v5.12, otherwise writable
// NOP // NOP
case "disabled": // alias of bind-nonrecursive=true case "disabled": // alias of bind-nonrecursive=true