Merge pull request #1245 from carlpulley/ensure_hostname_in_hosts

Issue #1240: Updated ensure_hostname_in_hosts to use SSH_CONNECTION
This commit is contained in:
Adrian Cole 2013-01-25 09:46:59 -08:00
commit 982c502413
9 changed files with 63 additions and 36 deletions

View File

@ -115,10 +115,13 @@ 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() {
# 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
[ -n "$SSH_CONNECTION" ] && {
local ipaddr=`echo $SSH_CONNECTION | awk '{print $3}'`
} || {
local ipaddr=`hostname -i`
}
# NOTE: we blindly trust existing hostname settings in /etc/hosts
egrep -q `hostname` /etc/hosts || echo "$ipaddr `hostname`" >> /etc/hosts
}
# download locations for many services are at public dns

View File

@ -115,10 +115,13 @@ 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() {
# 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
[ -n "$SSH_CONNECTION" ] && {
local ipaddr=`echo $SSH_CONNECTION | awk '{print $3}'`
} || {
local ipaddr=`hostname -i`
}
# NOTE: we blindly trust existing hostname settings in /etc/hosts
egrep -q `hostname` /etc/hosts || echo "$ipaddr `hostname`" >> /etc/hosts
}
# download locations for many services are at public dns

View File

@ -115,10 +115,13 @@ 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() {
# 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
[ -n "$SSH_CONNECTION" ] && {
local ipaddr=`echo $SSH_CONNECTION | awk '{print $3}'`
} || {
local ipaddr=`hostname -i`
}
# NOTE: we blindly trust existing hostname settings in /etc/hosts
egrep -q `hostname` /etc/hosts || echo "$ipaddr `hostname`" >> /etc/hosts
}
# download locations for many services are at public dns

View File

@ -112,10 +112,13 @@ 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() {
# 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
[ -n "$SSH_CONNECTION" ] && {
local ipaddr=`echo $SSH_CONNECTION | awk '{print $3}'`
} || {
local ipaddr=`hostname -i`
}
# NOTE: we blindly trust existing hostname settings in /etc/hosts
egrep -q `hostname` /etc/hosts || echo "$ipaddr `hostname`" >> /etc/hosts
}
# download locations for many services are at public dns

View File

@ -30,10 +30,13 @@ 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() {
# 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
[ -n "$SSH_CONNECTION" ] && {
local ipaddr=`echo $SSH_CONNECTION | awk '{print $3}'`
} || {
local ipaddr=`hostname -i`
}
# NOTE: we blindly trust existing hostname settings in /etc/hosts
egrep -q `hostname` /etc/hosts || echo "$ipaddr `hostname`" >> /etc/hosts
}
# download locations for many services are at public dns

View File

@ -115,10 +115,13 @@ 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() {
# 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
[ -n "$SSH_CONNECTION" ] && {
local ipaddr=`echo $SSH_CONNECTION | awk '{print $3}'`
} || {
local ipaddr=`hostname -i`
}
# NOTE: we blindly trust existing hostname settings in /etc/hosts
egrep -q `hostname` /etc/hosts || echo "$ipaddr `hostname`" >> /etc/hosts
}
# download locations for many services are at public dns

View File

@ -115,10 +115,13 @@ 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() {
# 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
[ -n "$SSH_CONNECTION" ] && {
local ipaddr=`echo $SSH_CONNECTION | awk '{print $3}'`
} || {
local ipaddr=`hostname -i`
}
# NOTE: we blindly trust existing hostname settings in /etc/hosts
egrep -q `hostname` /etc/hosts || echo "$ipaddr `hostname`" >> /etc/hosts
}
# download locations for many services are at public dns

View File

@ -115,10 +115,13 @@ 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() {
# 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
[ -n "$SSH_CONNECTION" ] && {
local ipaddr=`echo $SSH_CONNECTION | awk '{print $3}'`
} || {
local ipaddr=`hostname -i`
}
# NOTE: we blindly trust existing hostname settings in /etc/hosts
egrep -q `hostname` /etc/hosts || echo "$ipaddr `hostname`" >> /etc/hosts
}
# download locations for many services are at public dns

View File

@ -115,10 +115,13 @@ 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() {
# 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
[ -n "$SSH_CONNECTION" ] && {
local ipaddr=`echo $SSH_CONNECTION | awk '{print $3}'`
} || {
local ipaddr=`hostname -i`
}
# NOTE: we blindly trust existing hostname settings in /etc/hosts
egrep -q `hostname` /etc/hosts || echo "$ipaddr `hostname`" >> /etc/hosts
}
# download locations for many services are at public dns