Report syncfiles failures instead of discarding them - #262
Merged
Conversation
Member
|
This was the impetus I needed to fix the duplicate nature of syncfileclient, unfortunately that means to rework this to just the three copies of syncfileclient left: |
get_syncresult() caught the sync task's exception, logged a repr server
side and returned 200 OK with a null body. The node then called
.get('options') on that null resulted in:
c1: 'NoneType' object has no attribute 'get'
and syncfileclient still exited 0 as if syncing had succeeded.
Return the error to the requestor as a 500 with an error payload. On
the node, unwrap the body that grab_url_with_status raises for a
non-success status, print it once and exit non-zero. Only a failure the
server deliberately reported for this sync is terminal. Anything else,
such as a dropped connection, is re-raised so the existing retry loop
handles it as before. The same case now reports
c1: Error performing syncfiles: Syncing failed due to unreadable files: /etc/dangling.conf
c1: 'syncfileclient' exited with code 1
Member
Author
|
@jjohnson42 ahh yeah way better now 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A failed syncfiles run was reported as a success.
get_syncresult()caught the sync task's exception, logged a repr server side, and returned200 OKwith a null body. The node then called.get('options')on that null resulted in:syncfileclientstill exited 0, so the deployment carried on as if syncing had succeeded. A dangling symlink in the sync tree is an easy way to hit this.Fix
Return the error to the requestor as a 500 with an error payload. On the node, unwrap the body that
grab_url_with_statusraises for a non-success status, print it once, and exit non-zero:Only a failure the server deliberately reported for this sync is terminal. Anything else, such as a dropped connection, is re-raised so the existing retry loop handles it as before. The polled result is also no longer assumed to be a dict.
Scope
Deployments are not aborted. Nothing cares about the exit status, but the failure is visible now and
nodeapply -Fexits non-zero instead of reporting success.