Merge pull request #20012 from vrothberg/module-parsing

error when --module is specified on the command level
This commit is contained in:
OpenShift Merge Robot
2023-09-18 16:40:49 +02:00
committed by GitHub
4 changed files with 10 additions and 5 deletions

View File

@ -80,7 +80,7 @@ func containersConfModules() ([]string, error) {
func newPodmanConfig() {
modules, err := containersConfModules()
if err != nil {
fmt.Fprintln(os.Stderr, err.Error())
fmt.Fprintf(os.Stderr, "Error parsing containers.conf modules: %v\n", err)
os.Exit(1)
}
@ -94,7 +94,7 @@ func newPodmanConfig() {
Modules: modules,
})
if err != nil {
fmt.Fprint(os.Stderr, "Failed to obtain podman configuration: "+err.Error())
fmt.Fprintf(os.Stderr, "Failed to obtain podman configuration: %v\n", err)
os.Exit(1)
}
@ -111,7 +111,7 @@ func newPodmanConfig() {
mode = entities.TunnelMode
}
default:
fmt.Fprintf(os.Stderr, "%s is not a supported OS", runtime.GOOS)
fmt.Fprintf(os.Stderr, "%s is not a supported OS\n", runtime.GOOS)
os.Exit(1)
}

View File

@ -456,7 +456,7 @@ func rootFlags(cmd *cobra.Command, podmanConfig *entities.PodmanConfig) {
// as a flag here to a) make sure that rootflags are aware of
// this flag and b) to have shell completions.
moduleFlagName := "module"
pFlags.StringSlice(moduleFlagName, nil, "Load the containers.conf(5) module")
lFlags.StringSlice(moduleFlagName, nil, "Load the containers.conf(5) module")
_ = cmd.RegisterFlagCompletionFunc(moduleFlagName, common.AutocompleteContainersConfModules)
// A *hidden* flag to change the database backend.

View File

@ -92,7 +92,8 @@ Log messages at and above specified level: __debug__, __info__, __warn__, __erro
Load the specified `containers.conf(5)` module. Can be an absolute or relative path. Please refer to `containers.conf(5)` for details.
This feature is not supported on the remote client, including Mac and Windows (excluding WSL2) machines
This flag is not supported on the remote client, including Mac and Windows (excluding WSL2) machines.
Further note that the flag is a root-level flag and must be specified before any Podman sub-command.
#### **--network-cmd-path**=*path*
Path to the `slirp4netns(1)` command binary to use for setting up a slirp4netns network.

View File

@ -93,6 +93,10 @@ EOF
annotations=['module=$random_data']
EOF
run_podman 125 create --module=$conf_tmp -q $IMAGE
is "$output" "Error: unknown flag: --module
See 'podman create --help'" "--module must be specified before the command"
run_podman --module=$conf_tmp create -q $IMAGE
cid="$output"
run_podman container inspect $cid --format '{{index .Config.Annotations "module"}}'