From 67d451c3e990f7690ba2fd4a65e2faff03b0eba8 Mon Sep 17 00:00:00 2001 From: "Blake J. Harnden" Date: Tue, 8 Aug 2017 09:17:09 -0700 Subject: [PATCH] fixed old log imports and dont bail out on tdma model exception --- configure.ac | 4 +++- daemon/core/api/coreapi.py | 2 +- daemon/core/constants.py.in | 2 ++ daemon/core/emane/tdma.py | 8 ++++---- daemon/core/service.py | 15 +++++++++------ daemon/core/xml/xmldeployment.py | 1 - daemon/setup.py | 2 +- 7 files changed, 20 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index a81fa8e7..80730abd 100644 --- a/configure.ac +++ b/configure.ac @@ -84,7 +84,7 @@ AC_SUBST(CORE_DATA_DIR) AC_ARG_WITH([guiconfdir], [AS_HELP_STRING([--with-guiconfdir=dir], [specify GUI configuration directory])], - [CORE_GUI_CONF_DIR="$with_guiconfdir"], + [CORE_GUI_CONF_DIR="$with_guiconfdir"], [CORE_GUI_CONF_DIR="\${HOME}/.core"]) AC_SUBST(CORE_GUI_CONF_DIR) AC_ARG_ENABLE([gui], @@ -143,6 +143,8 @@ if test "x$enable_daemon" = "xyes" ; then AC_CHECK_PROG(mount_path, mount, $as_dir, no, $SEARCHPATH) AC_CHECK_PROG(umount_path, umount, $as_dir, no, $SEARCHPATH) AC_CHECK_PROG(convert, convert, yes, no, $SEARCHPATH) + AC_CHECK_PROG(ovs_vs_path, ovs-vsctl, $as_dir, no, $SEARCHPATH) + AC_CHECK_PROG(ovs_of_path, ovs-ofctl, $as_dir, no, $SEARCHPATH) fi #AC_CHECK_PROG(dia, dia, yes, no) diff --git a/daemon/core/api/coreapi.py b/daemon/core/api/coreapi.py index b59446ef..096b3568 100644 --- a/daemon/core/api/coreapi.py +++ b/daemon/core/api/coreapi.py @@ -24,7 +24,7 @@ from core.enumerations import MessageTypes from core.enumerations import NodeTlvs from core.enumerations import RegisterTlvs from core.enumerations import SessionTlvs -from core.misc import log, structutils +from core.misc import structutils from core.misc.ipaddress import IpAddress from core.misc.ipaddress import MacAddress diff --git a/daemon/core/constants.py.in b/daemon/core/constants.py.in index 0aa8ea5f..674c0dc7 100644 --- a/daemon/core/constants.py.in +++ b/daemon/core/constants.py.in @@ -17,3 +17,5 @@ VIMAGE_BIN = "@vimage_path@/vimage" QUAGGA_STATE_DIR = "@CORE_STATE_DIR@/run/quagga" MOUNT_BIN = "@mount_path@/mount" UMOUNT_BIN = "@umount_path@/umount" +OVS_BIN = "@ovs_vs_path@/ovs-vsctl" +OVS_FLOW_BIN = "@ovs_of_path@/ovs-ofctl" diff --git a/daemon/core/emane/tdma.py b/daemon/core/emane/tdma.py index b5f01618..e12eb9b6 100644 --- a/daemon/core/emane/tdma.py +++ b/daemon/core/emane/tdma.py @@ -3,6 +3,7 @@ tdma.py: EMANE TDMA model bindings for CORE """ from core import emane +from core import logger from core.emane.emanemodel import EmaneModel from core.emane.universal import EmaneUniversalModel from core.enumerations import ConfigDataTypes @@ -14,10 +15,9 @@ class EmaneTdmaModel(EmaneModel): # model name name = "emane_tdma" - if emane.VERSION >= emane.EMANE101: - xml_path = "/usr/share/emane/xml/models/mac/tdmaeventscheduler" - else: - raise Exception("EMANE TDMA requires EMANE 1.0.1 or greater") + xml_path = "/usr/share/emane/xml/models/mac/tdmaeventscheduler" + if emane.VERSION < emane.EMANE101: + logger.error("EMANE TDMA requires EMANE 1.0.1 or greater") # MAC parameters _confmatrix_mac = [ diff --git a/daemon/core/service.py b/daemon/core/service.py index 66d45bf9..f60059f0 100644 --- a/daemon/core/service.py +++ b/daemon/core/service.py @@ -135,12 +135,15 @@ class ServiceManager(object): for module_name in module_names: import_statement = "%s.%s" % (base_module, module_name) logger.info("importing custom service module: %s", import_statement) - module = importlib.import_module(import_statement) - members = inspect.getmembers(module, lambda x: _is_service(module, x)) - for member in members: - clazz = member[1] - clazz.on_load() - cls.add(clazz) + try: + module = importlib.import_module(import_statement) + members = inspect.getmembers(module, lambda x: _is_service(module, x)) + for member in members: + clazz = member[1] + clazz.on_load() + cls.add(clazz) + except: + logger.exception("unexpected error during import, skipping: %s", import_statement) class CoreServices(ConfigurableManager): diff --git a/daemon/core/xml/xmldeployment.py b/daemon/core/xml/xmldeployment.py index 91f22abb..a1b387ad 100644 --- a/daemon/core/xml/xmldeployment.py +++ b/daemon/core/xml/xmldeployment.py @@ -7,7 +7,6 @@ from core import emane from core import logger from core.enumerations import NodeTypes from core.misc import ipaddress -from core.misc import log from core.misc import nodeutils from core.netns import nodes from core.xml import xmlutils diff --git a/daemon/setup.py b/daemon/setup.py index 03006589..221e257f 100644 --- a/daemon/setup.py +++ b/daemon/setup.py @@ -25,7 +25,7 @@ setup(name="core-python", "core.xml", ], install_requires=[ - "enum34" + "enum34", "logzero" ], setup_requires=[