[BUG] Provisioning Agent crash when /etc/sysconfig/network-scripts/ifcfg-eth1 is missing
- Dominant language
- Python
- Stars
- 581
- Forks
- 397
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 9
Description
**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**
1. Workaround is to just touch an empty file with that name.
1. 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`).
Contributor guide
Assessment
This issue has not been assessed yet.