fix(coreos-base/oem-vagrant): Add coreos-setup-environment

In vagrant /etc/environment is set up by cloudinit but other services
still depend on the coreos-setup-environment.service unit as a signal
that /etc/environment is valid. Also the OEM needs to provide this
script in order to block the likely to be broken defaults from being
written. This just provides a dumb script that blocks.

Use system-cloudinit@.service because it does not depend on
coreos-setup-environment.service. Otherwise we would dead lock on a
circular dependency.
This commit is contained in:
Michael Marineau 2014-04-18 15:15:58 -07:00
parent 72829fedf7
commit 4649f7fa12
4 changed files with 17 additions and 1 deletions

View File

@ -7,7 +7,7 @@ coreos:
content: | content: |
[Path] [Path]
PathExists=/var/lib/coreos-vagrant/user-data PathExists=/var/lib/coreos-vagrant/user-data
Unit=user-cloudinit@var-lib-coreos\x2dvagrant-user\x2ddata.service Unit=system-cloudinit@var-lib-coreos\x2dvagrant-user\x2ddata.service
oem: oem:
id: vagrant id: vagrant
name: Vagrant name: Vagrant

View File

@ -0,0 +1,13 @@
#!/bin/bash -e
ENV="$1"
if [ -z "$ENV" ]; then
echo usage: $0 /etc/environment
exit 1
fi
# just block until cloudinit updates environment
while ! grep -qs ^COREOS_PUBLIC_IPV4 "$ENV"; do
sleep 0.1
done

View File

@ -19,4 +19,7 @@ src_install() {
insinto "/usr/share/oem" insinto "/usr/share/oem"
doins "${FILESDIR}/authorized_keys" doins "${FILESDIR}/authorized_keys"
doins "${FILESDIR}/cloud-config.yml" doins "${FILESDIR}/cloud-config.yml"
into "/usr/share/oem"
dobin ${FILESDIR}/coreos-setup-environment
} }