feat(coreos-base/oem-gce): add the gce-add-metadata-host service

One of the requirements of GCE is setting up the metadata host. Do this.
This commit is contained in:
Brandon Philips 2014-04-02 15:02:20 -07:00
parent dbd1895f49
commit 4c85c26dcb
3 changed files with 19 additions and 0 deletions

View File

@ -2,6 +2,15 @@
coreos:
units:
- name: gce-add-metadata-host.service
command: start
runtime: yes
content: |
[Unit]
Description=Setup metadata in /etc/hosts
[Service]
ExecStart=/usr/share/oem/bin/gce-add-metadata-host
- name: gce-coreos-cloudinit.service
command: restart
runtime: yes

View File

@ -0,0 +1,9 @@
#!/bin/bash
entry="169.254.169.254 metadata"
grep -q "${entry}" /etc/hosts
if [ $? -ne 0 ]; then
echo ${entry} >> /etc/hosts
fi

View File

@ -25,6 +25,7 @@ src_install() {
dobin ${FILESDIR}/gce-ssh-key
dobin ${FILESDIR}/gce-coreos-cloudinit
dobin ${FILESDIR}/gce-setup-environment
dobin ${FILESDIR}/gce-add-metadata-host
insinto "/usr/share/oem"
doins ${FILESDIR}/cloud-config.yml