Merge pull request #1241 from carlpulley/ensure_hostname_in_hosts

Issue #1240: Improved handling of /etc/hosts updates by ensure_hostname_in_hosts
This commit is contained in:
Adrian Cole 2013-01-24 16:29:53 -08:00
commit 77b8a8c63f
9 changed files with 36 additions and 9 deletions

View File

@ -115,7 +115,10 @@ function ensure_netutils_yum() {
# most network services require that the hostname is in
# the /etc/hosts file, or they won't operate
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

View File

@ -115,7 +115,10 @@ function ensure_netutils_yum() {
# most network services require that the hostname is in
# the /etc/hosts file, or they won't operate
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

View File

@ -115,7 +115,10 @@ function ensure_netutils_yum() {
# most network services require that the hostname is in
# the /etc/hosts file, or they won't operate
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

View File

@ -112,7 +112,10 @@ function ensure_netutils_yum() {
# most network services require that the hostname is in
# the /etc/hosts file, or they won't operate
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

View File

@ -30,7 +30,10 @@ function ensure_netutils_yum() {
# most network services require that the hostname is in
# the /etc/hosts file, or they won't operate
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

View File

@ -115,7 +115,10 @@ function ensure_netutils_yum() {
# most network services require that the hostname is in
# the /etc/hosts file, or they won't operate
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

View File

@ -115,7 +115,10 @@ function ensure_netutils_yum() {
# most network services require that the hostname is in
# the /etc/hosts file, or they won't operate
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

View File

@ -115,7 +115,10 @@ function ensure_netutils_yum() {
# most network services require that the hostname is in
# the /etc/hosts file, or they won't operate
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

View File

@ -115,7 +115,10 @@ function ensure_netutils_yum() {
# most network services require that the hostname is in
# the /etc/hosts file, or they won't operate
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