mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Fix for changing method only on specified interface (#39015)
Test added for interface method change
This commit is contained in:
parent
9f1254a32f
commit
a3f2e99864
8 changed files with 224 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue