From 6d332e5c8dbfb6521a530b1fa49d73da51efff96 Mon Sep 17 00:00:00 2001 From: Emmanuel Thomé Date: Tue, 15 Sep 2020 21:51:52 +0200 Subject: create a shutdown_command method in distro classes (#567) 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. --- cloudinit/distros/bsd.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cloudinit/distros/bsd.py') diff --git a/cloudinit/distros/bsd.py b/cloudinit/distros/bsd.py index 2ed7a7d5..f717a667 100644 --- a/cloudinit/distros/bsd.py +++ b/cloudinit/distros/bsd.py @@ -17,6 +17,10 @@ class BSD(distros.Distro): hostname_conf_fn = '/etc/rc.conf' rc_conf_fn = "/etc/rc.conf" + # This differs from the parent Distro class, which has -P for + # poweroff. + shutdown_options_map = {'halt': '-H', 'poweroff': '-p', 'reboot': '-r'} + # Set in BSD distro subclasses group_add_cmd_prefix = [] pkg_cmd_install_prefix = [] -- cgit v1.2.3