ansible / ansible-modules-core

Ansible modules - these modules ship with ansible
1.3k stars 1.95k forks source link

Bug sysctl on OpenBSD #287

Closed mrijkeboer closed 9 years ago

mrijkeboer commented 9 years ago

When configuring sysctl settings on OpenBSD, all but that last setting will have white-space around the '=' character. Unfortunately OpenBSD doesn't load sysctl settings with white-space. The following patch removes the white-space around the '=' character.

diff --git a/system/sysctl.py b/system/sysctl.py
index acf6395..979051e 100644
--- a/system/sysctl.py
+++ b/system/sysctl.py
@@ -278,10 +278,10 @@ class SysctlModule(object):
                 checked.append(k)
                 if k == self.args['name']:
                     if self.args['state'] == "present":
-                        new_line = "%s = %s\n" % (k, self.args['value'])
+                        new_line = "%s=%s\n" % (k, self.args['value'])
                         self.fixed_lines.append(new_line)                    
                 else:
-                    new_line = "%s = %s\n" % (k, v)
+                    new_line = "%s=%s\n" % (k, v)
                     self.fixed_lines.append(new_line)                    

         if self.args['name'] not in checked and self.args['state'] == "present":
rpe-github commented 9 years ago

By looking at the manpages of sysctl.conf for NetBSD, FreeBSD, DragonflyBSD and Mac OS X I'd say that the format should have always been "name=value" (whithout spaces around '='). So this is not only affecting OpenBSD.

bcoca commented 9 years ago

@mrijkeboer wan't to submit this as a PR?

mrijkeboer commented 9 years ago

@bcoca I've just submitted a pull request.

bcoca commented 9 years ago

closing this ticket and tracking issue by the PR #298