mirror of
https://github.com/containers/podman.git
synced 2025-12-18 22:59:47 +08:00
Bump github.com/containers/common from 0.15.2 to 0.16.0
Bumps [github.com/containers/common](https://github.com/containers/common) from 0.15.2 to 0.16.0. - [Release notes](https://github.com/containers/common/releases) - [Commits](https://github.com/containers/common/compare/v0.15.2...v0.16.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
82
vendor/github.com/containers/common/pkg/config/config.go
generated
vendored
82
vendor/github.com/containers/common/pkg/config/config.go
generated
vendored
@@ -165,9 +165,12 @@ type ContainersConfig struct {
|
||||
// ShmSize holds the size of /dev/shm.
|
||||
ShmSize string `toml:"shm_size,omitempty"`
|
||||
|
||||
//TZ sets the timezone inside the container
|
||||
// TZ sets the timezone inside the container
|
||||
TZ string `toml:"tz,omitempty"`
|
||||
|
||||
// Umask is the umask inside the container.
|
||||
Umask string `toml:"umask,omitempty"`
|
||||
|
||||
// UTSNS indicates how to create a UTS namespace for the container
|
||||
UTSNS string `toml:"utsns,omitempty"`
|
||||
|
||||
@@ -198,7 +201,7 @@ type EngineConfig struct {
|
||||
// The first path pointing to a valid file will be used.
|
||||
ConmonPath []string `toml:"conmon_path,omitempty"`
|
||||
|
||||
//DetachKeys is the sequence of keys used to detach a container.
|
||||
// DetachKeys is the sequence of keys used to detach a container.
|
||||
DetachKeys string `toml:"detach_keys,omitempty"`
|
||||
|
||||
// EnablePortReservation determines whether engine will reserve ports on the
|
||||
@@ -272,12 +275,20 @@ type EngineConfig struct {
|
||||
// Indicates whether the application should be running in Remote mode
|
||||
Remote bool `toml:"-"`
|
||||
|
||||
// RemoteURI is deprecated, see ActiveService
|
||||
// RemoteURI containers connection information used to connect to remote system.
|
||||
RemoteURI string `toml:"remote_uri,omitempty"`
|
||||
|
||||
// Identity key file for RemoteURI
|
||||
// RemoteIdentity is deprecated, ServiceDestinations
|
||||
// RemoteIdentity key file for RemoteURI
|
||||
RemoteIdentity string `toml:"remote_identity,omitempty"`
|
||||
|
||||
// ActiveService index to Destinations added v2.0.3
|
||||
ActiveService string `toml:"active_service,omitempty"`
|
||||
|
||||
// Destinations mapped by service Names
|
||||
ServiceDestinations map[string]Destination `toml:"service_destinations,omitempty"`
|
||||
|
||||
// RuntimePath is the path to OCI runtime binary for launching containers.
|
||||
// The first path pointing to a valid file will be used This is used only
|
||||
// when there are no OCIRuntime/OCIRuntimes defined. It is used only to be
|
||||
@@ -393,6 +404,15 @@ type NetworkConfig struct {
|
||||
NetworkConfigDir string `toml:"network_config_dir,omitempty"`
|
||||
}
|
||||
|
||||
// Destination represents destination for remote service
|
||||
type Destination struct {
|
||||
// URI, required. Example: ssh://root@example.com:22/run/podman/podman.sock
|
||||
URI string `toml:"uri"`
|
||||
|
||||
// Identity file with ssh key, optional
|
||||
Identity string `toml:"identity,omitempty"`
|
||||
}
|
||||
|
||||
// NewConfig creates a new Config. It starts with an empty config and, if
|
||||
// specified, merges the config at `userConfigPath` path. Depending if we're
|
||||
// running as root or rootless, we then merge the system configuration followed
|
||||
@@ -582,6 +602,10 @@ func (c *ContainersConfig) Validate() error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := c.validateUmask(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if c.LogSizeMax >= 0 && c.LogSizeMax < OCIBufSize {
|
||||
return fmt.Errorf("log size max should be negative or >= %d", OCIBufSize)
|
||||
}
|
||||
@@ -828,9 +852,9 @@ func stringsEq(a, b []string) bool {
|
||||
}
|
||||
|
||||
var (
|
||||
configOnce sync.Once
|
||||
configErr error
|
||||
config *Config
|
||||
configErr error
|
||||
configMutex sync.Mutex
|
||||
config *Config
|
||||
)
|
||||
|
||||
// Default returns the default container config.
|
||||
@@ -845,9 +869,12 @@ var (
|
||||
// The system defaults container config files can be overwritten using the
|
||||
// CONTAINERS_CONF environment variable. This is usually done for testing.
|
||||
func Default() (*Config, error) {
|
||||
configOnce.Do(func() {
|
||||
config, configErr = NewConfig("")
|
||||
})
|
||||
configMutex.Lock()
|
||||
defer configMutex.Unlock()
|
||||
if config != nil || configErr != nil {
|
||||
return config, configErr
|
||||
}
|
||||
config, configErr = NewConfig("")
|
||||
return config, configErr
|
||||
}
|
||||
|
||||
@@ -879,8 +906,8 @@ func customConfigFile() (string, error) {
|
||||
return OverrideContainersConfig, nil
|
||||
}
|
||||
|
||||
//ReadCustomConfig reads the custom config and only generates a config based on it
|
||||
//If the custom config file does not exists, function will return an empty config
|
||||
// ReadCustomConfig reads the custom config and only generates a config based on it
|
||||
// If the custom config file does not exists, function will return an empty config
|
||||
func ReadCustomConfig() (*Config, error) {
|
||||
path, err := customConfigFile()
|
||||
if err != nil {
|
||||
@@ -936,3 +963,36 @@ func (c *Config) Write() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Reload clean the cached config and reloads the configuration from containers.conf files
|
||||
// This function is meant to be used for long-running processes that need to reload potential changes made to
|
||||
// the cached containers.conf files.
|
||||
func Reload() (*Config, error) {
|
||||
configMutex.Lock()
|
||||
configErr = nil
|
||||
config = nil
|
||||
configMutex.Unlock()
|
||||
return Default()
|
||||
}
|
||||
|
||||
func (c *Config) ActiveDestination() (string, string, error){
|
||||
if uri, found := os.LookupEnv("CONTAINER_HOST"); found {
|
||||
var ident string
|
||||
if v, found := os.LookupEnv("CONTAINER_SSHKEY"); found {
|
||||
ident = v
|
||||
}
|
||||
return uri, ident, nil
|
||||
}
|
||||
|
||||
switch {
|
||||
case c.Engine.ActiveService != "":
|
||||
d, found := c.Engine.ServiceDestinations[c.Engine.ActiveService]
|
||||
if !found {
|
||||
return "", "", errors.Errorf("%q service destination not found", c.Engine.ActiveService)
|
||||
}
|
||||
return d.URI, d.Identity, nil
|
||||
case c.Engine.RemoteURI != "":
|
||||
return c.Engine.RemoteURI, c.Engine.RemoteIdentity, nil
|
||||
}
|
||||
return "", "", errors.New("no service destination configured")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user