diff options
author | Chris Patterson <cpatterson@microsoft.com> | 2023-03-29 17:30:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-29 16:30:13 -0500 |
commit | c82ace920a743c6e6797536416018d9680b8fa7e (patch) | |
tree | d5663fab31c612febcdb4cf20f02328a03412639 /cloudinit/features.py | |
parent | 4fbf5317d7f0a7b33a14f94f85667c962a3c879e (diff) | |
download | cloud-init-git-c82ace920a743c6e6797536416018d9680b8fa7e.tar.gz |
net/dhcp: catch dhclient failures and raise NoDHCPLeaseError (#2083)
Some variants of dhclient will exit with non-zero codes on lease
failure. For example, on RHEL 8.7:
```
[cpatterson@test-rhel87 ~]$ sudo /usr/sbin/dhclient -1 -v -lf /tmp/my.lease -pf /tmp/my.pid bridge2nowhere -sf /bin/true
Internet Systems Consortium DHCP Client 4.3.6
Copyright 2004-2017 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/bridge2nowhere/42:ef:d5:38:1d:19
Sending on LPF/bridge2nowhere/42:ef:d5:38:1d:19
Sending on Socket/fallback
Created duid "\000\004E<\225X\232\304J\337\243\026T\324\243O\270\177".
DHCPDISCOVER on bridge2nowhere to 255.255.255.255 port 67 interval 4 (xid=0x777bc142)
DHCPDISCOVER on bridge2nowhere to 255.255.255.255 port 67 interval 7 (xid=0x777bc142)
DHCPDISCOVER on bridge2nowhere to 255.255.255.255 port 67 interval 13 (xid=0x777bc142)
DHCPDISCOVER on bridge2nowhere to 255.255.255.255 port 67 interval 6 (xid=0x777bc142)
No DHCPOFFERS received.
Unable to obtain a lease on first try. Exiting.
[cpatterson@test-rhel87 ~]$ echo $?
2
```
This results in an unhandled subp.ProcessExecutionError exception.
Catch these failures and re-raise as NoDHCPLeaseError.
Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
Diffstat (limited to 'cloudinit/features.py')
0 files changed, 0 insertions, 0 deletions