mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-20 05:51:18 +02:00
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:
parent
242c7f9d63
commit
477afcd01d
@ -2,11 +2,18 @@
|
|||||||
|
|
||||||
coreos:
|
coreos:
|
||||||
units:
|
units:
|
||||||
- name: user-configdrive.service
|
- name: ec2-ssh-key.service
|
||||||
mask: yes
|
command: restart
|
||||||
- name: user-configvirtfs.service
|
runtime: yes
|
||||||
mask: yes
|
content: |
|
||||||
- name: oem-cloudinit.service
|
[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
|
command: restart
|
||||||
runtime: yes
|
runtime: yes
|
||||||
content: |
|
content: |
|
||||||
@ -18,7 +25,7 @@ coreos:
|
|||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
EnvironmentFile=/etc/environment
|
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:
|
oem:
|
||||||
id: @@OEM_ID@@
|
id: @@OEM_ID@@
|
||||||
name: @@OEM_NAME@@
|
name: @@OEM_NAME@@
|
||||||
|
29
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/files/coreos-setup-environment
vendored
Executable file
29
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/files/coreos-setup-environment
vendored
Executable 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
|
6
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/files/ec2-ssh-key
vendored
Executable file
6
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ec2-compat/files/ec2-ssh-key
vendored
Executable 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
|
@ -0,0 +1 @@
|
|||||||
|
oem-ec2-compat-0.0.1.ebuild
|
@ -40,6 +40,10 @@ src_prepare() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
src_install() {
|
src_install() {
|
||||||
|
into "/usr/share/oem"
|
||||||
|
dobin ${FILESDIR}/ec2-ssh-key
|
||||||
|
dobin ${FILESDIR}/coreos-setup-environment
|
||||||
|
|
||||||
insinto "/usr/share/oem"
|
insinto "/usr/share/oem"
|
||||||
doins ${T}/cloud-config.yml
|
doins ${T}/cloud-config.yml
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user