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

Handle errors from update_goal_state #1758

Merged
merged 2 commits into from
Jan 21, 2020
Merged

Conversation

narrieta
Copy link
Member

@narrieta narrieta commented Jan 17, 2020

When I moved the call to update_goal_state from get_vmagent_manifests/get_ext_handlers to the main loop I did not notice it does not handle exceptions.

The purpose of this PR is to handle exceptions mimicking what the original code did. 3 TODOs for subsequent PRs:

  • other calls to update_goal_state should generate the same telemetry event
  • the main loop should handle more exceptions
  • the main loop needs some serious refactoring to make it amenable to unit tests

Verified the fix manually raising an exception from the debugger on a live agent.


This change is Reviewable

@codecov
Copy link

codecov bot commented Jan 17, 2020

Codecov Report

❗ No coverage uploaded for pull request base (develop@f38cede). Click here to learn what that means.
The diff coverage is 59.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #1758   +/-   ##
==========================================
  Coverage           ?   69.14%           
==========================================
  Files              ?       82           
  Lines              ?    11717           
  Branches           ?     1643           
==========================================
  Hits               ?     8102           
  Misses             ?     3263           
  Partials           ?      352
Impacted Files Coverage Δ
azurelinuxagent/ga/exthandlers.py 85.53% <100%> (ø)
azurelinuxagent/common/event.py 84.71% <100%> (ø)
azurelinuxagent/ga/update.py 87.91% <56%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f38cede...26015cc. Read the comment docs.

@vrdmr vrdmr added this to the v2.2.47 milestone Jan 21, 2020
except Exception as e:
msg = u"Exception retrieving the goal state: {0}".format(ustr(traceback.format_exc()))
logger.warn(msg)
add_event(AGENT_NAME, op=WALAEventOperation.FetchGoalState, version=CURRENT_VERSION, is_success=False, message=msg)
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't add_event also log the message if is_success=False?

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks; removed

vrdmr
vrdmr previously approved these changes Jan 21, 2020
@narrieta narrieta merged commit 1eb8b61 into Azure:develop Jan 21, 2020
@narrieta narrieta deleted the main-loop branch January 21, 2020 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants