-
Notifications
You must be signed in to change notification settings - Fork 8
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
Enhanced 'import_users.py' script using logging module #1240
base: development
Are you sure you want to change the base?
Conversation
… diagnosis using logging module
We have upgraded the |
This PR seemed to be pretty straightforward. I saw obvious problems with the logging, and I ran unit testing for this. This was not client side, so I saw no need to try to break it on that end. I would approve this PR. |
Can you resolve the merge conflicts that exist? @ali-ramazani |
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.
Need to resolve merge conflicts.
…ts into import-user-logging-crontab
I was running this in a devcontainer and I couldn't check this script with tracy but I looked over it and everything looks to be good. Let's give this one final run before we merge it. |
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 approve it, but I would also want someone to try running it with TRACY locally.
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.
Based on https://docs.python.org/3/library/logging.html#levels, the log levels should be better defined. Log level DEBUG should show all of the output, INFO should give a summary of what the script did (count of users updated/inserted, etc), and WARNING should be when something unexpected happens, or we can't match a user.
We should be able to control the log levels in an argument to the script.
The output should go to stdout, not to a file. Let crontab control where the output goes.
…udentSoftwareDevTeam/celts into import-user-logging-crontab
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.
It doesn't seem like there's an intermediate level of detail, but maybe that's because the first updates don't work right now. For ldap at least I either get only errors, or all of the info output.
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've fully tested the changes I made to the dockerfile and the logging code works perfectly.
build-essential libssl-dev libffi-dev freetds-dev freetds-bin unixodbc-dev tdsodbc | ||
|
||
RUN sudo bash -c "echo -e '[FreeTDS]\nDescription=FreeTDS Driver\nDriver=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so\ | ||
\nSetup=/usr/lib/x86_64-linux-gnu/odbc/libtdsS.so' >> /etc/odbcinst.ini" |
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 couldn't find a way to break this into two lines while keeping the indentation style so we're just going to have to live with it.
Fixes issue #1053
We enhanced the
import_users.py
script by integrating Python's logging module to provide detailed and descriptive log messages. These improvements will make thecron.log
file significantly more informative, aiding in monitoring the script's execution and diagnosing any issues that arise from crontab scheduled tasks.