Permit injecting entries into /etc/hosts.
We need this for the test-environment machines. Change-Id: I499607a26e6282a9f37b91989fe6c1821d0cca9d
This commit is contained in:
parent
9411e027f7
commit
b7e470d212
5
elements/hosts/README.md
Normal file
5
elements/hosts/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
Permit injecting content into /etc/hosts from heat
|
||||
|
||||
# Configuration
|
||||
|
||||
hosts: '12.3.4 my-host.com'
|
2
elements/hosts/element-deps
Normal file
2
elements/hosts/element-deps
Normal file
@ -0,0 +1,2 @@
|
||||
os-apply-config
|
||||
os-refresh-config
|
1
elements/hosts/os-apply-config/var/run/hosts.d/tail
Normal file
1
elements/hosts/os-apply-config/var/run/hosts.d/tail
Normal file
@ -0,0 +1 @@
|
||||
{{hosts}}
|
19
elements/hosts/os-refresh-config/configure.d/51-hosts
Executable file
19
elements/hosts/os-refresh-config/configure.d/51-hosts
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
# 51 - right after oac as hosts is needed for $justabouteverything.
|
||||
|
||||
if [ ! -e /etc/hosts -o ! -e /var/run/hosts.d/tail ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if fgrep -f /var/run/hosts.d/tail /etc/hosts; then
|
||||
exit 0
|
||||
fi
|
||||
cp /etc/hosts /var/run/hosts.d/new-hosts
|
||||
echo >> /var/run/hosts.d/new-hosts
|
||||
cat /var/run/hosts.d/tail >> /var/run/hosts.d/new-hosts
|
||||
echo >> /var/run/hosts.d/new-hosts
|
||||
mv /var/run/hosts.d/new-hosts /etc/hosts
|
Loading…
Reference in New Issue
Block a user