diff options
Diffstat (limited to 'cloudinit/distros/freebsd.py')
-rw-r--r-- | cloudinit/distros/freebsd.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cloudinit/distros/freebsd.py b/cloudinit/distros/freebsd.py index 4268abe6..77a94c61 100644 --- a/cloudinit/distros/freebsd.py +++ b/cloudinit/distros/freebsd.py @@ -37,14 +37,17 @@ class Distro(cloudinit.distros.bsd.BSD): prefer_fqdn = True # See rc.conf(5) in FreeBSD home_dir = "/usr/home" - def manage_service(self, action: str, service: str): + @classmethod + def manage_service( + cls, action: str, service: str, *extra_args: str, rcs=None + ): """ Perform the requested action on a service. This handles FreeBSD's 'service' case. The FreeBSD 'service' is closer in features to 'systemctl' than SysV init's 'service', so we override it. May raise ProcessExecutionError """ - init_cmd = self.init_cmd + init_cmd = cls.init_cmd cmds = { "stop": [service, "stop"], "start": [service, "start"], @@ -55,8 +58,8 @@ class Distro(cloudinit.distros.bsd.BSD): "try-reload": [service, "restart"], "status": [service, "status"], } - cmd = list(init_cmd) + list(cmds[action]) - return subp.subp(cmd, capture=True) + cmd = init_cmd + cmds[action] + list(extra_args) + return subp.subp(cmd, capture=True, rcs=rcs) def _get_add_member_to_group_cmd(self, member_name, group_name): return ["pw", "usermod", "-n", member_name, "-G", group_name] @@ -191,6 +194,3 @@ class Distro(cloudinit.distros.bsd.BSD): ["update"], freq=PER_INSTANCE, ) - - -# vi: ts=4 expandtab |