-
Notifications
You must be signed in to change notification settings - Fork 7
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
Library: GitProvider - Don't stop the app even if the library is not ready #639
Open
eliska-n
wants to merge
3
commits into
master
Choose a base branch
from
fix/library-gitprovider
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,30 +122,29 @@ def init_task(): | |
pygit_message = str(err).replace('\"', '') | ||
if "'refs/remotes/origin/{}'".format(self.Branch) in pygit_message: | ||
# branch does not exist | ||
L.exception( | ||
L.critical( | ||
"Branch does not exist.", | ||
struct_data={ | ||
"url": self.URLPath, | ||
"branch": self.Branch | ||
} | ||
) | ||
else: | ||
L.exception("Error when initializing git repository: {}".format(pygit_message)) | ||
self.App.stop() # NOTE: raising Exception doesn't exit the app | ||
L.critical("Error when initializing git repository: {}".format(pygit_message)) | ||
|
||
except pygit2.GitError as err: | ||
pygit_message = str(err).replace('\"', '') | ||
if "unexpected http status code: 404" in pygit_message: | ||
# repository not found | ||
L.exception( | ||
L.critical( | ||
"Git repository not found.", | ||
struct_data={ | ||
"url": self.URLPath | ||
} | ||
) | ||
elif "remote authentication required but no callback set" in pygit_message: | ||
# either repository not found or authentication failed | ||
L.exception( | ||
L.critical( | ||
"Authentication failed when initializing git repository.\n" | ||
"Check if the 'providers' option satisfies the format: 'git+<username>:<deploy token>@<URL>#<branch name>'", | ||
struct_data={ | ||
|
@@ -156,23 +155,22 @@ def init_task(): | |
) | ||
elif 'cannot redirect from' in pygit_message: | ||
# bad URL | ||
L.exception( | ||
L.critical( | ||
"Git repository not found.", | ||
struct_data={ | ||
"url": self.URLPath | ||
} | ||
) | ||
elif 'Temporary failure in name resolution' in pygit_message: | ||
# Internet connection does | ||
L.exception( | ||
L.critical( | ||
"Git repository not initialized: connection failed. Check your network connection.", | ||
struct_data={ | ||
"url": self.URLPath | ||
} | ||
) | ||
else: | ||
L.exception("Git repository not initialized: {}".format(err)) | ||
self.App.stop() | ||
L.critical("Git repository not initialized: {}".format(err)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "critical" error means that the app will exit ... otherwise this is an error (at all instances) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in that case I only remove lines that stop the app |
||
|
||
except Exception as err: | ||
L.exception(err) | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return
... don't claim "library ready" - as discussed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added returns. But I tested it in the remote control. And remote control works even if the library is not ready. asab.library module does not restrict you to read from the library when library is not ready. So it is up to each microservice to check whether the library is ready before reading. Moreover, in remote control, I subscribe to changes in the Library on library ready. But the Library.ready! signal never comes. So, the remote control is running with wrong set of library layers and without the update of model. Which is serious.
I think we need to decide whether this should be solved on the asab level or on the microservice level and adjust first. Only then, this can be merged.