Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Daemon should remove stale published_hostname file and log useful warning #3016

Merged
merged 7 commits into from
Jan 11, 2024
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that is the best we can do for stale files and this fix will not help for old daemons.

logger.warn(msg)
self.report_event(msg)
from azurelinuxagent.pa.deprovision \
import get_deprovision_handler
deprovision_handler = get_deprovision_handler()
Expand Down
Loading