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
Create /var/run/reboot-required file #196
Conversation
RPM available here: https://copr.fedorainfracloud.org/coprs/frostyx/tracer/build/5929476/ |
tracer/controllers/default.py
Outdated
if not self.applications.count_type(Applications.TYPES["STATIC"]): | ||
return | ||
with open("/var/run/reboot-required", "w") as fp: | ||
fp.write("Tracer says reboot is required\n") |
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.
Can this be written more cleanly:
if self.applications.count_type(Applications.TYPES["STATIC"]):
with open("/var/run/reboot-required", "w") as fp:
...
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.
Sure, updated
So I tried the code from this PR and I didn't see the file being written. Perhaps I didn't do something correctly. Output:
But no file was written:
|
Nevermind -- an update in F38 clobbered the testing RPM from this change. This works just fine! 🥳
|
Perfect, thank you for the test. |
@@ -136,6 +137,15 @@ def status_code(self): | |||
code = 104 | |||
return code | |||
|
|||
def create_reboot_required_file(self): | |||
""" | |||
If a reboot is needed, create a /var/run/reboot-required file. |
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.
The correct location is /run
, not /var/run
. In most cases, this doesn't matter greatly, because a compat symlink is provided, but when /var
is a separate partition, /var/run
would only be accessible if /var
is mounted, i.e. rather late in boot. /run
is always available. /var/run
is a compat symlink that should not be used (esp. in new code).
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.
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.
@FrostyX should be fine!
See #196 (comment) > The correct location is /run, not /var/run. In most cases, this > doesn't matter greatly, because a compat symlink is provided, but when > /var is a separate partition, /var/run would only be accessible if > /var is mounted, i.e. rather late in boot. /run is always > available. /var/run is a compat symlink that should not be > used (esp. in new code).
Fix #195