X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tools.py;h=feb3e33ea9bfc955a39bf9057c242459104d890e;hb=4d4e858777b67fe7311e8224c55429d3db325fed;hp=059b282b3c586946716436f79b13e8c03f1e90e2;hpb=01f35612d6d9d93a52e07f2cba8dfa50ecaaecdf;p=nodemanager.git diff --git a/tools.py b/tools.py index 059b282..feb3e33 100644 --- a/tools.py +++ b/tools.py @@ -242,6 +242,11 @@ def get_sliver_ifconfig(slice_name, device="eth0"): side effects: adds "/usr/sbin" to sys.path """ + # See if setns is installed. If it's not then we're probably not running + # LXC. + if not os.path.exists("/usr/sbin/setns.so"): + return None + # setns is part of lxcsu and is installed to /usr/sbin if not "/usr/sbin" in sys.path: sys.path.append("/usr/sbin")