From c097c31258ecf8d2c23193b8045d0b12b227b2a1 Mon Sep 17 00:00:00 2001 From: Hemna Date: Wed, 6 Oct 2021 12:09:52 -0400 Subject: [PATCH] Updated dev to use plugin manager Also ensure that main creates the client prior to starting the plugins. --- aprsd/dev.py | 4 +++- aprsd/main.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/aprsd/dev.py b/aprsd/dev.py index 01eecc1..23fb608 100644 --- a/aprsd/dev.py +++ b/aprsd/dev.py @@ -190,7 +190,9 @@ def test_plugin( client.Client(config) pm = plugin.PluginManager(config) + pm._init() obj = pm._create_class(plugin_path, plugin.APRSDPluginBase, config=config) + pm._pluggy_pm.register(obj) login = config["aprs"]["login"] packet = { @@ -200,7 +202,7 @@ def test_plugin( "msgNo": 1, } - reply = obj.filter(packet) + reply = pm.run(packet) # Plugin might have threads, so lets stop them so we can exit. obj.stop_threads() LOG.info(f"Result = '{reply}'") diff --git a/aprsd/main.py b/aprsd/main.py index 010d8ad..af88327 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -464,6 +464,9 @@ def server( LOG.error("No Clients are enabled in config.") sys.exit(-1) + # Creates the client object + client.factory.create().client + # Create the initial PM singleton and Register plugins plugin_manager = plugin.PluginManager(config) plugin_manager.setup_plugins()