summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2019-02-23 16:17:35 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2019-02-23 16:27:56 +0000
commita7fea4cfce73c8d1d271d8d0bfcf7b0b0802ad47 (patch)
tree18aacb25efcf8376f31f97d34cf664b21ec83c3b
parentHarmonizing debconf values for container debconf create script. (diff)
downloadcompute-tools-a7fea4cfce73c8d1d271d8d0bfcf7b0b0802ad47.tar.xz
compute-tools-a7fea4cfce73c8d1d271d8d0bfcf7b0b0802ad47.zip
Using hostname fallback if FQDN is not set.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rwxr-xr-xbin/container2
-rwxr-xr-xlib/container/auto2
-rwxr-xr-xlib/container/create2
-rwxr-xr-xlib/container/list2
-rwxr-xr-xlib/container/top2
-rw-r--r--share/bash-completion/container2
-rwxr-xr-xshare/scripts/debconf.d/0003-debconf2
7 files changed, 7 insertions, 7 deletions
diff --git a/bin/container b/bin/container
index 5df0fff..ac8feff 100755
--- a/bin/container
+++ b/bin/container
@@ -67,7 +67,7 @@ do
create|remove|rm|restart|start|stop)
USER="${SUDO_USER:-${USER}}"
DATE="$(date +%Y-%m-%d\ %H:%M:%S)"
- HOST="$(hostname -f)"
+ HOST="$(hostname -f 2> /dev/null || hostname)"
# logfile
echo "${DATE} ${HOST} ${USER} ${PROGRAM} ${COMMAND} ${OPTIONS}" >> "/var/log/${PROJECT}/${PROGRAM}.log"
diff --git a/lib/container/auto b/lib/container/auto
index d6a76b7..83c9a57 100755
--- a/lib/container/auto
+++ b/lib/container/auto
@@ -85,7 +85,7 @@ then
Usage
fi
-HOST="$(hostname -f)"
+HOST="$(hostname -f 2> /dev/null || hostname)"
# Pre hooks
for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}"
diff --git a/lib/container/create b/lib/container/create
index 469ba4d..43cad9b 100755
--- a/lib/container/create
+++ b/lib/container/create
@@ -178,7 +178,7 @@ EOF
;;
esac
-CNT_CONTAINER_SERVER="${CNT_CONTAINER_SERVER:-$(hostname -f)}"
+CNT_CONTAINER_SERVER="${CNT_CONTAINER_SERVER:-$(hostname -f 2> /dev/null || hostname)}"
# Pre hooks
for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}"
diff --git a/lib/container/list b/lib/container/list
index 57d0d2d..62f6a5b 100755
--- a/lib/container/list
+++ b/lib/container/list
@@ -115,7 +115,7 @@ Parameters "${@}"
LIST="${LIST:-started stopped}"
FORMAT="${FORMAT:-cli}"
-HOST="${HOST:-$(hostname -f)}"
+HOST="${HOST:-$(hostname -f 2> /dev/null || hostname)}"
CSV_SEPARATOR="${CSV_SEPARATOR:-,}"
diff --git a/lib/container/top b/lib/container/top
index 7e757c8..4978568 100755
--- a/lib/container/top
+++ b/lib/container/top
@@ -68,7 +68,7 @@ Usage ()
Parameters "${@}"
DELAY="${DELAY:-1}"
-HOST="$(hostname -f)"
+HOST="$(hostname -f 2> /dev/null || hostname)"
# Pre hooks
for FILE in "${HOOKS}/pre-${COMMAND}".* "${HOOKS}/${NAME}.pre-${COMMAND}"
diff --git a/share/bash-completion/container b/share/bash-completion/container
index b7a73ae..150ff71 100644
--- a/share/bash-completion/container
+++ b/share/bash-completion/container
@@ -123,7 +123,7 @@ _container()
list|ls)
case "${prev}" in
-h|--host)
- opts="true false $(hostname -f)"
+ opts="true false $(hostname -f 2> /dev/null || hostname)"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
diff --git a/share/scripts/debconf.d/0003-debconf b/share/scripts/debconf.d/0003-debconf
index 9183538..843d0b4 100755
--- a/share/scripts/debconf.d/0003-debconf
+++ b/share/scripts/debconf.d/0003-debconf
@@ -1092,7 +1092,7 @@ Internal_options ()
case "${CNT_CONTAINER_SERVER}" in
FQDN)
- CNT_CONTAINER_SERVER="$(hostname -f)"
+ CNT_CONTAINER_SERVER="$(hostname -f 2> /dev/null || hostname)"
;;
esac