[pve-devel] [PATCH 2/4] batman_adv: don't load module if missing batctl
Alexandre Derumier
aderumier at odiso.com
Fri May 17 12:26:52 CEST 2019
---
ifupdown2/addons/batman_adv.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ifupdown2/addons/batman_adv.py b/ifupdown2/addons/batman_adv.py
index e47b2ce..452b9ca 100644
--- a/ifupdown2/addons/batman_adv.py
+++ b/ifupdown2/addons/batman_adv.py
@@ -10,13 +10,16 @@ try:
from ifupdown2.ifupdownaddons.modulebase import moduleBase
from ifupdown2.ifupdownaddons.LinkUtils import LinkUtils
from ifupdown2.ifupdown.netlink import netlink
+ from ifupdown2.ifupdown.exceptions import moduleNotSupported
import ifupdown2.ifupdown.ifupdownflags as ifupdownflags
+
except:
from ifupdown.iface import *
from ifupdown.utils import utils
from ifupdownaddons.modulebase import moduleBase
from ifupdownaddons.LinkUtils import LinkUtils
from ifupdown.netlink import netlink
+ from ifupdown.exceptions import moduleNotSupported
import ifupdown.ifupdownflags as ifupdownflags
import logging
@@ -83,6 +86,8 @@ class batman_adv (moduleBase):
def __init__ (self, *args, **kargs):
moduleBase.__init__ (self, *args, **kargs)
+ if not os.path.exists('/usr/sbin/batctl'):
+ raise moduleNotSupported('module init failed: no /usr/sbin/batctl found')
self.ipcmd = None
for longname, entry in self._modinfo['attrs'].items ():
--
2.11.0
More information about the pve-devel
mailing list