mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +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
1 changed files with 2 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue