mirror of
https://github.com/containers/podman.git
synced 2025-12-02 11:08:36 +08:00
Update vendor of containers/(storage,image)
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
14
vendor/github.com/containers/common/libnetwork/etchosts/hosts.go
generated
vendored
14
vendor/github.com/containers/common/libnetwork/etchosts/hosts.go
generated
vendored
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
const (
|
||||
HostContainersInternal = "host.containers.internal"
|
||||
HostGateway = "host-gateway"
|
||||
localhost = "localhost"
|
||||
)
|
||||
|
||||
@@ -98,7 +99,7 @@ func Remove(file string, entries HostEntries) error {
|
||||
|
||||
// new see comment on New()
|
||||
func newHost(params *Params) error {
|
||||
entries, err := parseExtraHosts(params.ExtraHosts)
|
||||
entries, err := parseExtraHosts(params.ExtraHosts, params.HostContainersInternalIP)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -230,7 +231,7 @@ func checkIfEntryExists(current HostEntry, entries HostEntries) bool {
|
||||
// parseExtraHosts converts a slice of "name:ip" string to entries.
|
||||
// Because podman and buildah both store the extra hosts in this format
|
||||
// we convert it here instead of having to this on the caller side.
|
||||
func parseExtraHosts(extraHosts []string) (HostEntries, error) {
|
||||
func parseExtraHosts(extraHosts []string, hostContainersInternalIP string) (HostEntries, error) {
|
||||
entries := make(HostEntries, 0, len(extraHosts))
|
||||
for _, entry := range extraHosts {
|
||||
values := strings.SplitN(entry, ":", 2)
|
||||
@@ -243,7 +244,14 @@ func parseExtraHosts(extraHosts []string) (HostEntries, error) {
|
||||
if values[1] == "" {
|
||||
return nil, fmt.Errorf("IP address in host entry %q is empty", entry)
|
||||
}
|
||||
e := HostEntry{IP: values[1], Names: []string{values[0]}}
|
||||
ip := values[1]
|
||||
if values[1] == HostGateway {
|
||||
if hostContainersInternalIP == "" {
|
||||
return nil, fmt.Errorf("unable to replace %q of host entry %q: host containers internal IP address is empty", HostGateway, entry)
|
||||
}
|
||||
ip = hostContainersInternalIP
|
||||
}
|
||||
e := HostEntry{IP: ip, Names: []string{values[0]}}
|
||||
entries = append(entries, e)
|
||||
}
|
||||
return entries, nil
|
||||
|
||||
Reference in New Issue
Block a user