mirror of
https://github.com/containers/podman.git
synced 2025-12-12 17:57:31 +08:00
Use HTTPProxy settings from containers.conf
This PR takes the settings from containers.conf and uses them. This works on the podman local but does not fix the issue for podman remote or for APIv2. We need a way to specify optionalbooleans when creating containers. Fixes: https://github.com/containers/podman/issues/8843 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
13
vendor/github.com/containers/common/pkg/auth/auth.go
generated
vendored
13
vendor/github.com/containers/common/pkg/auth/auth.go
generated
vendored
@@ -16,10 +16,17 @@ import (
|
||||
"golang.org/x/crypto/ssh/terminal"
|
||||
)
|
||||
|
||||
// GetDefaultAuthFile returns env value REGISTRY_AUTH_FILE as default --authfile path
|
||||
// used in multiple --authfile flag definitions
|
||||
// GetDefaultAuthFile returns env value REGISTRY_AUTH_FILE as default
|
||||
// --authfile path used in multiple --authfile flag definitions
|
||||
// Will fail over to DOCKER_CONFIG if REGISTRY_AUTH_FILE environment is not set
|
||||
func GetDefaultAuthFile() string {
|
||||
return os.Getenv("REGISTRY_AUTH_FILE")
|
||||
authfile := os.Getenv("REGISTRY_AUTH_FILE")
|
||||
if authfile == "" {
|
||||
if authfile, ok := os.LookupEnv("DOCKER_CONFIG"); ok {
|
||||
logrus.Infof("Using DOCKER_CONFIG environment variable for authfile path %s", authfile)
|
||||
}
|
||||
}
|
||||
return authfile
|
||||
}
|
||||
|
||||
// CheckAuthFile validates filepath given by --authfile
|
||||
|
||||
48
vendor/github.com/containers/common/pkg/completion/completion.go
generated
vendored
48
vendor/github.com/containers/common/pkg/completion/completion.go
generated
vendored
@@ -91,3 +91,51 @@ func AutocompleteSubgidName(cmd *cobra.Command, args []string, toComplete string
|
||||
func AutocompleteSubuidName(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
return autocompleteSubIDName("/etc/subuid")
|
||||
}
|
||||
|
||||
// AutocompleteArch - Autocomplete platform supported by container engines
|
||||
func AutocompletePlatform(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
completions := []string{
|
||||
"linux/386",
|
||||
"linux/amd64",
|
||||
"linux/arm",
|
||||
"linux/arm64",
|
||||
"linux/ppc64",
|
||||
"linux/ppc64le",
|
||||
"linux/mips",
|
||||
"linux/mipsle",
|
||||
"linux/mips64",
|
||||
"linux/mips64le",
|
||||
"linux/riscv64",
|
||||
"linux/s390x",
|
||||
"windows/386",
|
||||
"windows/amd64",
|
||||
"windows/arm",
|
||||
}
|
||||
return completions, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteArch - Autocomplete architectures supported by container engines
|
||||
func AutocompleteArch(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
completions := []string{
|
||||
"386",
|
||||
"amd64",
|
||||
"arm",
|
||||
"arm64",
|
||||
"ppc64",
|
||||
"ppc64le",
|
||||
"mips",
|
||||
"mipsle",
|
||||
"mips64",
|
||||
"mips64le",
|
||||
"riscv64",
|
||||
"s390x",
|
||||
}
|
||||
|
||||
return completions, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
// AutocompleteOS - Autocomplete OS supported by container engines
|
||||
func AutocompleteOS(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
completions := []string{"linux", "windows"}
|
||||
return completions, cobra.ShellCompDirectiveNoFileComp
|
||||
}
|
||||
|
||||
13
vendor/github.com/containers/common/pkg/config/config.go
generated
vendored
13
vendor/github.com/containers/common/pkg/config/config.go
generated
vendored
@@ -746,13 +746,20 @@ func (c *Config) FindConmon() (string, error) {
|
||||
}
|
||||
|
||||
// GetDefaultEnv returns the environment variables for the container.
|
||||
// It will checn the HTTPProxy and HostEnv booleans and add the appropriate
|
||||
// It will check the HTTPProxy and HostEnv booleans and add the appropriate
|
||||
// environment variables to the container.
|
||||
func (c *Config) GetDefaultEnv() []string {
|
||||
return c.GetDefaultEnvEx(c.Containers.EnvHost, c.Containers.HTTPProxy)
|
||||
}
|
||||
|
||||
// GetDefaultEnvEx returns the environment variables for the container.
|
||||
// It will check the HTTPProxy and HostEnv boolean parameters and return the appropriate
|
||||
// environment variables for the container.
|
||||
func (c *Config) GetDefaultEnvEx(envHost, httpProxy bool) []string {
|
||||
var env []string
|
||||
if c.Containers.EnvHost {
|
||||
if envHost {
|
||||
env = append(env, os.Environ()...)
|
||||
} else if c.Containers.HTTPProxy {
|
||||
} else if httpProxy {
|
||||
proxy := []string{"http_proxy", "https_proxy", "ftp_proxy", "no_proxy", "HTTP_PROXY", "HTTPS_PROXY", "FTP_PROXY", "NO_PROXY"}
|
||||
for _, p := range proxy {
|
||||
if val, ok := os.LookupEnv(p); ok {
|
||||
|
||||
2
vendor/github.com/containers/common/pkg/config/default.go
generated
vendored
2
vendor/github.com/containers/common/pkg/config/default.go
generated
vendored
@@ -184,7 +184,7 @@ func DefaultConfig() (*Config, error) {
|
||||
"TERM=xterm",
|
||||
},
|
||||
EnvHost: false,
|
||||
HTTPProxy: false,
|
||||
HTTPProxy: true,
|
||||
Init: false,
|
||||
InitPath: "",
|
||||
IPCNS: "private",
|
||||
|
||||
12
vendor/github.com/containers/common/pkg/retry/retry.go
generated
vendored
12
vendor/github.com/containers/common/pkg/retry/retry.go
generated
vendored
@@ -30,7 +30,7 @@ func RetryIfNecessary(ctx context.Context, operation func() error, retryOptions
|
||||
if retryOptions.Delay != 0 {
|
||||
delay = retryOptions.Delay
|
||||
}
|
||||
logrus.Infof("Warning: failed, retrying in %s ... (%d/%d). Error: %v", delay, attempt+1, retryOptions.MaxRetry, err)
|
||||
logrus.Warnf("failed, retrying in %s ... (%d/%d). Error: %v", delay, attempt+1, retryOptions.MaxRetry, err)
|
||||
select {
|
||||
case <-time.After(delay):
|
||||
break
|
||||
@@ -69,7 +69,7 @@ func isRetryable(err error) bool {
|
||||
}
|
||||
return isRetryable(e.Err)
|
||||
case syscall.Errno:
|
||||
return e != syscall.ECONNREFUSED
|
||||
return shouldRestart(e)
|
||||
case errcode.Errors:
|
||||
// if this error is a group of errors, process them all in turn
|
||||
for i := range e {
|
||||
@@ -93,3 +93,11 @@ func isRetryable(err error) bool {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func shouldRestart(e error) bool {
|
||||
switch e {
|
||||
case syscall.ECONNREFUSED, syscall.EINTR, syscall.EAGAIN, syscall.EBUSY, syscall.ENETDOWN, syscall.ENETUNREACH, syscall.ENETRESET, syscall.ECONNABORTED, syscall.ECONNRESET, syscall.ETIMEDOUT, syscall.EHOSTDOWN, syscall.EHOSTUNREACH:
|
||||
return true
|
||||
}
|
||||
return shouldRestartPlatform(e)
|
||||
}
|
||||
|
||||
9
vendor/github.com/containers/common/pkg/retry/retry_linux.go
generated
vendored
Normal file
9
vendor/github.com/containers/common/pkg/retry/retry_linux.go
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
package retry
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func shouldRestartPlatform(e error) bool {
|
||||
return e == syscall.ERESTART
|
||||
}
|
||||
7
vendor/github.com/containers/common/pkg/retry/retry_unsupported.go
generated
vendored
Normal file
7
vendor/github.com/containers/common/pkg/retry/retry_unsupported.go
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// +build !linux
|
||||
|
||||
package retry
|
||||
|
||||
func shouldRestartPlatform(e error) bool {
|
||||
return false
|
||||
}
|
||||
1
vendor/github.com/containers/common/pkg/seccomp/default_linux.go
generated
vendored
1
vendor/github.com/containers/common/pkg/seccomp/default_linux.go
generated
vendored
@@ -378,7 +378,6 @@ func DefaultProfile() *Seccomp {
|
||||
"utimensat_time64",
|
||||
"utimes",
|
||||
"vfork",
|
||||
"vmsplice",
|
||||
"wait4",
|
||||
"waitid",
|
||||
"waitpid",
|
||||
|
||||
1
vendor/github.com/containers/common/pkg/seccomp/seccomp.json
generated
vendored
1
vendor/github.com/containers/common/pkg/seccomp/seccomp.json
generated
vendored
@@ -378,7 +378,6 @@
|
||||
"utimensat_time64",
|
||||
"utimes",
|
||||
"vfork",
|
||||
"vmsplice",
|
||||
"wait4",
|
||||
"waitid",
|
||||
"waitpid",
|
||||
|
||||
2
vendor/github.com/containers/common/version/version.go
generated
vendored
2
vendor/github.com/containers/common/version/version.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
package version
|
||||
|
||||
// Version is the version of the build.
|
||||
const Version = "0.31.2"
|
||||
const Version = "0.33.0"
|
||||
|
||||
Reference in New Issue
Block a user