Created attachment 223327 [details] patch The rhel update_sysconfig_file() isn't well suited for *BSD style rc.conf so use the set_rc_config_value() instead. This fixes a bug that prevents the salt module from enabling the salt minion in rc.conf. Mina: Please upstream if you want.
A commit references this bug: Author: brd Date: Wed Mar 17 15:28:54 UTC 2021 New revision: 568666 URL: https://svnweb.freebsd.org/changeset/ports/568666 Log: net/cloud-init: Fix modifying rc.conf in cc_salt_minion PR: 254339 Approved by: Andrey Fesenko (maintainer), swills Changes: head/net/cloud-init/Makefile head/net/cloud-init/files/ head/net/cloud-init/files/patch-cloudinit_config_cc__salt__minion.py
Can this ticket be closed? Or it needs MFH?
MFH is probably a good idea, but mostly I was hoping Mina would confirm upstreaming the fix.
Mina is currently very busy, but will bei happily upstream this
It looks like this is unconditional and would break Linux?: -from cloudinit.distros import rhel_util +from cloudinit.distros import bsd_utils Should it instead be this? diff --git a/cloudinit/config/cc_salt_minion.py b/cloudinit/config/cc_salt_minion.py index b61876aa..379ea800 100644 --- a/cloudinit/config/cc_salt_minion.py +++ b/cloudinit/config/cc_salt_minion.py @@ -46,6 +46,7 @@ specify them with ``pkg_name``, ``service_name`` and ``config_dir``. import os from cloudinit import safeyaml, subp, util +from cloudinit.distros import bsd_utils from cloudinit.distros import rhel_util @@ -125,8 +126,7 @@ def handle(name, cfg, cloud, log, _args): # we need to have the salt minion service enabled in rc in order to be # able to start the service. this does only apply on FreeBSD servers. if cloud.distro.osfamily == 'freebsd': - rhel_util.update_sysconfig_file( - '/etc/rc.conf', {'salt_minion_enable': 'YES'}) + bsd_utils.set_rc_config_value('salt_minion_enable', 'YES') # restart salt-minion. 'service' will start even if not started. if it # was started, it needs to be restarted for config change.
There's a pull request now upstream: https://github.com/canonical/cloud-init/pull/1236 @edmaste, note that your patch would lead to a pylint complaint, because rhel_utils is *not* used in that file.
This has now been merged: https://github.com/canonical/cloud-init/pull/1236 !
Thanks Mina! :)