From 17d5503fb234cd5a22372a851e40dfd827b6f356 Mon Sep 17 00:00:00 2001 From: "Blake J. Harnden" Date: Fri, 12 Jan 2018 09:50:56 -0800 Subject: [PATCH] removed daemon addons directory and refereces --- Changelog | 1 + daemon/Makefile.am | 2 +- daemon/core/addons/__init__.py | 6 ---- daemon/core/corehandlers.py | 3 +- daemon/core/coreserver.py | 58 ---------------------------------- daemon/core/service.py | 2 +- daemon/data/core.conf | 2 -- daemon/sbin/core-daemon | 29 ----------------- packaging/rpm/core.spec.in | 2 -- 9 files changed, 4 insertions(+), 101 deletions(-) delete mode 100644 daemon/core/addons/__init__.py diff --git a/Changelog b/Changelog index b9228986..c057ae83 100644 --- a/Changelog +++ b/Changelog @@ -4,6 +4,7 @@ - moved ns3 and netns directories to the top of the repo - changes to make use of fpm as the tool for building packages - removed usage of logzero to avoid dependency issues for built packages + - removed daemon addons directory * TEST: - fixed some broken tests * BUGFIXES: diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 30788906..42f7dcc7 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -122,7 +122,7 @@ dist-hook: rm -rf `find $(distdir)/ -name .svn` `find $(distdir)/ -name '*.pyc'` DISTCLEANFILES = Makefile.in core/*.pyc MANIFEST doc/Makefile.in doc/Makefile \ - doc/conf.py core/addons/*.pyc + doc/conf.py # files to include with distribution tarball EXTRA_DIST = $(SETUPPY) MANIFEST.in core doc $(LOGROTATE_FILE) diff --git a/daemon/core/addons/__init__.py b/daemon/core/addons/__init__.py deleted file mode 100644 index c7cbb64e..00000000 --- a/daemon/core/addons/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -""" -Optional add ons can be put in this directory. Everything listed in __all__ is automatically -loaded by the main core module. -""" - -__all__ = [] diff --git a/daemon/core/corehandlers.py b/daemon/core/corehandlers.py index 5b475fdf..dc6fe0af 100644 --- a/daemon/core/corehandlers.py +++ b/daemon/core/corehandlers.py @@ -1137,10 +1137,9 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler): if execute_server: try: logger.info("executing: %s", execute_server) + # TODO: remove this, unless we want to support udp/aux at any level if not isinstance(self.server, CoreServer): # CoreUdpServer): server = self.server.mainserver - # elif isinstance(self.server, CoreAuxServer): - # server = self.server.mainserver else: server = self.server if message.flags & MessageFlags.STRING.value: diff --git a/daemon/core/coreserver.py b/daemon/core/coreserver.py index 882f2239..058d4a0e 100644 --- a/daemon/core/coreserver.py +++ b/daemon/core/coreserver.py @@ -38,8 +38,6 @@ class CoreServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer): self.sessions = {} self.udpserver = None self.udpthread = None - self.auxserver = None - self.auxthread = None self._sessions_lock = threading.Lock() CoreServer.add_server(self) SocketServer.TCPServer.__init__(self, server_address, handler_class) @@ -317,59 +315,3 @@ class CoreUdpServer(SocketServer.ThreadingMixIn, SocketServer.UDPServer): :return: nothing """ self.serve_forever() - - -class CoreAuxServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer): - """ - An auxiliary TCP server. - """ - daemon_threads = True - allow_reuse_address = True - - def __init__(self, server_address, handler_class, main_server): - """ - Create a CoreAuxServer instance. - - :param tuple[str, int] server_address: server address - :param class handler_class: class for handling requests - :param main_server: main server to associate with - """ - - self.mainserver = main_server - logger.info("auxiliary server started, listening on: %s", server_address) - SocketServer.TCPServer.__init__(self, server_address, handler_class) - - def start(self): - """ - Start the core auxiliary server. - - :return: nothing - """ - self.serve_forever() - - def set_session_master(self, handler): - """ - Set the session master handler. - - :param func handler: session master handler - :return: - """ - return self.mainserver.set_session_master(handler) - - def get_session(self, session_id=None): - """ - Retrieve a session. - - :param int session_id: id of session to retrieve - :return: core.session.Session - """ - return self.mainserver.get_session(session_id) - - def to_session_message(self, flags=0): - """ - Retrieve a session message. - - :param flags: message flags - :return: session message - """ - return self.mainserver.to_session_message(flags) diff --git a/daemon/core/service.py b/daemon/core/service.py index 7309baca..3b76eb0a 100644 --- a/daemon/core/service.py +++ b/daemon/core/service.py @@ -162,7 +162,7 @@ class CoreServices(ConfigurableManager): config_type = RegisterTlvs.UTILITY.value _invalid_custom_names = ( - 'core', 'addons', 'api', 'bsd', 'emane', 'misc', 'netns', 'phys', 'services', 'xen' + 'core', 'api', 'bsd', 'emane', 'misc', 'netns', 'phys', 'services', 'xen' ) def __init__(self, session): diff --git a/daemon/data/core.conf b/daemon/data/core.conf index 8ee2a532..032d4390 100644 --- a/daemon/data/core.conf +++ b/daemon/data/core.conf @@ -61,5 +61,3 @@ emane_models = RfPipe, Ieee80211abg, CommEffect, Bypass, Tdma # EMANE log level range [0,4] default: 2 #emane_log_level = 2 emane_realtime = True - -#aux_request_handler = core.addons.api2handler.CoreApi2RequestHandler:12222 diff --git a/daemon/sbin/core-daemon b/daemon/sbin/core-daemon index ec5d7e3e..d544eb89 100755 --- a/daemon/sbin/core-daemon +++ b/daemon/sbin/core-daemon @@ -59,28 +59,6 @@ def startudp(core_server, server_address): return core_server.udpserver -def startaux(core_server, aux_address, aux_handler): - """ - Start a thread running an auxiliary TCP server on the given address. - This server will communicate with client requests using a handler - using the aux_handler class. The aux_handler can provide an alternative - API to CORE. - - :param core.coreserver.CoreServer core_server: core server instance - :param tuple[str, int] aux_address: auxiliary server address - :param str aux_handler: auxiliary handler string to import - :return: auxiliary server - """ - handlermodname, dot, handlerclassname = aux_handler.rpartition(".") - handlermod = importlib.import_module(handlermodname) - handlerclass = getattr(handlermod, handlerclassname) - core_server.auxserver = coreserver.CoreAuxServer(aux_address, handlerclass, core_server) - core_server.auxthread = threading.Thread(target=core_server.auxserver.start) - core_server.auxthread.daemon = True - core_server.auxthread.start() - return core_server.auxserver - - def banner(): """ Output the program banner printed to the terminal or log file. @@ -113,12 +91,6 @@ def cored(cfg=None): udpserver = startudp(server, (host, port)) closeonexec(udpserver.fileno()) - auxreqhandler = cfg["aux_request_handler"] - if auxreqhandler: - handler, auxport = auxreqhandler.rsplit(":") - auxserver = startaux(server, (host, int(auxport)), handler) - closeonexec(auxserver.fileno()) - server.serve_forever() @@ -212,7 +184,6 @@ def get_merged_config(filename): "daemonize": "False", "debug": "False", "execfile": None, - "aux_request_handler": None, } usagestr = "usage: %prog [-h] [options] [args]\n\n" + \ diff --git a/packaging/rpm/core.spec.in b/packaging/rpm/core.spec.in index 1ccbbc86..a8abe483 100644 --- a/packaging/rpm/core.spec.in +++ b/packaging/rpm/core.spec.in @@ -321,8 +321,6 @@ fi %{python_sitelib}/core/sdt.py* %{python_sitelib}/core/service.py* %{python_sitelib}/core/coreserver.py* -%dir %{python_sitelib}/core/addons -%{python_sitelib}/core/addons/__init__.py* %dir %{python_sitelib}/core/api %{python_sitelib}/core/api/coreapi.py* %{python_sitelib}/core/api/data.py*