mirror of
https://github.com/containers/podman.git
synced 2025-12-03 03:39:44 +08:00
container.conf: support attributed string slices
All `[]string`s in containers.conf have now been migrated to attributed string slices which require some adjustments in Buildah and Podman. [NO NEW TESTS NEEDED] Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
22
vendor/github.com/containers/buildah/run_linux.go
generated
vendored
22
vendor/github.com/containers/buildah/run_linux.go
generated
vendored
@@ -35,6 +35,7 @@ import (
|
||||
"github.com/containers/common/pkg/config"
|
||||
"github.com/containers/common/pkg/hooks"
|
||||
hooksExec "github.com/containers/common/pkg/hooks/exec"
|
||||
cutil "github.com/containers/common/pkg/util"
|
||||
"github.com/containers/storage/pkg/idtools"
|
||||
"github.com/containers/storage/pkg/ioutils"
|
||||
"github.com/containers/storage/pkg/lockfile"
|
||||
@@ -261,7 +262,7 @@ func (b *Builder) Run(command []string, options RunOptions) error {
|
||||
rootIDPair := &idtools.IDPair{UID: int(rootUID), GID: int(rootGID)}
|
||||
|
||||
hostFile := ""
|
||||
if !options.NoHosts && !contains(volumes, config.DefaultHostsFile) && options.ConfigureNetwork != define.NetworkDisabled {
|
||||
if !options.NoHosts && !cutil.StringInSlice(config.DefaultHostsFile, volumes) && options.ConfigureNetwork != define.NetworkDisabled {
|
||||
hostFile, err = b.generateHosts(path, rootIDPair, mountPoint, spec)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -269,19 +270,16 @@ func (b *Builder) Run(command []string, options RunOptions) error {
|
||||
bindFiles[config.DefaultHostsFile] = hostFile
|
||||
}
|
||||
|
||||
// generate /etc/hostname if the user intentionally did not override
|
||||
if !(contains(volumes, "/etc/hostname")) {
|
||||
if _, ok := bindFiles["/etc/hostname"]; !ok {
|
||||
hostFile, err := b.generateHostname(path, spec.Hostname, rootIDPair)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Bind /etc/hostname
|
||||
bindFiles["/etc/hostname"] = hostFile
|
||||
if !options.NoHostname && !(cutil.StringInSlice("/etc/hostname", volumes)) {
|
||||
hostFile, err := b.generateHostname(path, spec.Hostname, rootIDPair)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Bind /etc/hostname
|
||||
bindFiles["/etc/hostname"] = hostFile
|
||||
}
|
||||
|
||||
if !contains(volumes, resolvconf.DefaultResolvConf) && options.ConfigureNetwork != define.NetworkDisabled && !(len(b.CommonBuildOpts.DNSServers) == 1 && strings.ToLower(b.CommonBuildOpts.DNSServers[0]) == "none") {
|
||||
if !cutil.StringInSlice(resolvconf.DefaultResolvConf, volumes) && options.ConfigureNetwork != define.NetworkDisabled && !(len(b.CommonBuildOpts.DNSServers) == 1 && strings.ToLower(b.CommonBuildOpts.DNSServers[0]) == "none") {
|
||||
resolvFile, err := b.addResolvConf(path, rootIDPair, b.CommonBuildOpts.DNSServers, b.CommonBuildOpts.DNSSearch, b.CommonBuildOpts.DNSOptions, spec.Linux.Namespaces)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -465,7 +463,7 @@ func addCommonOptsToSpec(commonOpts *define.CommonBuildOptions, g *generate.Gene
|
||||
return fmt.Errorf("failed to get container config: %w", err)
|
||||
}
|
||||
// Other process resource limits
|
||||
if err := addRlimits(commonOpts.Ulimit, g, defaultContainerConfig.Containers.DefaultUlimits); err != nil {
|
||||
if err := addRlimits(commonOpts.Ulimit, g, defaultContainerConfig.Containers.DefaultUlimits.Get()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user