Revert "oem-ec2-compat: Check for metadata service and config drive"

The functionality for this in cloudinit 0.8.x is broken.

This reverts commit 91cc8446212c6b35c80cbdbbc204a9fe3cd1f756.
This commit is contained in:
Michael Marineau 2014-07-01 11:44:42 -07:00
parent 242c7f9d63
commit 477afcd01d
5 changed files with 53 additions and 6 deletions

View File

@ -2,11 +2,18 @@
coreos:
units:
- name: user-configdrive.service
mask: yes
- name: user-configvirtfs.service
mask: yes
- name: oem-cloudinit.service
- name: ec2-ssh-key.service
command: restart
runtime: yes
content: |
[Unit]
Description=Sets SSH key from metadata
[Service]
Type=oneshot
StandardOutput=journal+console
ExecStart=/usr/share/oem/bin/ec2-ssh-key
- name: ec2-cloudinit.service
command: restart
runtime: yes
content: |
@ -18,7 +25,7 @@ coreos:
[Service]
Type=oneshot
EnvironmentFile=/etc/environment
ExecStart=/usr/bin/coreos-cloudinit --from-configdrive=/media/configdrive --from-metadata-service
ExecStart=/usr/bin/coreos-cloudinit -ignore-failure=true -from-url=http://169.254.169.254/latest/user-data
oem:
id: @@OEM_ID@@
name: @@OEM_NAME@@

View File

@ -0,0 +1,29 @@
#!/bin/bash
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}"
/usr/bin/block-until-url http://169.254.169.254/latest/meta-data/public-ipv4
# get public ip from metadata
PUB_IP_URL=http://169.254.169.254/latest/meta-data/public-ipv4
IP=$(/usr/bin/curl --fail -s "$PUB_IP_URL")
echo COREOS_PUBLIC_IPV4=${IP} >> $ENV
PRIV_IP_URL=http://169.254.169.254/latest/meta-data/local-ipv4
IP=$(/usr/bin/curl --fail -s "$PRIV_IP_URL")
echo COREOS_PRIVATE_IPV4=${IP} >> $ENV

View File

@ -0,0 +1,6 @@
#!/bin/sh -e
KEY_URL="http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key"
/usr/bin/block-until-url "$KEY_URL"
/usr/bin/curl --fail -s "$KEY_URL" | /usr/bin/update-ssh-keys -a ec2

View File

@ -0,0 +1 @@
oem-ec2-compat-0.0.1.ebuild

View File

@ -40,6 +40,10 @@ src_prepare() {
}
src_install() {
into "/usr/share/oem"
dobin ${FILESDIR}/ec2-ssh-key
dobin ${FILESDIR}/coreos-setup-environment
insinto "/usr/share/oem"
doins ${T}/cloud-config.yml
}