summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--upstart/cloud-init-container.conf14
1 files changed, 12 insertions, 2 deletions
diff --git a/upstart/cloud-init-container.conf b/upstart/cloud-init-container.conf
index b3123721..497e75c8 100644
--- a/upstart/cloud-init-container.conf
+++ b/upstart/cloud-init-container.conf
@@ -27,13 +27,23 @@ script
set -- ${auto_list}
[ "$*" = "lo" ] && exit 0
- to_emit=""
+ # we only want to emit for interfaces that do not exist, so filter
+ # out anything that does not exist.
for iface in "$@"; do
[ "$iface" = "lo" ] && continue
# skip interfaces that are already up
[ -f "${MARK_DEV_PREFIX}${iface}" ] && continue
+
+ if [ -d /sys/net ]; then
+ # if /sys is mounted, and there is no /sys/net/iface, then no device
+ [ -e "/sys/net/$iface" ] && continue
+ else
+ # sys wasn't mounted, so just check via 'ifconfig'
+ ifconfig "$iface" >/dev/null 2>&1 || continue
+ fi
initctl emit --no-wait net-device-added "INTERFACE=$iface" &&
- emitted="${emitted} ${iface}" || :
+ emitted="$emitted $iface" ||
+ echo "warn: ${UPSTART_JOB} failed to emit net-device-added INTERFACE=$iface"
done
[ -z "${emitted# }" ] ||