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
17 sed '/^# HEAT_HOSTS_START/,$d' "$file"
18 echo -ne "\n# HEAT_HOSTS_START - Do not edit manually within this section!\n"
20 echo -ne "# HEAT_HOSTS_END\n\n"
21 sed '1,/^# HEAT_HOSTS_END/d' "$file"
23 echo "INFO: Updating hosts file $file, check below for changes"
24 diff "$file" "$temp" || true
27 echo -ne "\n# HEAT_HOSTS_START - Do not edit manually within this section!\n" >> "$file"
28 echo "$entries" >> "$file"
29 echo -ne "# HEAT_HOSTS_END\n\n" >> "$file"
34 if [ ! -z "$hosts" ]; then
35 for tmpl in /etc/cloud/templates/hosts.*.tmpl ; do
36 write_entries "$tmpl" "$hosts"
38 write_entries "/etc/hosts" "$hosts"
40 echo "No hosts in Heat, nothing written."