Skip to content

Conversation

rane-rajasi
Copy link
Contributor

Changes included:

  • Adds status file for non enable commands during their initial setup with basic details
  • For any terminal errors, if the seq no is available, updates status file with error status as following:
    [{
    "version": 1.0,
    "timestampUTC": "2019-07-20T12:12:14Z",
    "status": {
    "name": "Azure Patch Management",
    "operation": "",
    "status": "Error",
    "code": <error_code>,
    "formattedMessage": {
    "lang": "en-US",
    "message": ""
    }
    }
    }]

@rane-rajasi rane-rajasi requested review from a team, benank, kjohn-msft and mirichmo and removed request for a team May 31, 2022 14:13
@codecov
Copy link

codecov bot commented May 31, 2022

Codecov Report

Merging #144 (b45aa59) into master (bd98341) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #144   +/-   ##
=======================================
  Coverage   87.24%   87.24%           
=======================================
  Files          48       48           
  Lines        8363     8363           
=======================================
  Hits         7296     7296           
  Misses       1067     1067           
Flag Coverage Δ
python27 86.08% <ø> (ø)
python39 87.19% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


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 bd98341...b45aa59. Read the comment docs.

def uninstall(self):
try:
self.setup(action=Constants.UNINSTALL, log_message="Extension uninstalled")
self.ext_output_status_handler.write_status_file("", self.seq_no, status=Constants.Status.Success.lower())
Copy link
Contributor

Choose a reason for hiding this comment

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

Please check with Jemal about the cases where the Windows extension writes a status file to ensure alignment between the extensions.

Copy link
Contributor Author

@rane-rajasi rane-rajasi Jun 13, 2022

Choose a reason for hiding this comment

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

Done, windows extension also writes status only for enable. Windows agent may write status file for enable, this is considered by our extension while writing status. As for other handler actions, we aren't sure if agent does write status and the extension does not write status

@rane-rajasi rane-rajasi requested a review from jemex June 2, 2022 23:44
@jemex
Copy link

jemex commented Jun 8, 2022

Changes included:

  • Adds status file for non enable commands during their initial setup with basic details
  • For any terminal errors, if the seq no is available, updates status file with error status as following:
    [{
    "version": 1.0,
    "timestampUTC": "2019-07-20T12:12:14Z",
    "status": {
    "name": "Azure Patch Management",
    "operation": "",
    "status": "Error",
    "code": <error_code>,
    "formattedMessage": {
    "lang": "en-US",
    "message": ""
    }
    }
    }]

can we add formatted json string, that has error code and if the error code is client error or platform error?

@rane-rajasi
Copy link
Contributor Author

Changes included:

  • Adds status file for non enable commands during their initial setup with basic details
  • For any terminal errors, if the seq no is available, updates status file with error status as following:
    [{
    "version": 1.0,
    "timestampUTC": "2019-07-20T12:12:14Z",
    "status": {
    "name": "Azure Patch Management",
    "operation": "",
    "status": "Error",
    "code": <error_code>,
    "formattedMessage": {
    "lang": "en-US",
    "message": ""
    }
    }
    }]

can we add formatted json string, that has error code and if the error code is client error or platform error?

Based on discussion, decided to not include this change, since we don't need additional error information at this point of time.

@jemex jemex self-requested a review June 14, 2022 22:08
except Exception:
raise
finally:
self.write_basic_status(action)
Copy link
Contributor

Choose a reason for hiding this comment

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

curiosity: If lines 69 through 72 throw, can the exception be written to the basic status file and then rethrown?

It looks like you'll have to write basic status on line 73 at the end of the try and within the except. In that case a finally will no longer be necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With basic status, we set the top level status to "transitioning". Now incase of exceptions, and all these are currently terminal, the status is re-written to "error"

The way the code is in all setup() callers right now, we can have write_basic_status() on line 72, just before except, so a basic status (with status=Transitioning) is written in a happy path, and incase of exceptions, there is only 1 status write with status=error (instead of 2 writes). But thought of keeping write_basic_status() in finally, in case something changes in callers later

@rane-rajasi rane-rajasi merged commit 698f4fa into master Jun 15, 2022
@benank benank mentioned this pull request Jun 16, 2022
@rane-rajasi rane-rajasi deleted the rarane-errorhandlingchanges branch July 13, 2022 16:33
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.

4 participants