mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-18 10:27:00 +02:00
Merge pull request #467 from polvi/rackspace-oem
fix(oem-rackspace): add coreos-setup-environment for rackspace
This commit is contained in:
commit
49831a2dcf
@ -2,14 +2,11 @@
|
|||||||
Description=coreos-cloudinit for /usr/share/oem/cloud-config.yml
|
Description=coreos-cloudinit for /usr/share/oem/cloud-config.yml
|
||||||
Requires=dbus.service
|
Requires=dbus.service
|
||||||
After=dbus.service
|
After=dbus.service
|
||||||
Requires=coreos-setup-environment.service
|
|
||||||
After=coreos-setup-environment.service
|
|
||||||
RequiresMountsFor=/usr/share/oem
|
RequiresMountsFor=/usr/share/oem
|
||||||
ConditionPathExists=/usr/share/oem/cloud-config.yml
|
ConditionPathExists=/usr/share/oem/cloud-config.yml
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
EnvironmentFile=/etc/environment
|
|
||||||
ExecStartPre=/usr/bin/coreos-cloudinit --from-file=/usr/share/oem/cloud-config.yml
|
ExecStartPre=/usr/bin/coreos-cloudinit --from-file=/usr/share/oem/cloud-config.yml
|
||||||
ExecStart=/usr/bin/systemctl daemon-reload
|
ExecStart=/usr/bin/systemctl daemon-reload
|
||||||
|
|
||||||
|
@ -33,7 +33,10 @@ coreos:
|
|||||||
content: |
|
content: |
|
||||||
[Unit]
|
[Unit]
|
||||||
RequiresMountsFor=/media/configdrive
|
RequiresMountsFor=/media/configdrive
|
||||||
|
Requires=coreos-setup-environment.service
|
||||||
|
After=coreos-setup-environment.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
EnvironmentFile=/etc/environment
|
||||||
ExecStart=/usr/bin/coreos-cloudinit --from-file=/media/configdrive/openstack/latest/user_data
|
ExecStart=/usr/bin/coreos-cloudinit --from-file=/media/configdrive/openstack/latest/user_data
|
||||||
|
35
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-rackspace/files/coreos-setup-environment
vendored
Executable file
35
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-rackspace/files/coreos-setup-environment
vendored
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash +x
|
||||||
|
|
||||||
|
ENV=$1
|
||||||
|
|
||||||
|
if [ -z "$ENV" ]; then
|
||||||
|
echo usage: $0 /etc/environment
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# test for rw
|
||||||
|
touch $ENV
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo exiting, unable to modify: $ENV
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i -e '/^COREOS_PUBLIC_IPV4=/d' \
|
||||||
|
-e '/^COREOS_PRIVATE_IPV4=/d' \
|
||||||
|
"${ENV}"
|
||||||
|
|
||||||
|
# We spin loop until the nova-agent sets up the ip addresses
|
||||||
|
function get_ip () {
|
||||||
|
IF=$1
|
||||||
|
IP=
|
||||||
|
while [ 1 ]; do
|
||||||
|
IP=$(ifconfig $IF | awk '/inet /{print $2}')
|
||||||
|
if [ "$IP" != "" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep .1
|
||||||
|
done
|
||||||
|
echo $IP
|
||||||
|
}
|
||||||
|
|
||||||
|
echo COREOS_PUBLIC_IPV4=$(get_ip eth0) >> $ENV
|
||||||
|
echo COREOS_PRIVATE_IPV4=$(get_ip eth1) >> $ENV
|
@ -28,4 +28,7 @@ src_install() {
|
|||||||
rsync --exclude=".git" -aq ${S}/ ${D}/nova-agent/
|
rsync --exclude=".git" -aq ${S}/ ${D}/nova-agent/
|
||||||
insinto "/"
|
insinto "/"
|
||||||
doins ${FILESDIR}/cloud-config.yml
|
doins ${FILESDIR}/cloud-config.yml
|
||||||
|
|
||||||
|
into "/"
|
||||||
|
dobin ${FILESDIR}/coreos-setup-environment
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user