mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixes ignoreerrors not working with sysctl_set
This commit is contained in:
parent
224b5d5283
commit
7358bf88e2
1 changed files with 10 additions and 1 deletions
|
@ -250,8 +250,17 @@ class SysctlModule(object):
|
||||||
if self.platform == 'openbsd':
|
if self.platform == 'openbsd':
|
||||||
# openbsd doesn't accept -w, but since it's not needed, just drop it
|
# openbsd doesn't accept -w, but since it's not needed, just drop it
|
||||||
thiscmd = "%s %s=%s" % (self.sysctl_cmd, token, value)
|
thiscmd = "%s %s=%s" % (self.sysctl_cmd, token, value)
|
||||||
|
elif self.platform == 'freebsd':
|
||||||
|
ignore_missing = ''
|
||||||
|
if self.args['ignoreerrors']:
|
||||||
|
ignore_missing = '-i'
|
||||||
|
# freebsd doesn't accept -w, but since it's not needed, just drop it
|
||||||
|
thiscmd = "%s %s %s=%s" % (self.sysctl_cmd, ignore_missing, token, value)
|
||||||
else:
|
else:
|
||||||
thiscmd = "%s -w %s=%s" % (self.sysctl_cmd, token, value)
|
ignore_missing = ''
|
||||||
|
if self.args['ignoreerrors']:
|
||||||
|
ignore_missing = '-e'
|
||||||
|
thiscmd = "%s %s -w %s=%s" % (self.sysctl_cmd, ignore_missing, token, value)
|
||||||
rc,out,err = self.module.run_command(thiscmd)
|
rc,out,err = self.module.run_command(thiscmd)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
self.module.fail_json(msg='setting %s failed: %s' % (token, out + err))
|
self.module.fail_json(msg='setting %s failed: %s' % (token, out + err))
|
||||||
|
|
Loading…
Reference in a new issue