Describe the bug
On multi-NIC VMs, under some circumstances when eth1 is the primary NIC, the agent crashes when attempting to update /etc/sysconfig/network-scripts/ifcfg-eth1 to set DHCP_HOSTNAME.
Distro and WALinuxAgent details (please complete the following information):
Distro and Version: CentOS 7.5, 7.4, 7.3 (possibly others)
WALinuxAgent version: various, older than 2.2.34.
Additional context
Workaround is to just touch an empty file with that name.
The code fix is in common.osutil.redhat.set_dhcp_hostname() - if filepath isn't an existing file, skip the invocation of fileutil.update_conf_file() or touch the file into existence before calling update_conf_file(). Alternatively, add a new named option to fileutil.fileutil.update_conf_file() which creates the file first if it's entirely missing (overriding the value of chk_err).
Describe the bug On multi-NIC VMs, under some circumstances when eth1 is the primary NIC, the agent crashes when attempting to update /etc/sysconfig/network-scripts/ifcfg-eth1 to set DHCP_HOSTNAME.
Distro and WALinuxAgent details (please complete the following information):
Additional context
filepath
isn't an existing file, skip the invocation offileutil.update_conf_file()
or touch the file into existence before calling update_conf_file(). Alternatively, add a new named option tofileutil.fileutil.update_conf_file()
which creates the file first if it's entirely missing (overriding the value ofchk_err
).