[__hostname] Copy FQDN-logic to gencode-remote
Otherwise, the code-remote gets run on the remote every time.
This commit is contained in:
parent
3e7cf68de5
commit
cbb108d61c
2 changed files with 27 additions and 16 deletions
|
@ -20,17 +20,28 @@
|
|||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
if [ -f "$__object/parameter/name" ]; then
|
||||
name_should="$(cat "$__object/parameter/name")"
|
||||
else
|
||||
name_should="${__target_host%%.*}"
|
||||
fi
|
||||
|
||||
os=$(cat "$__global/explorer/os")
|
||||
name_running=$(cat "$__global/explorer/hostname")
|
||||
name_config=$(cat "$__object/explorer/persistent_hostname")
|
||||
has_hostnamectl=$(cat "$__object/explorer/has_hostnamectl")
|
||||
|
||||
|
||||
if [ -f "$__object/parameter/name" ]; then
|
||||
name_should="$(cat "$__object/parameter/name")"
|
||||
else
|
||||
case $os in
|
||||
# RedHat-derivatives and BSDs
|
||||
centos|fedora|redhat|scientific|freebsd|netbsd|openbsd)
|
||||
# Hostname is FQDN
|
||||
name_should="${__target_host}"
|
||||
;;
|
||||
*)
|
||||
# Hostname is only first component of FQDN
|
||||
name_should="${__target_host%%.*}"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# Check if the hostname is already correct
|
||||
#
|
||||
|
|
|
@ -24,16 +24,16 @@ os=$(cat "$__global/explorer/os")
|
|||
if [ -f "$__object/parameter/name" ]; then
|
||||
name_should="$(cat "$__object/parameter/name")"
|
||||
else
|
||||
case "$os" in
|
||||
# RedHat-derivatives and BSDs
|
||||
centos|fedora|redhat|scientific|freebsd|netbsd|openbsd)
|
||||
# Hostname is FQDN
|
||||
name_should="${__target_host}"
|
||||
;;
|
||||
*)
|
||||
# Hostname is only first component of FQDN
|
||||
name_should="${__target_host%%.*}"
|
||||
;;
|
||||
case $os in
|
||||
# RedHat-derivatives and BSDs
|
||||
centos|fedora|redhat|scientific|freebsd|netbsd|openbsd)
|
||||
# Hostname is FQDN
|
||||
name_should="${__target_host}"
|
||||
;;
|
||||
*)
|
||||
# Hostname is only first component of FQDN
|
||||
name_should="${__target_host%%.*}"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue