mirror of
https://github.com/containers/podman.git
synced 2025-06-25 03:52:15 +08:00
--env-host: use default from containers.conf
As found while working on #20000, the `--env-host` flag should use the default from containers.conf. Add a new "supported fields" test to the system tests to make sure we have a goto test for catching such regressions. I suspect more flags to not use the defaults from containers.conf. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
@ -140,7 +140,9 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
|
||||
if !registry.IsRemote() {
|
||||
createFlags.BoolVar(
|
||||
&cf.EnvHost,
|
||||
"env-host", false, "Use all current host environment variables in container",
|
||||
"env-host",
|
||||
podmanConfig.ContainersConfDefaultsRO.Containers.EnvHost,
|
||||
"Use all current host environment variables in container",
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -177,4 +177,19 @@ EOF
|
||||
assert "${lines[1]}" = "$m2" "completion finds module 2"
|
||||
}
|
||||
|
||||
@test "podman --module - supported fields" {
|
||||
skip_if_remote "--module is not supported for remote clients"
|
||||
|
||||
conf_tmp="$PODMAN_TMPDIR/test.conf"
|
||||
cat > $conf_tmp <<EOF
|
||||
[containers]
|
||||
env_host=true
|
||||
EOF
|
||||
|
||||
# Make sure env_host variable is read
|
||||
random_env_var="expected_env_var_$(random_string 15)"
|
||||
FOO="$random_env_var" run_podman --module=$conf_tmp run --rm $IMAGE /bin/printenv FOO
|
||||
is "$output" "$random_env_var" "--module should yield injecting host env vars into the container"
|
||||
}
|
||||
|
||||
# vim: filetype=sh
|
||||
|
Reference in New Issue
Block a user