9 # Don't do anything if the file isn't there
10 if [ ! -f "$file" ]; then
14 if grep -q "^# HEAT_HOSTS_START" "$file"; then
16 awk -v v="$entries" '/^# HEAT_HOSTS_START/ {
20 }f &&!/^# HEAT_HOSTS_END$/{next}/^# HEAT_HOSTS_END$/{f=0}!f' "$file" > "$temp"
21 echo "INFO: Updating hosts file $file, check below for changes"
22 diff "$file" "$temp" || true
25 echo -ne "\n# HEAT_HOSTS_START - Do not edit manually within this section!\n" >> "$file"
26 echo "$entries" >> "$file"
27 echo -ne "# HEAT_HOSTS_END\n\n" >> "$file"
32 if [ ! -z "$hosts" ]; then
33 for tmpl in /etc/cloud/templates/hosts.*.tmpl ; do
34 write_entries "$tmpl" "$hosts"
36 write_entries "/etc/hosts" "$hosts"
38 echo "No hosts in Heat, nothing written."