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

system.shutdown unusable #7833

Closed
boltronics opened this issue Oct 15, 2013 · 5 comments
Closed

system.shutdown unusable #7833

boltronics opened this issue Oct 15, 2013 · 5 comments
Assignees
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix help-wanted Community help is needed to resolve this severity-low 4th level, cosemtic problems, work around exists

Comments

@boltronics
Copy link
Contributor

The system.shutdown execution module looks unusable in its current form on probably any GNU/Linux distribution.

root@master:~# salt '*' system.shutdown
minion01.example.com:
    shutdown: time expected
    Try `shutdown --help' for more information.

Looking at salt/modules/system.py, the 'shutdown' command is called without any provision for user-specified parameters. It doesn't have '-h now' hard-coded either.

Happy to supply a patch (which would likely be trivial), but I'm not sure which approach was intended. I see we have support for 'halt' (which is generally effectively the same as "shutdown -h now", so I guess supporting parameters is the way to go.

However, if adding parameters for shutdown, why not add them to halt, reboot, etc as well? Having them only for shutdown would seem inconsistent. Then again, if you're accepting parameters, is there actually any advantage to calling:

salt 'some-instance' system.shutdown -h now

over

salt 'some-instance' cmd.run shutdown -h now

(other than having to type one character less)? Maybe it can all disappear?

In short, it doesn't work currently, but I don't know how you would like to see it fixed. :)

@ghost ghost assigned cachedout Oct 15, 2013
@cachedout
Copy link
Contributor

Thanks for the excellent write-up here, @boltronics.

I agree that the current implementation of system.shutdown is completely broken. What do you think about just modifying the function to accept a time argument and, if present, pass it along the the shutdown command itself? If not present, just shutdown immediately.

Send along a pull req with that, or if you have a different approach I'm sure we'd love to see it as well.

Cheers!

@boltronics
Copy link
Contributor Author

That sounds like a very reasonable approach. If time permits, I'll try to add a pull request later today. Cheers.

@cachedout
Copy link
Contributor

@boltronics That's wonderful to hear. Thanks so much for helping out!

cachedout pushed a commit to cachedout/salt that referenced this issue Nov 1, 2013
New flag to shutdown at a given time. Refs saltstack#7833.
@boltronics
Copy link
Contributor Author

Whops! Sorry cachedout. I didn't get around to this immediately, and ended up completely forgetting about it. Thanks for the fix.

@cachedout
Copy link
Contributor

@boltronics Don't worry about it at all. Thanks for reporting this issue and helping to make Salt better!

cachedout pushed a commit that referenced this issue Nov 8, 2013
New flag to shutdown at a given time. Refs #7833.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix help-wanted Community help is needed to resolve this severity-low 4th level, cosemtic problems, work around exists
Projects
None yet
Development

No branches or pull requests

2 participants