diff options
author | Adrian Likins <alikins@redhat.com> | 2017-02-15 13:37:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-15 13:37:09 -0500 |
commit | 106439e470ce19c299aeef9c7b87ec480bc79f72 (patch) | |
tree | aac4b4cc295a1dd0b89721bd7a546e550593b7a5 | |
parent | 320c791cfbb56e9b118b00baddfbb71a1e6fc7cb (diff) | |
download | ansible-106439e470ce19c299aeef9c7b87ec480bc79f72.tar.gz |
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
-rw-r--r-- | lib/ansible/modules/system/sysctl.py | 4 |
1 files 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() |