mirror of https://github.com/apache/jclouds.git
Issue #1240: Improved handling of /etc/hosts updates by ensure_hostname_in_hosts
This commit is contained in:
parent
3b873e2eca
commit
74c0b42b87
|
@ -115,7 +115,10 @@ function ensure_netutils_yum() {
|
||||||
# most network services require that the hostname is in
|
# most network services require that the hostname is in
|
||||||
# the /etc/hosts file, or they won't operate
|
# the /etc/hosts file, or they won't operate
|
||||||
function ensure_hostname_in_hosts() {
|
function ensure_hostname_in_hosts() {
|
||||||
egrep -q `hostname` /etc/hosts || awk -v hostname=`hostname` 'END { print $1" "hostname }' /proc/net/arp >> /etc/hosts
|
# NOTE:
|
||||||
|
# 1. We blindly trust existing hostname settings in /etc/hosts
|
||||||
|
# 2. We assume hostname supports the -i option to return the default NICs IP address
|
||||||
|
egrep -q `hostname` /etc/hosts || echo "`hostname -i` `hostname`" >> /etc/hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
# download locations for many services are at public dns
|
# download locations for many services are at public dns
|
||||||
|
|
|
@ -115,7 +115,10 @@ function ensure_netutils_yum() {
|
||||||
# most network services require that the hostname is in
|
# most network services require that the hostname is in
|
||||||
# the /etc/hosts file, or they won't operate
|
# the /etc/hosts file, or they won't operate
|
||||||
function ensure_hostname_in_hosts() {
|
function ensure_hostname_in_hosts() {
|
||||||
egrep -q `hostname` /etc/hosts || awk -v hostname=`hostname` 'END { print $1" "hostname }' /proc/net/arp >> /etc/hosts
|
# NOTE:
|
||||||
|
# 1. We blindly trust existing hostname settings in /etc/hosts
|
||||||
|
# 2. We assume hostname supports the -i option to return the default NICs IP address
|
||||||
|
egrep -q `hostname` /etc/hosts || echo "`hostname -i` `hostname`" >> /etc/hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
# download locations for many services are at public dns
|
# download locations for many services are at public dns
|
||||||
|
|
|
@ -115,7 +115,10 @@ function ensure_netutils_yum() {
|
||||||
# most network services require that the hostname is in
|
# most network services require that the hostname is in
|
||||||
# the /etc/hosts file, or they won't operate
|
# the /etc/hosts file, or they won't operate
|
||||||
function ensure_hostname_in_hosts() {
|
function ensure_hostname_in_hosts() {
|
||||||
egrep -q `hostname` /etc/hosts || awk -v hostname=`hostname` 'END { print $1" "hostname }' /proc/net/arp >> /etc/hosts
|
# NOTE:
|
||||||
|
# 1. We blindly trust existing hostname settings in /etc/hosts
|
||||||
|
# 2. We assume hostname supports the -i option to return the default NICs IP address
|
||||||
|
egrep -q `hostname` /etc/hosts || echo "`hostname -i` `hostname`" >> /etc/hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
# download locations for many services are at public dns
|
# download locations for many services are at public dns
|
||||||
|
|
|
@ -112,7 +112,10 @@ function ensure_netutils_yum() {
|
||||||
# most network services require that the hostname is in
|
# most network services require that the hostname is in
|
||||||
# the /etc/hosts file, or they won't operate
|
# the /etc/hosts file, or they won't operate
|
||||||
function ensure_hostname_in_hosts() {
|
function ensure_hostname_in_hosts() {
|
||||||
egrep -q `hostname` /etc/hosts || awk -v hostname=`hostname` 'END { print $1" "hostname }' /proc/net/arp >> /etc/hosts
|
# NOTE:
|
||||||
|
# 1. We blindly trust existing hostname settings in /etc/hosts
|
||||||
|
# 2. We assume hostname supports the -i option to return the default NICs IP address
|
||||||
|
egrep -q `hostname` /etc/hosts || echo "`hostname -i` `hostname`" >> /etc/hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
# download locations for many services are at public dns
|
# download locations for many services are at public dns
|
||||||
|
|
|
@ -30,7 +30,10 @@ function ensure_netutils_yum() {
|
||||||
# most network services require that the hostname is in
|
# most network services require that the hostname is in
|
||||||
# the /etc/hosts file, or they won't operate
|
# the /etc/hosts file, or they won't operate
|
||||||
function ensure_hostname_in_hosts() {
|
function ensure_hostname_in_hosts() {
|
||||||
egrep -q `hostname` /etc/hosts || awk -v hostname=`hostname` 'END { print $1" "hostname }' /proc/net/arp >> /etc/hosts
|
# NOTE:
|
||||||
|
# 1. We blindly trust existing hostname settings in /etc/hosts
|
||||||
|
# 2. We assume hostname supports the -i option to return the default NICs IP address
|
||||||
|
egrep -q `hostname` /etc/hosts || echo "`hostname -i` `hostname`" >> /etc/hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
# download locations for many services are at public dns
|
# download locations for many services are at public dns
|
||||||
|
|
|
@ -115,7 +115,10 @@ function ensure_netutils_yum() {
|
||||||
# most network services require that the hostname is in
|
# most network services require that the hostname is in
|
||||||
# the /etc/hosts file, or they won't operate
|
# the /etc/hosts file, or they won't operate
|
||||||
function ensure_hostname_in_hosts() {
|
function ensure_hostname_in_hosts() {
|
||||||
egrep -q `hostname` /etc/hosts || awk -v hostname=`hostname` 'END { print $1" "hostname }' /proc/net/arp >> /etc/hosts
|
# NOTE:
|
||||||
|
# 1. We blindly trust existing hostname settings in /etc/hosts
|
||||||
|
# 2. We assume hostname supports the -i option to return the default NICs IP address
|
||||||
|
egrep -q `hostname` /etc/hosts || echo "`hostname -i` `hostname`" >> /etc/hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
# download locations for many services are at public dns
|
# download locations for many services are at public dns
|
||||||
|
|
|
@ -115,7 +115,10 @@ function ensure_netutils_yum() {
|
||||||
# most network services require that the hostname is in
|
# most network services require that the hostname is in
|
||||||
# the /etc/hosts file, or they won't operate
|
# the /etc/hosts file, or they won't operate
|
||||||
function ensure_hostname_in_hosts() {
|
function ensure_hostname_in_hosts() {
|
||||||
egrep -q `hostname` /etc/hosts || awk -v hostname=`hostname` 'END { print $1" "hostname }' /proc/net/arp >> /etc/hosts
|
# NOTE:
|
||||||
|
# 1. We blindly trust existing hostname settings in /etc/hosts
|
||||||
|
# 2. We assume hostname supports the -i option to return the default NICs IP address
|
||||||
|
egrep -q `hostname` /etc/hosts || echo "`hostname -i` `hostname`" >> /etc/hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
# download locations for many services are at public dns
|
# download locations for many services are at public dns
|
||||||
|
|
|
@ -115,7 +115,10 @@ function ensure_netutils_yum() {
|
||||||
# most network services require that the hostname is in
|
# most network services require that the hostname is in
|
||||||
# the /etc/hosts file, or they won't operate
|
# the /etc/hosts file, or they won't operate
|
||||||
function ensure_hostname_in_hosts() {
|
function ensure_hostname_in_hosts() {
|
||||||
egrep -q `hostname` /etc/hosts || awk -v hostname=`hostname` 'END { print $1" "hostname }' /proc/net/arp >> /etc/hosts
|
# NOTE:
|
||||||
|
# 1. We blindly trust existing hostname settings in /etc/hosts
|
||||||
|
# 2. We assume hostname supports the -i option to return the default NICs IP address
|
||||||
|
egrep -q `hostname` /etc/hosts || echo "`hostname -i` `hostname`" >> /etc/hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
# download locations for many services are at public dns
|
# download locations for many services are at public dns
|
||||||
|
|
|
@ -115,7 +115,10 @@ function ensure_netutils_yum() {
|
||||||
# most network services require that the hostname is in
|
# most network services require that the hostname is in
|
||||||
# the /etc/hosts file, or they won't operate
|
# the /etc/hosts file, or they won't operate
|
||||||
function ensure_hostname_in_hosts() {
|
function ensure_hostname_in_hosts() {
|
||||||
egrep -q `hostname` /etc/hosts || awk -v hostname=`hostname` 'END { print $1" "hostname }' /proc/net/arp >> /etc/hosts
|
# NOTE:
|
||||||
|
# 1. We blindly trust existing hostname settings in /etc/hosts
|
||||||
|
# 2. We assume hostname supports the -i option to return the default NICs IP address
|
||||||
|
egrep -q `hostname` /etc/hosts || echo "`hostname -i` `hostname`" >> /etc/hosts
|
||||||
}
|
}
|
||||||
|
|
||||||
# download locations for many services are at public dns
|
# download locations for many services are at public dns
|
||||||
|
|
Loading…
Reference in New Issue