diskimage-builder/diskimage_builder/elements/dhcp-all-interfaces/install.d/dhcp-interface@.service
Julia Kreger 6d64a2aee6 Fix cylical systemd config for dhcp-all-interfaces
In Ubuntu/Debian, the default dependencies cannot be relied
upon as we enter into a cyclical dependency relationship which
prevents the unit from starting.

Added the required configuration to the systemd unit file.

This issue has also been observed in glean[0], which has a nearly
identical unit file for interface start-up.

[0]: https://review.openstack.org/#/c/485748
Closes-Bug: #1708685

Change-Id: I23ac9510d1a21c7073bd33f76ba66fa04a8be035
2017-08-25 15:51:23 +10:00

26 lines
754 B
Desktop File

[Unit]
Description=DHCP interface %i
# We want to run after network.target so it doesn't try to bring
# up the interfaces a second time, but network-online should not
# be reached until after we've brought up the interfaces.
# We also need to break the default dependencies which prevents
# this from operating on Ubuntu/Debian as the unit gets stuck
# into a cyclical dependency loop.
DefaultDependencies=no
After=network.target
Before=network-online.target
Wants=network-online.target
ConditionPathExists=!/etc/sysconfig/network-scripts/ifcfg-%i
[Service]
Type=oneshot
User=root
ExecStartPre=/usr/local/sbin/dhcp-all-interfaces.sh %i
ExecStart=/sbin/ifup %i
RemainAfterExit=true
TimeoutStartSec=DIB_DHCP_TIMEOUT
[Install]
WantedBy=multi-user.target