client/tools/spacewalk-koan/spacewalkkoan/spacewalkkoan.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 050a067098ef5ec8154efd6de34c33b9b7d64647
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Wed Dec 12 17:20:42 2012 +0100
use ip instead of ifconfig to get networking info
ifconfig (part of net-tools) will not always be part of a @base installation.
diff --git a/client/tools/spacewalk-koan/spacewalkkoan/spacewalkkoan.py
b/client/tools/spacewalk-koan/spacewalkkoan/spacewalkkoan.py
index 51c8f06..a499223 100644
--- a/client/tools/spacewalk-koan/spacewalkkoan/spacewalkkoan.py
+++ b/client/tools/spacewalk-koan/spacewalkkoan/spacewalkkoan.py
@@ -46,28 +46,28 @@ def find_host_name():
return execute("hostname")[0]
def find_netmask(device):
- nm = execute("LANG=C ifconfig %s | perl -lne '/Mask:([\d.]+)/ and print
$1'" % device)
+ nm = execute("LANG=C ipcalc -4ms $(ip -4 -o addr show dev %s | awk '{print
$4}')|awk -F= '{print $2}'" % device)
if nm:
return nm[0]
else:
return ""
def find_netmask6(device):
- nm6 = execute("LANG=C ifconfig %s | perl -lne '/inet6 addr:
[[:xdigit:]:]+\/([\d]+).+Scope:Global/ and print $1'" % device)
+ nm6 = execute("LANG=C ip -6 -o addr show dev %s | perl -lne 'print $1 if
m!/(.+) scope global!'" % device)
if nm6:
return nm6[0]
else:
return ""
def find_ip(device):
- ip = execute("LANG=C ifconfig %s | perl -lne '/inet addr:([\d.]+)/ and print
$1'" % device)
+ ip = execute("LANG=C ip -4 -o addr show dev %s | perl -lne 'print $1 if
m!.+\s(.+)/.+ scope global!'" % device)
if ip:
return ip[0]
else:
return ""
def find_ip6(device):
- ip6 = execute("LANG=C ifconfig %s | perl -lne '/inet6 addr:
([[:xdigit:]:]+).+Scope:Global/ and print $1'" % device)
+ ip6 = execute("LANG=C ip -6 -o addr show dev %s | perl -lne 'print $1 if
m!.+\s(.+)/.+ scope global!'" % device)
if ip6:
return ip6[0]
else:
Show replies by date