-
Notifications
You must be signed in to change notification settings - Fork 279
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
4 trivia - cleanups and tiny fixes #525
base: main
Are you sure you want to change the base?
Conversation
Also, removing the lone print() call makes the code more consistent. setup_logging() already relies on an initial `log` object being setup elsewhere, pointing to stderr. I think that is pretty conventional. python's built-in logging module works the same way.
…ypo?) Exit status 1 is fine. We don't need to use a confusing negative underflow to exit status 255 here.
The "right place" already has the same comment.
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.
Otherwise looks good.
@@ -170,8 +170,8 @@ def startup(args): | |||
def main(): | |||
# firewalld should only be run as the root user | |||
if os.getuid() != 0: | |||
print("You need to be root to run %s." % sys.argv[0]) | |||
sys.exit(-1) | |||
log.fatal("You need to be root to run %s." % sys.argv[0]) |
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.
This won't work. Logging isn't set up yet.
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.
Thanks for (amazingly quick :-) review. It works for me:
$ src/firewalld
FATAL ERROR: You need to be root to run src/firewalld.
Do you disagree with the commit message? 4dccb48
I can change it to sys.stderr.write()
if you prefer. It just seems a pity for the logging to implement this elegant convention, and then shy away from using 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.
lgtm
(though, needs a rebase, which causes some conflicts).
Hi!
I found these trivia while looking at error handling. The rest of my work didn't seem to depend on them. So I've split these ones out, to help keep things manageable.
(If you want to leave reviewing this until I send the more hefty PR(s) as well, that's fine :-).
Thanks
Alan