Merge "Set the dhclient timeout to match DIB_DHCP_TIMEOUT"

This commit is contained in:
Zuul 2018-04-11 10:12:45 +00:00 committed by Gerrit Code Review
commit 0769bfd4aa
2 changed files with 12 additions and 2 deletions

View File

@ -24,6 +24,7 @@ Environment Variables
DIB_DHCP_TIMEOUT DIB_DHCP_TIMEOUT
:Required: No :Required: No
:Default: 30 :Default: 30
:Description: Amount of time in seconds that the systemd service will :Description: Amount of time in seconds that the systemd service(or dhclient)
wait to get an address. Should be increased in networks such as Infiniband. will wait to get an address. Should be increased in networks such as
Infiniband.
:Example: DIB_DHCP_TIMEOUT=300 :Example: DIB_DHCP_TIMEOUT=300

View File

@ -14,6 +14,15 @@ if [ "$DISTRO_NAME" != "gentoo" ]; then
sed -i "s/DIB_DHCP_TIMEOUT/${DIB_DHCP_TIMEOUT:-30}/" /usr/local/sbin/dhcp-all-interfaces.sh sed -i "s/DIB_DHCP_TIMEOUT/${DIB_DHCP_TIMEOUT:-30}/" /usr/local/sbin/dhcp-all-interfaces.sh
fi fi
if [ -f /etc/dhcp/dhclient.conf ] ; then
# Set the dhclient timeout configurations to match DIB_DHCP_TIMEOUT,
if grep -o "^timeout " /etc/dhcp/dhclient.conf ; then
sed -i -e "s/^timeout .*/# \"timeout\" Value set by dhcp-all-interfaces\ntimeout ${DIB_DHCP_TIMEOUT:-30}/" /etc/dhcp/dhclient.conf
else
echo -e "# \"timeout\" Value set by dhcp-all-interfaces\ntimeout ${DIB_DHCP_TIMEOUT:-30}" >> /etc/dhcp/dhclient.conf
fi
fi
if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then
if [ -e "/etc/redhat-release" ] ; then if [ -e "/etc/redhat-release" ] ; then
# the init system is upstart but networking is using sysv compatibility (i.e. Centos/RHEL 6) # the init system is upstart but networking is using sysv compatibility (i.e. Centos/RHEL 6)