Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions tests/dns/static_dns/test_static_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import logging
import random
import re
import os

from tests.common.reboot import reboot
from tests.common.config_reload import config_reload
Expand Down Expand Up @@ -42,7 +41,7 @@
DUPLICATED_IP_ERR = r"Error: .* nameserver is already configured"

MGMT_PORT = "eth0"
DHCLIENT_PID_FILE = "/tmp/dhclient-dns-test.pid"
DHCLIENT_PID_FILE = "/run/dhclient-dns-test.pid"


def start_dhclient(duthost):
Expand All @@ -53,7 +52,7 @@ def start_dhclient(duthost):
def stop_dhclient(duthost):
yield

if os.path.exists(DHCLIENT_PID_FILE):
if duthost.shell(f'ls {DHCLIENT_PID_FILE}', module_ignore_errors=True)['rc'] == 0:
duthost.shell(f"sudo kill $(cat {DHCLIENT_PID_FILE})")
duthost.shell(f"rm -rf {DHCLIENT_PID_FILE}")

Expand Down