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

Report message in handler heartbeat #2688

Merged
merged 7 commits into from
Oct 31, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions azurelinuxagent/ga/exthandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,7 @@ def report_ext_handler_status(self, vm_status, ext_handler, goal_state_changed):
heartbeat = ext_handler_i.collect_heartbeat()
if heartbeat is not None:
handler_status.status = heartbeat.get('status')
handler_status.message = parse_formatted_message(heartbeat.get('formattedMessage'))
Copy link
Member

Choose a reason for hiding this comment

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

you should check that the heartbeat actually has a 'formattedMessage')

Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need extra check. The get call would handle if it's not available. It will return None if property does not present and same applies to status field.

Copy link
Member

Choose a reason for hiding this comment

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

@nagworld9 we need the check so that we do not assign None to these properties

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. At this point we are overriding the handler status file content with heartbeat not with default None values. So makes sense to check here.

except ExtensionError as e:
ext_handler_i.set_handler_status(message=ustr(e), code=e.code)

Expand Down