Skip to content

Commit

Permalink
Merge pull request #20012 from vrothberg/module-parsing
Browse files Browse the repository at this point in the history
error when --module is specified on the command level
  • Loading branch information
openshift-merge-robot authored Sep 18, 2023
2 parents 5be2357 + 0b7142f commit 81ddf48
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cmd/podman/registry/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand All @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/podman/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion docs/source/markdown/podman.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions test/system/800-config.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}'
Expand Down

0 comments on commit 81ddf48

Please sign in to comment.