Fix interface method change (#38996)
This commit is contained in:
parent
e2aa1155ba
commit
87a07e81a9
1 changed files with 8 additions and 0 deletions
|
@ -302,6 +302,14 @@ def setInterfaceOption(module, lines, iface, option, raw_value, state):
|
||||||
|
|
||||||
|
|
||||||
def addOptionAfterLine(option, value, iface, lines, last_line_dict, iface_options):
|
def addOptionAfterLine(option, value, iface, lines, last_line_dict, iface_options):
|
||||||
|
# Changing method of interface is not an addition
|
||||||
|
if option == 'method':
|
||||||
|
for ln in lines:
|
||||||
|
if ln.get('line_type', '') == 'iface':
|
||||||
|
ln['line'] = re.sub(ln.get('params', {}).get('method', '') + '$', value, ln.get('line'))
|
||||||
|
ln['params']['method'] = value
|
||||||
|
return lines
|
||||||
|
|
||||||
last_line = last_line_dict['line']
|
last_line = last_line_dict['line']
|
||||||
prefix_start = last_line.find(last_line.split()[0])
|
prefix_start = last_line.find(last_line.split()[0])
|
||||||
suffix_start = last_line.rfind(last_line.split()[-1]) + len(last_line.split()[-1])
|
suffix_start = last_line.rfind(last_line.split()[-1]) + len(last_line.split()[-1])
|
||||||
|
|
Loading…
Reference in a new issue