diff options
author | Tim Rozet <trozet@redhat.com> | 2017-05-04 20:36:01 -0400 |
---|---|---|
committer | Feng Pan <fpan@redhat.com> | 2017-05-05 12:26:55 +0000 |
commit | b5e4091424ced384b49f6ff13b1ef2b63466f947 (patch) | |
tree | a1ddabd23428d14cf6a4cd7310bc9613b47415ce /lib/python/apex | |
parent | 605342b46095341c9301456c81e354c73e2197eb (diff) |
Fixes relative path for 'ip' command
Change-Id: I63606f7cc200ddbe35c6df2cbb56fa442c2bfb9b
Signed-off-by: Tim Rozet <trozet@redhat.com>
(cherry picked from commit e0eda9d2ce02eb0afddd66f328f8794b073a7958)
Diffstat (limited to 'lib/python/apex')
-rw-r--r-- | lib/python/apex/ip_utils.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/python/apex/ip_utils.py b/lib/python/apex/ip_utils.py index b039e26b..ae60b705 100644 --- a/lib/python/apex/ip_utils.py +++ b/lib/python/apex/ip_utils.py @@ -147,7 +147,7 @@ def get_interface(nic, address_family=4): if not nic.strip(): logging.error("empty nic name specified") return None - output = subprocess.getoutput("ip -{} addr show {} scope global" + output = subprocess.getoutput("/usr/sbin/ip -{} addr show {} scope global" .format(address_family, nic)) if address_family == 4: pattern = re.compile("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/\d{1,2}") @@ -178,14 +178,15 @@ def find_gateway(interface): """ address_family = interface.version - output = subprocess.getoutput("ip -{} route".format(address_family)) + output = subprocess.getoutput("/usr/sbin/ip -{} route".format( + address_family)) pattern = re.compile("default\s+via\s+(\S+)\s+") match = re.search(pattern, output) if match: gateway_ip = match.group(1) - reverse_route_output = subprocess.getoutput("ip route get {}" + reverse_route_output = subprocess.getoutput("/usr/sbin/ip route get {}" .format(gateway_ip)) pattern = re.compile("{}.+src\s+{}".format(gateway_ip, interface.ip)) if not re.search(pattern, reverse_route_output): |