diff options
author | Chad Smith <chad.smith@canonical.com> | 2017-09-15 20:07:11 -0600 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-09-18 20:37:10 -0400 |
commit | 7eb3460b0d6d3e362a246958a7ea0a9ee5d91d5e (patch) | |
tree | 8dc323976cd5ea55ebba37cf0462220dfa7c16df /cloudinit/net/dhcp.py | |
parent | eaadf52b1010cf189bde2a6abb3265b890f6d36d (diff) | |
download | vyos-cloud-init-7eb3460b0d6d3e362a246958a7ea0a9ee5d91d5e.tar.gz vyos-cloud-init-7eb3460b0d6d3e362a246958a7ea0a9ee5d91d5e.zip |
ec2: Fix maybe_perform_dhcp_discovery to use /var/tmp as a tmpdir
/run/cloud-init/tmp is on a filesystem mounted noexec, so running
dchlient in Ec2Local during discovery breaks with 'Permission denied'.
This branch allows us to run from a different tmp dir so we have exec
rights.
LP: #1717627
Diffstat (limited to 'cloudinit/net/dhcp.py')
-rw-r--r-- | cloudinit/net/dhcp.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cloudinit/net/dhcp.py b/cloudinit/net/dhcp.py index c842c839..05350639 100644 --- a/cloudinit/net/dhcp.py +++ b/cloudinit/net/dhcp.py @@ -48,8 +48,9 @@ def maybe_perform_dhcp_discovery(nic=None): if not dhclient_path: LOG.debug('Skip dhclient configuration: No dhclient command found.') return {} - with temp_utils.tempdir(prefix='cloud-init-dhcp-') as tmpdir: - return dhcp_discovery(dhclient_path, nic, tmpdir) + with temp_utils.tempdir(prefix='cloud-init-dhcp-', needs_exe=True) as tdir: + # Use /var/tmp because /run/cloud-init/tmp is mounted noexec + return dhcp_discovery(dhclient_path, nic, tdir) def parse_dhcp_lease_file(lease_file): |