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 />
<br />
<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.
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.
Read-only mounts are not made recursively read-only.</li>
<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")
case "bind-recursive":
valS := 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 {
switch val {
case "enabled": // read-only mounts are recursively read-only if Engine >= v25 && kernel >= v5.12, otherwise writable
// NOP
case "disabled": // alias of bind-nonrecursive=true