mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 10:25:28 +00:00
Clean up connection profile after running pytest
Running the pytest with nm provider failed in the downstream testing because the "NM_CONTROLLED=no" appeared in `/etc/sysconfig/network-scripts/ifcfg-testeth` which caused the veth `testeth` strictly unmanaged by NetworkManager. To fix it, clean up such a connection profile at the end when running the pytest. Signed-off-by: Wen Liang <liangwen12year@gmail.com>
This commit is contained in:
parent
d3a7124f07
commit
db4bf873cb
1 changed files with 9 additions and 0 deletions
|
|
@ -78,6 +78,15 @@ def testnic1():
|
|||
yield veth_name
|
||||
finally:
|
||||
subprocess.call(["ip", "link", "delete", veth_name])
|
||||
if os.path.isfile("/etc/sysconfig/network-scripts/ifcfg-" + veth_name):
|
||||
os.unlink("/etc/sysconfig/network-scripts/ifcfg-" + veth_name)
|
||||
subprocess.call(
|
||||
[
|
||||
"nmcli",
|
||||
"con",
|
||||
"reload",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def _get_ip_addresses(interface):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue