mirror of https://github.com/apache/jclouds.git
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:
commit
77b8a8c63f
|
@ -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