mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07: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:
parent
320c791cfb
commit
106439e470
1 changed files with 2 additions and 2 deletions
|
@ -307,7 +307,7 @@ class SysctlModule(object):
|
||||||
self.file_lines.append(line)
|
self.file_lines.append(line)
|
||||||
|
|
||||||
# don't split empty lines or comments
|
# don't split empty lines or comments
|
||||||
if not line or line.startswith("#"):
|
if not line or line.startswith(("#", ";")):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
k, v = line.split('=',1)
|
k, v = line.split('=',1)
|
||||||
|
@ -320,7 +320,7 @@ class SysctlModule(object):
|
||||||
checked = []
|
checked = []
|
||||||
self.fixed_lines = []
|
self.fixed_lines = []
|
||||||
for line in self.file_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)
|
self.fixed_lines.append(line)
|
||||||
continue
|
continue
|
||||||
tmpline = line.strip()
|
tmpline = line.strip()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue