summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/net/dhcp.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/cloudinit/net/dhcp.py b/cloudinit/net/dhcp.py
index a8949ebc..c934ee16 100644
--- a/cloudinit/net/dhcp.py
+++ b/cloudinit/net/dhcp.py
@@ -168,7 +168,17 @@ def dhcp_discovery(dhclient_cmd_path, interface, dhcp_log_func=None):
util.write_file(file_name, interface_dhclient_content)
cmd.append("-cf")
cmd.append(file_name)
- out, err = subp.subp(cmd, capture=True)
+
+ try:
+ out, err = subp.subp(cmd, capture=True)
+ except subp.ProcessExecutionError as error:
+ LOG.debug(
+ "dhclient exited with code: %s stderr: %r stdout: %r",
+ error.exit_code,
+ error.stderr,
+ error.stdout,
+ )
+ raise NoDHCPLeaseError from error
# Wait for pid file and lease file to appear, and for the process
# named by the pid file to daemonize (have pid 1 as its parent). If we