diff --git a/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.conf b/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.conf index a459aa97..8cdbef00 100644 --- a/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.conf +++ b/elements/dhcp-all-interfaces/install.d/dhcp-all-interfaces.conf @@ -3,7 +3,8 @@ description "DHCP any connected, but unconfigured network interfaces" -start on starting cloud-init-nonet +start on starting network-interface +instance $INTERFACE task diff --git a/elements/dhcp-all-interfaces/install.d/generate-interfaces-file.sh b/elements/dhcp-all-interfaces/install.d/generate-interfaces-file.sh index cc0877f5..bf9d5ac1 100755 --- a/elements/dhcp-all-interfaces/install.d/generate-interfaces-file.sh +++ b/elements/dhcp-all-interfaces/install.d/generate-interfaces-file.sh @@ -6,6 +6,12 @@ INTERFACES_FILE="/etc/network/interfaces" +# Serialize runs so that we don't miss hot-add interfaces +FLOCK=${1:-} +if [ -z "$FLOCK" ] ; then + exec flock -x $INTERFACES_FILE $0 flocked +fi + function get_if_link() { cat /sys/class/net/${1}/carrier }