Issue #1240: Improved handling of /etc/hosts updates by ensure_hostname_in_hosts

This commit is contained in:
Carl Pulley 2013-01-24 22:49:17 +00:00
parent 3b873e2eca
commit 74c0b42b87
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