mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #47966 from mbunkus/fix-postfix-prefix-free-key-names-assumption
Fix postfix.set_main's assumption of prefix-free key names
This commit is contained in:
commit
998a1c13d5
@ -288,9 +288,10 @@ def set_main(key, value, path=MAIN_CF):
|
||||
pairs, conf_list = _parse_main(path)
|
||||
|
||||
new_conf = []
|
||||
key_line_match = re.compile("^{0}([\\s=]|$)".format(re.escape(key)))
|
||||
if key in pairs:
|
||||
for line in conf_list:
|
||||
if line.startswith(key):
|
||||
if re.match(key_line_match, line):
|
||||
new_conf.append('{0} = {1}'.format(key, value))
|
||||
else:
|
||||
new_conf.append(line)
|
||||
|
Loading…
Reference in New Issue
Block a user