Skip to content

Commit

Permalink
Daemon should remove stale published_hostname file and log useful war…
Browse files Browse the repository at this point in the history
…ning (#3016)

* Daemon should remove published_hostname file and log useful warning

* Clean up fast track file if vm id has changed

* Clean up initial_goal_state file if vm id has changed

* Clean up rsm_update file if vm id has changed
  • Loading branch information
maddieford committed Jan 11, 2024
1 parent 5d2da88 commit 150de9b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion azurelinuxagent/pa/deprovision/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ def del_lib_dir_files(self, warnings, actions): # pylint: disable=W0613
'partition',
'Protocol',
'SharedConfig.xml',
'WireServerEndpoint'
'WireServerEndpoint',
'published_hostname',
'fast_track.json',
'initial_goal_state',
'rsm_update.json'
]
known_files_glob = [
'Extensions.*.xml',
Expand Down
8 changes: 5 additions & 3 deletions azurelinuxagent/pa/provision/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,11 @@ def check_provisioned_file(self):
s = fileutil.read_file(ProvisionHandler.provisioned_file_path()).strip()
if not self.osutil.is_current_instance_id(s):
if len(s) > 0:
logger.warn("VM is provisioned, "
"but the VM unique identifier has changed -- "
"clearing cached state")
msg = "VM is provisioned, but the VM unique identifier has changed. This indicates the VM may be " \
"created from an image that was not properly deprovisioned or generalized, which can result in " \
"unexpected behavior from the guest agent -- clearing cached state"
logger.warn(msg)
self.report_event(msg)
from azurelinuxagent.pa.deprovision \
import get_deprovision_handler
deprovision_handler = get_deprovision_handler()
Expand Down

0 comments on commit 150de9b

Please sign in to comment.