BF: apache cfg parsing - relax assumption that value cannot contain = (#8930)

* BF: apache cfg parsing - relax assumption that value cannot contain =

* Remove failing test_update_runtime_vars_bad_output

* Add test Define statements: with = in value, and an empty value

* update CHANGELOG

Co-authored-by: Alex Zorin <alex@zorin.id.au>
This commit is contained in:
Yaroslav Halchenko
2021-08-13 07:57:24 +10:00
committed by GitHub
co-authored by Alex Zorin
parent 693a2a7904
commit 5e87aee968
3 changed files with 11 additions and 18 deletions
@@ -153,13 +153,10 @@ def parse_defines(apachectl):
return {}
for match in matches:
if match.count("=") > 1:
logger.error("Unexpected number of equal signs in "
"runtime config dump.")
raise errors.PluginError(
"Error parsing Apache runtime variables")
parts = match.partition("=")
variables[parts[0]] = parts[2]
# Value could also contain = so split only once
parts = match.split('=', 1)
value = parts[1] if len(parts) == 2 else ''
variables[parts[0]] = value
return variables