Fix #663 - In FreeBSD, fail if loader.conf shall be reloaded.

This commit is contained in:
Vladimir Botka 2025-07-24 07:19:27 +02:00
parent d3204df536
commit 385a562148
No known key found for this signature in database
GPG key ID: 90D199128ED44F01

View file

@ -418,6 +418,13 @@ def main():
if module.params['state'] == 'present' and module.params['value'] == '':
module.fail_json(msg="value cannot be blank")
# System specific tests
system = platform.system().lower()
if system == 'freebsd':
if module.params['sysctl_file'] not in ['/etc/sysctl.conf', '/etc/sysctl.conf.local'] and \
module.params['reload']:
module.fail_json(msg="%s can not be reloaded. Set reload=False." % module.params['sysctl_file'])
result = SysctlModule(module)
module.exit_json(changed=result.changed)