Don't rely on lsb_release for hosts template write

This is problematic for the containerised heat-agents, lsb_release has
to be bind-mounted in, and atomic host doesn't even have lsb_release
installed.

Instead just write to every /etc/cloud/templates/hosts.*.tmpl file.

Change-Id: If2aab7e9b1e03aa657baf1c33aa4392ef7044075
This commit is contained in:
Steve Baker 2016-12-06 23:06:44 +00:00
parent bb73874310
commit f592e195e2
1 changed files with 3 additions and 11 deletions

View File

@ -30,17 +30,9 @@ write_entries() {
} }
if [ ! -z "$hosts" ]; then if [ ! -z "$hosts" ]; then
# cloud-init files are /etc/cloud/templates/hosts.OSNAME.tmpl for tmpl in /etc/cloud/templates/hosts.*.tmpl ; do
DIST=$(lsb_release -is | tr -s [A-Z] [a-z]) write_entries "$tmpl" "$hosts"
case $DIST in done
fedora|redhatenterpriseserver)
name="redhat"
;;
*)
name="$DIST"
;;
esac
write_entries "/etc/cloud/templates/hosts.${name}.tmpl" "$hosts"
write_entries "/etc/hosts" "$hosts" write_entries "/etc/hosts" "$hosts"
else else
echo "No hosts in Heat, nothing written." echo "No hosts in Heat, nothing written."