mirror of
https://github.com/containers/podman.git
synced 2025-06-27 05:26:50 +08:00
cmd: clarify meaning of ParentNSRequired
there are no commands that are not supported by rootless mode, but some commands require to run in the user namespace. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -81,13 +81,6 @@ func parseCommands() *cobra.Command {
|
|||||||
return fmt.Errorf("cannot run command %q in rootless mode, must execute `podman unshare` first", cmd.CommandPath())
|
return fmt.Errorf("cannot run command %q in rootless mode, must execute `podman unshare` first", cmd.CommandPath())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
_, found = c.Command.Annotations[registry.ParentNSRequired]
|
|
||||||
if rootless.IsRootless() && found && c.Command.Name() != "scp" {
|
|
||||||
c.Command.RunE = func(cmd *cobra.Command, args []string) error {
|
|
||||||
return fmt.Errorf("cannot run command %q in rootless mode", cmd.CommandPath())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
addCommand(c)
|
addCommand(c)
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ const (
|
|||||||
// NoMoveProcess used as cobra.Annotation when command doesn't need Podman to be moved to a separate cgroup
|
// NoMoveProcess used as cobra.Annotation when command doesn't need Podman to be moved to a separate cgroup
|
||||||
NoMoveProcess = "NoMoveProcess"
|
NoMoveProcess = "NoMoveProcess"
|
||||||
|
|
||||||
// ParentNSRequired used as cobra.Annotation when command requires root access
|
// ParentNSRequired used as cobra.Annotation when a command should not be run in the podman rootless user namespace, also requires updates in `pkg/rootless/rootless_linux.c` in function `can_use_shortcut()` to exclude the command name there.
|
||||||
ParentNSRequired = "ParentNSRequired"
|
ParentNSRequired = "ParentNSRequired"
|
||||||
|
|
||||||
// UnshareNSRequired used as cobra.Annotation when command requires modified user namespace
|
// UnshareNSRequired used as cobra.Annotation when command requires modified user namespace
|
||||||
|
Reference in New Issue
Block a user