Skip to content

create a shutdown_command method in distro classes#567

Merged
OddBloke merged 8 commits into
canonical:masterfrom
emmanuelthome:fix-bad-shutdown-option-freebsd
Sep 15, 2020
Merged

create a shutdown_command method in distro classes#567
OddBloke merged 8 commits into
canonical:masterfrom
emmanuelthome:fix-bad-shutdown-option-freebsd

Conversation

@emmanuelthome
Copy link
Copy Markdown
Contributor

@emmanuelthome emmanuelthome force-pushed the fix-bad-shutdown-option-freebsd branch from 9b16140 to 983aaa2 Compare September 6, 2020 10:11
Copy link
Copy Markdown
Collaborator

@igalic igalic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this be a candidate to go into the distro classes, rather than having to map it out here, we should only be calling the distro's shutdown method

@emmanuelthome
Copy link
Copy Markdown
Contributor Author

yes, it would be better. Note though that load_power_state already had some special case stuff for alpine linux. If we want to refactor, I guess that this would mean something along the lines of the present commits.

Eventually, I can sign the CLA if this piece of code is agreed upon. Who's the "canonical project manager or conact" here ?

(unless advised otherwise, I'd rather force-push a single commit with the different changes here).

@igalic
Copy link
Copy Markdown
Collaborator

igalic commented Sep 7, 2020

according to https://cloudinit.readthedocs.io/en/latest/topics/hacking.html it's ‘Rick Harding’.

Under FreeBSD, we want to use "shutdown -p" for poweroff.

Alpine linux also has some specificities.

We choose to define a method that returns the shutdown command line to
use, rather than a method that actually does the shutdown. This makes it
easier to have the tests in test_handler_power_state do their
verifications.

Two tests are added for the special behaviours that are known so far.
@emmanuelthome emmanuelthome force-pushed the fix-bad-shutdown-option-freebsd branch from b843f87 to 2c5d0ef Compare September 7, 2020 08:33
@emmanuelthome emmanuelthome changed the title under freebsd, use 'shutdown -p' for poweroff create a shutdown_command method in distro classes Sep 7, 2020
@mitechie
Copy link
Copy Markdown
Contributor

mitechie commented Sep 8, 2020

according to https://cloudinit.readthedocs.io/en/latest/topics/hacking.html it's ‘Rick Harding’.

/me waves

When you feel it's ready and the CLA is signed let me know and we'll get someone to help review and guide it through. Thanks!

@emmanuelthome
Copy link
Copy Markdown
Contributor Author

according to https://cloudinit.readthedocs.io/en/latest/topics/hacking.html it's ‘Rick Harding’.

/me waves

When you feel it's ready and the CLA is signed let me know and we'll get someone to help review and guide it through. Thanks!

At this point I'd be happy to get feedback. The patch can be reviewed.

As the gitlab bot says, CLA signed and all tests pass.

Comment thread cloudinit/distros/bsd.py Outdated
Copy link
Copy Markdown
Collaborator

@OddBloke OddBloke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I reviewed this a few days ago but never hit the button, apologies for the delay. Thanks for this change, the refactor onto Distro is much appreciated! I have some inline comments. :-)

(And sorry to make you duplicate a review, Lucas!)

Comment thread cloudinit/distros/bsd.py Outdated
Comment thread tools/.github-cla-signers
Comment thread tests/unittests/test_handler/test_handler_power_state.py Outdated
Comment thread cloudinit/distros/alpine.py Outdated
Comment thread cloudinit/distros/alpine.py Outdated
Comment thread cloudinit/distros/alpine.py
Comment thread tests/unittests/test_handler/test_handler_power_state.py Outdated
Comment thread tests/unittests/test_handler/test_handler_power_state.py Outdated
@emmanuelthome
Copy link
Copy Markdown
Contributor Author

emmanuelthome commented Sep 10, 2020 via email

@OddBloke
Copy link
Copy Markdown
Collaborator

Do we agree that this is what you have in mind ?

I can't speak for Lucas, but this is exactly what I had in mind when I wrote my similar comment a few days ago. 👍

@lucasmoura
Copy link
Copy Markdown
Contributor

@OddBloke @emmanuelthome Yes, that was my idea too

emmanuelthome and others added 2 commits September 10, 2020 22:33
Co-authored-by: Daniel Watkins <daniel@daniel-watkins.co.uk>
This follows from the review suggestions. Indeed, we can avoid the
cumbersome duplication of the Distro.shutdown_command in the BSD command
by mere variation of a shutdown_options_map class object.
@emmanuelthome emmanuelthome force-pushed the fix-bad-shutdown-option-freebsd branch from 3ec4b9b to ae8ee25 Compare September 10, 2020 21:26
Copy link
Copy Markdown
Collaborator

@OddBloke OddBloke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this second pass, this is looking really good now. I do still have a few (small!) inline comments.

Comment thread cloudinit/config/cc_power_state_change.py Outdated
Comment thread cloudinit/distros/__init__.py Outdated
Comment thread cloudinit/distros/__init__.py Outdated
Comment thread cloudinit/distros/alpine.py Outdated
emmanuelthome and others added 4 commits September 11, 2020 16:03
Co-authored-by: Daniel Watkins <daniel@daniel-watkins.co.uk>
Co-authored-by: Daniel Watkins <daniel@daniel-watkins.co.uk>
Co-authored-by: Daniel Watkins <daniel@daniel-watkins.co.uk>
Copy link
Copy Markdown
Collaborator

@OddBloke OddBloke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now, thanks for all your work!

@OddBloke OddBloke merged commit 6d332e5 into canonical:master Sep 15, 2020
@emmanuelthome emmanuelthome deleted the fix-bad-shutdown-option-freebsd branch September 16, 2020 08:35
This was referenced May 11, 2023
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

Successfully merging this pull request may close these issues.

6 participants