aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-09-30 16:36:16 -0300
committerSilvio Rhatto <rhatto@riseup.net>2016-09-30 16:36:16 -0300
commitb385b9d83d4aa69de834c8e062fa9fff03cdf79b (patch)
tree00823e68401ecb1a1fbf5a29f810aaa5ae21e204
parent71a80284fbe83dc2eebefaea0fc07dc2e1dc3afc (diff)
downloadhydra-b385b9d83d4aa69de834c8e062fa9fff03cdf79b.tar.gz
hydra-b385b9d83d4aa69de834c8e062fa9fff03cdf79b.tar.bz2
Support for localhost at hydra_get_fqdn_from_nodename
-rw-r--r--lib/hydra/misc14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/hydra/misc b/lib/hydra/misc
index 0105760..0823148 100644
--- a/lib/hydra/misc
+++ b/lib/hydra/misc
@@ -147,14 +147,20 @@ function hydra_next_debian_release {
# Get fqdn from nodename
function hydra_get_fqdn_from_nodename {
- if [ -z "$1" ]; then
+ local node="$1"
+
+ if [ -z "$node" ]; then
return
fi
- if echo $1 | grep -q '\.'; then
- echo $1
+ if [ "$node" == "localhost" ]; then
+ facter fqdn
+ fi
+
+ if echo $node | grep -q '\.'; then
+ echo $node
else
domain=`hydra $HYDRA config domain`
- echo $1.$domain
+ echo $node.$domain
fi
}