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

Scheduled shutdown task fails due to type issue #2805

Closed
Hooverdan96 opened this issue Feb 27, 2024 · 4 comments
Closed

Scheduled shutdown task fails due to type issue #2805

Hooverdan96 opened this issue Feb 27, 2024 · 4 comments
Assignees

Comments

@Hooverdan96
Copy link
Member

Hooverdan96 commented Feb 27, 2024

Thanks to user aymenSo, it appears that a scheduled shutdown task fails ultimately due to a type error, which results in a low-level exception during the attempt to execute the shutdown program.

this can likely be traced back to this part of the code:

if request.auth is not None:
delay = 3
if command == "shutdown":
msg = "The system will now be shutdown."
try:
# if shutdown request coming from a scheduled task

[phillxnet EDIT] As documented in the forum thread, the delay variable should be populated with +3 instead of just 3 following the shutdown man page:

https://man7.org/linux/man-pages/man8/shutdown.8.html

Should be an easy fix, however, not sure how one would design a test to this (or whether that is necessary) without shutting down the system every time :) (maybe trigger the shutdown and then cancel it within the delay time?).


Forum reference: https://forum.rockstor.com/t/error-on-shutdown-task/9313

@Hooverdan96
Copy link
Member Author

Based on the referenced issue #2807 this use case could be addressed possibly with changing the delay assignment to

    if request.auth is not None:
        delay = str(3)

...

@phillxnet phillxnet self-assigned this Mar 21, 2024
@phillxnet
Copy link
Member

phillxnet commented Mar 21, 2024

I'm working on the referenced/linked issue in #2805 (comment), so will add this change according there. And if all is well we can close this issue as a duplicate.

@phillxnet phillxnet changed the title Scheduled shutdown task fails due to syntax error Scheduled shutdown task fails due to type issue Mar 21, 2024
phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Mar 22, 2024
Add type hints to the shutdown/reboot run_command() wrapper parameters
in osi.py, and to command.py's use of these wrappers. Includes fix for
legacy inadvertent integer in delay during scheduled task calls.
@phillxnet phillxnet added this to the 5.1.X-X Stable release milestone Mar 22, 2024
@phillxnet
Copy link
Member

I've now split this out into it's own pull request: there were a few comment updates etc and shutdown/reboot specific changes that make it cleaner that way. PR currently under test.

phillxnet added a commit that referenced this issue Mar 22, 2024
…fails-due-to-type-issue

Scheduled shutdown task fails due to type issue #2805
@phillxnet
Copy link
Member

Closing as:
Fixed by #2812

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

No branches or pull requests

2 participants