mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Fix for changing method only on specified interface (#39015)
Test added for interface method change
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user