1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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
This commit is contained in:
Adrian Likins 2017-02-15 13:37:09 -05:00 committed by GitHub
parent 320c791cfb
commit 106439e470

View file

@ -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()