summaryrefslogtreecommitdiff
path: root/cloudinit/distros/bsd.py
diff options
context:
space:
mode:
authorEmmanuel Thomé <Emmanuel.Thome@inria.fr>2020-09-15 21:51:52 +0200
committerGitHub <noreply@github.com>2020-09-15 15:51:52 -0400
commit6d332e5c8dbfb6521a530b1fa49d73da51efff96 (patch)
tree501e0dfcead71b501f1a1be1fc08df7c988975d4 /cloudinit/distros/bsd.py
parent839016e3014d783354bc380799d914ff81ee4efa (diff)
downloadvyos-cloud-init-6d332e5c8dbfb6521a530b1fa49d73da51efff96.tar.gz
vyos-cloud-init-6d332e5c8dbfb6521a530b1fa49d73da51efff96.zip
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.
Diffstat (limited to 'cloudinit/distros/bsd.py')
-rw-r--r--cloudinit/distros/bsd.py4
1 files changed, 4 insertions, 0 deletions
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 = []