diff --git a/cdist/conf/type/__hostname/gencode-remote b/cdist/conf/type/__hostname/gencode-remote index 88ee069a..ef8eda51 100755 --- a/cdist/conf/type/__hostname/gencode-remote +++ b/cdist/conf/type/__hostname/gencode-remote @@ -1,6 +1,7 @@ #!/bin/sh # # 2014 Steven Armstrong (steven-cdist at armstrong.cc) +# 2014 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -18,7 +19,12 @@ # along with cdist. If not, see . # -name="$(cat "$__object/parameter/name")" +if [ -f "$__object/parameter/name" ]; then + name="$(cat "$__object/parameter/name")" +else + name="$__target_host" +fi + os=$(cat "$__global/explorer/os") echo "printf '%s\n' '$name' > /etc/hostname" diff --git a/cdist/conf/type/__hostname/manifest b/cdist/conf/type/__hostname/manifest index 3aa6de45..0544a6f9 100755 --- a/cdist/conf/type/__hostname/manifest +++ b/cdist/conf/type/__hostname/manifest @@ -1,6 +1,7 @@ #!/bin/sh # # 2012 Steven Armstrong (steven-cdist at armstrong.cc) +# 2014 Nico Schottelius (nico-cdist at schottelius.org) # # This file is part of cdist. # @@ -18,10 +19,6 @@ # along with cdist. If not, see . # -# set defaults -name="$(cat "$__object/parameter/name" 2>/dev/null \ - || echo "${__target_host%%.*}" | tee "$__object/parameter/name")" - os=$(cat "$__global/explorer/os") not_supported() { @@ -33,7 +30,6 @@ not_supported() { case "$os" in archlinux|debian|ubuntu) # handled in gencode-remote - # FIXED: hostname setup in archlinuz via rc.local ist outdated : ;; *)