Description of problem:
When wala is self-updating(or restarting, or any scenario that the run-exthandler process is not running), if I change hostname, then when the run-exthandler process is running again, the new hostname cannot be sent to DHCP server.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Prepare a RHEL-7.3 VM with WALA-2.2.0+ installed.
2. Enable AutoUpdate, restart waagent service
3. When the run-exthandler process is exit, change hostname
~]# hostnamectl set-hostname newhostname
4. Wait for the run-exthandler process started. When it started, check DNS:
~]# nslookup newhostname.domain-name
The newhostname is not sent and added to DNS server.
The newhostname is sent and added to DNS server.
when the run-exthandler process start, first it set self.hostname as current hostname in the env.py, then it begins to monitor the hostname changes. So if the hostname is changed before the run-exthandler process starting, the hostname will not be sent to the DHCP server.
Verified on WALinuxAgent-2.2.4-1 RHEL-6.9-20170202.0.
Result is pass.
Verified on WALinuxAgent-2.2.4-1 RHEL-7.3 ondemand image.
Result is Pass.
Change the status to "POST" for developers to add it into ERRATA.