Fix for changing method only on specified interface (#39015)

Test added for interface method change
This commit is contained in:
Olivier Bourdon 2018-04-27 11:18:19 +02:00 committed by ansibot
commit a3f2e99864
8 changed files with 224 additions and 1 deletions

View file

@ -308,7 +308,7 @@ def addOptionAfterLine(option, value, iface, lines, last_line_dict, iface_option
# Changing method of interface is not an addition
if option == 'method':
for ln in lines:
if ln.get('line_type', '') == 'iface':
if ln.get('line_type', '') == 'iface' and ln.get('iface', '') == iface:
ln['line'] = re.sub(ln.get('params', {}).get('method', '') + '$', value, ln.get('line'))
ln['params']['method'] = value
return lines