mirror of
https://github.com/containers/buildah.git
synced 2026-02-05 09:45:38 +01:00
rename the hostFile var to reflect the value better
I got confused a bit there so make it clearer to readers that both are different. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@@ -202,13 +202,13 @@ func (b *Builder) Run(command []string, options RunOptions) error {
|
||||
}
|
||||
rootIDPair := &idtools.IDPair{UID: int(rootUID), GID: int(rootGID)}
|
||||
|
||||
hostFile := ""
|
||||
hostsFile := ""
|
||||
if !options.NoHosts && !slices.Contains(volumes, config.DefaultHostsFile) && options.ConfigureNetwork != define.NetworkDisabled {
|
||||
hostFile, err = b.generateHosts(path, rootIDPair, mountPoint, spec)
|
||||
hostsFile, err = b.generateHosts(path, rootIDPair, mountPoint, spec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
bindFiles[config.DefaultHostsFile] = hostFile
|
||||
bindFiles[config.DefaultHostsFile] = hostsFile
|
||||
}
|
||||
|
||||
if !slices.Contains(volumes, resolvconf.DefaultResolvConf) && options.ConfigureNetwork != define.NetworkDisabled && !(len(b.CommonBuildOpts.DNSServers) == 1 && strings.ToLower(b.CommonBuildOpts.DNSServers[0]) == "none") {
|
||||
@@ -290,7 +290,7 @@ func (b *Builder) Run(command []string, options RunOptions) error {
|
||||
} else {
|
||||
moreCreateArgs = nil
|
||||
}
|
||||
err = b.runUsingRuntimeSubproc(isolation, options, configureNetwork, networkString, moreCreateArgs, spec, mountPoint, path, containerName, b.Container, hostFile)
|
||||
err = b.runUsingRuntimeSubproc(isolation, options, configureNetwork, networkString, moreCreateArgs, spec, mountPoint, path, containerName, b.Container, hostsFile)
|
||||
case IsolationChroot:
|
||||
err = chroot.RunUsingChroot(spec, path, homeDir, options.Stdin, options.Stdout, options.Stderr)
|
||||
default:
|
||||
|
||||
14
run_linux.go
14
run_linux.go
@@ -260,22 +260,22 @@ func (b *Builder) Run(command []string, options RunOptions) error {
|
||||
}
|
||||
rootIDPair := &idtools.IDPair{UID: int(rootUID), GID: int(rootGID)}
|
||||
|
||||
hostFile := ""
|
||||
hostsFile := ""
|
||||
if !options.NoHosts && !slices.Contains(volumes, config.DefaultHostsFile) && options.ConfigureNetwork != define.NetworkDisabled {
|
||||
hostFile, err = b.generateHosts(path, rootIDPair, mountPoint, spec)
|
||||
hostsFile, err = b.generateHosts(path, rootIDPair, mountPoint, spec)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
bindFiles[config.DefaultHostsFile] = hostFile
|
||||
bindFiles[config.DefaultHostsFile] = hostsFile
|
||||
}
|
||||
|
||||
if !options.NoHostname && !(slices.Contains(volumes, "/etc/hostname")) {
|
||||
hostFile, err := b.generateHostname(path, spec.Hostname, rootIDPair)
|
||||
hostnameFile, err := b.generateHostname(path, spec.Hostname, rootIDPair)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Bind /etc/hostname
|
||||
bindFiles["/etc/hostname"] = hostFile
|
||||
bindFiles["/etc/hostname"] = hostnameFile
|
||||
}
|
||||
|
||||
if !slices.Contains(volumes, resolvconf.DefaultResolvConf) && options.ConfigureNetwork != define.NetworkDisabled && !(len(b.CommonBuildOpts.DNSServers) == 1 && strings.ToLower(b.CommonBuildOpts.DNSServers[0]) == "none") {
|
||||
@@ -362,7 +362,7 @@ rootless=%d
|
||||
moreCreateArgs = append(moreCreateArgs, "--no-pivot")
|
||||
}
|
||||
err = b.runUsingRuntimeSubproc(isolation, options, configureNetwork, networkString, moreCreateArgs, spec,
|
||||
mountPoint, path, define.Package+"-"+filepath.Base(path), b.Container, hostFile)
|
||||
mountPoint, path, define.Package+"-"+filepath.Base(path), b.Container, hostsFile)
|
||||
case IsolationChroot:
|
||||
err = chroot.RunUsingChroot(spec, path, homeDir, options.Stdin, options.Stdout, options.Stderr)
|
||||
case IsolationOCIRootless:
|
||||
@@ -371,7 +371,7 @@ rootless=%d
|
||||
moreCreateArgs = append(moreCreateArgs, "--no-pivot")
|
||||
}
|
||||
err = b.runUsingRuntimeSubproc(isolation, options, configureNetwork, networkString, moreCreateArgs, spec,
|
||||
mountPoint, path, define.Package+"-"+filepath.Base(path), b.Container, hostFile)
|
||||
mountPoint, path, define.Package+"-"+filepath.Base(path), b.Container, hostsFile)
|
||||
default:
|
||||
err = errors.New("don't know how to run this command")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user