cloud-init
cloud-init copied to clipboard
Do not hardcode reboot command
Proposed Commit Message
fix(cmd): Do not hardcode reboot command
Attempting a `cloud-init clean --reboot` fails on alpine because this
command is hard-coded. This code already has an Init object available,
which has a Distro attribute. Stamp out the duplicate hard-coded
implementation and re-use distro reboot code to acquire cross-distro
compatiblity.
Error:
Could not reboot this system using "['shutdown', '-r', 'now']": Unexpected error while running comma nd.
Command: ['shutdown', '-r', 'now']
Exit code: -
Reason: [Errno 2] No such file or directory: b'shutdown'
Stdout: -
Stderr: -
Context
This change is mostly test updates - the code change is trivial: just reuse the existing reboot code which already has multi-distro support.
I guess I've never tried a cloud-init clean --reboot before.
I guess I've never tried a
cloud-init clean --rebootbefore.
It's honestly not much of a value add, so I'm not terribly surprised. I like it because it shaves off a command when iterating for development and it gets used a fair amount in integration testing so I figure it's worth supporting for all distros.