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

Add log warning on challenge creation #2769

Merged
merged 8 commits into from Jun 10, 2021

Conversation

timosturm
Copy link
Contributor

@timosturm timosturm commented Jun 4, 2021

Add a warning to the log if submitting the challenge to firebase fails.
Closes #1668 and #2738

@timosturm timosturm requested a review from cornelinux June 4, 2021 12:52
@timosturm timosturm self-assigned this Jun 4, 2021
@timosturm timosturm marked this pull request as draft June 4, 2021 12:52
@timosturm timosturm marked this pull request as ready for review June 4, 2021 13:06
Copy link
Member

@cornelinux cornelinux left a comment

Choose a reason for hiding this comment

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

Please check, why the test is failing.

raise ValidateError("Failed to submit message to firebase service.")
log.warning("Failed to submit message to firebase service for token {0!s}."
.format(self.token.serial))
raise ValueError("Failed to submit message to firebase service.")
Copy link
Member

Choose a reason for hiding this comment

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

Why did you change this to ValueError?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This really shouldn't be here because I already caught that one. I will fix it immediately.

@codecov
Copy link

codecov bot commented Jun 10, 2021

Codecov Report

Merging #2769 (c7b7c6a) into master (cee41ed) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head c7b7c6a differs from pull request most recent head e2ef45f. Consider uploading reports for the commit e2ef45f to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2769   +/-   ##
=======================================
  Coverage   96.62%   96.62%           
=======================================
  Files         162      162           
  Lines       20975    20976    +1     
=======================================
+ Hits        20267    20268    +1     
  Misses        708      708           
Impacted Files Coverage Δ
privacyidea/lib/tokens/pushtoken.py 97.98% <100.00%> (+<0.01%) ⬆️

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 99dc7ad...e2ef45f. Read the comment docs.

Copy link
Member

@cornelinux cornelinux left a comment

Choose a reason for hiding this comment

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

Sorry. One last comment

if not res:
log.warning("Failed to submit message to firebase service for token {0!s}."
.format(self.token.serial))
Copy link
Member

Choose a reason for hiding this comment

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

I am sorry for my late comment.
I was not quite sure about this.

But in theory a serial number could contain a special character or a German umlaut. If we print it in the log message this way, we will raise an exception.
So we should do

log.warnung(u"Failed to .....".format())

To allow logging unicode.

Thanks a lot

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be fixed now.

@cornelinux cornelinux merged commit 4a6d66c into master Jun 10, 2021
@cornelinux cornelinux deleted the 1668/change_challange_creation branch June 10, 2021 09:53
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.

Trigger challenge fails if android app is deinstalled
2 participants