From 106439e470ce19c299aeef9c7b87ec480bc79f72 Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Wed, 15 Feb 2017 13:37:09 -0500 Subject: [PATCH] Handle sysctl.conf files that use ';' for comments (#20576) '#' and ';' are both valid comment chars for sysctl.conf files according to the 'man sysctl.conf': "Lines which begin with a # or ; are considered comments and ignored." Fixes #20569 --- lib/ansible/modules/system/sysctl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/system/sysctl.py b/lib/ansible/modules/system/sysctl.py index 763c48e6b5..d4d20ffae6 100644 --- a/lib/ansible/modules/system/sysctl.py +++ b/lib/ansible/modules/system/sysctl.py @@ -307,7 +307,7 @@ class SysctlModule(object): self.file_lines.append(line) # don't split empty lines or comments - if not line or line.startswith("#"): + if not line or line.startswith(("#", ";")): continue k, v = line.split('=',1) @@ -320,7 +320,7 @@ class SysctlModule(object): checked = [] self.fixed_lines = [] for line in self.file_lines: - if not line.strip() or line.strip().startswith("#"): + if not line.strip() or line.strip().startswith(("#", ";")): self.fixed_lines.append(line) continue tmpline = line.strip()