-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Preventing crash when running on AWS Lambda #72
Conversation
Could you add a test as well as a log entry when this happens? |
To be honest, it's kinda hard to write an automated unit test for an absolute edge case with a readonly working directory. If you have an idea how this can be achieved easily, please give me a hint. As for the logging, of course its possible to add some print or stuff like that as icalevents doesnt seem to use the logging library yet. I'll do that in a few minutes. |
Codecov Report
@@ Coverage Diff @@
## master #72 +/- ##
==========================================
+ Coverage 82.82% 83.58% +0.76%
==========================================
Files 4 4
Lines 326 329 +3
Branches 77 77
==========================================
+ Hits 270 275 +5
+ Misses 31 29 -2
Partials 25 25
Continue to review full report at Codecov.
|
Edge-cases like this is where tests are most important. You could set up a test where you set the permission to read only (e.g. 550) and revert it after the test finished, during this test you would assert that the expected log message would be outputted. It also would be beneficial to use the logging module over print so output can be configured by the user more easily. |
Well thats of course correct, but honestly I'm not going to change half of the whole project for a Pull Request that just adds half a line of code and is more of a hotfix for everyone that encounters this problem. The test should have already been in place before as I only added a catch for another error that is caused by the same issue. So I'm not going to be the one fixing the problems of others. I'm just a user that encountered this problem and wanted to provide the fix for everyone. If there is a problem with this approach of mine, feel free to close my PR as I already fixed the stuff sufficiently for me to use it in my projects. Everyone else, like John from #65, has to fix it for themselves then I guess. |
No worries, I'm just a user as well. I'm just worried that if we don't make sure to improve the testing with every patch library will deteriorate, and I wouldn't wan't silent failures for things like non writable file systems. |
This impacts Azure as well as AWS, and the fix looks like it would fix both. |
I ran into this issue as well. Just posting my workaround in case it helps anyone. AWS Lambda provides a /tmp mount that is writable, so just change to that directory first.
|
I’m happy to merge this If someone is willing to write proper tests for the functionality. |
I'm working on a test right now as this seems to affect a lot of users, guess I'll get it done today |
Since the latest ci run failed, i looked into it and it seems that python needs sudo rights to perform os.chmod() commands. The travis config specifically says that the job should run without sudo. Not sure what to do here now. |
Try using a tmp directory, should allow you to set whichever permissions. Chmod should work fine without sudo if you own the directory. |
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.
Looks great, good work with the test!
@Mueller-Patrick I merged your change. I don't have the credentials to cut a new release on pypi so we'll have to wait on @irgangla for that. |
Preventing crash when running on AWS Lambda
AWS Lambda functions are run in a readonly directory, which causes an OSError with icalevents as described in #65. Catching this error and calling httplib2 without cache fixes the problem.