summaryrefslogtreecommitdiff
path: root/upstart/cloud-init-nonet.conf
diff options
context:
space:
mode:
Diffstat (limited to 'upstart/cloud-init-nonet.conf')
-rw-r--r--upstart/cloud-init-nonet.conf22
1 files changed, 22 insertions, 0 deletions
diff --git a/upstart/cloud-init-nonet.conf b/upstart/cloud-init-nonet.conf
new file mode 100644
index 00000000..2ac98286
--- /dev/null
+++ b/upstart/cloud-init-nonet.conf
@@ -0,0 +1,22 @@
+# cloud-init-no-net
+# the purpose of this job is
+# * to block running of cloud-init until a non 'lo' interface is up
+# * timeout if one doens't come up in a reasonable amount of time
+start on mounted MOUNTPOINT=/ and stopped cloud-init-local
+stop on net-device-up IFACE!=lo
+task
+
+console output
+
+script
+ # if a non 'lo' interface is up, exit immediately
+ grep -qv '^lo' /var/run/network/ifstate && exit 0
+
+ [ -f /var/lib/cloud/instance/obj.pkl ] && exit 0
+ sleep 10
+ echo $UPSTART_JOB "waiting for a network device."
+ sleep 60
+ echo $UPSTART_JOB "gave up waiting for a network device."
+ : > /var/lib/cloud/data/no-net
+end script
+# EOF