From 25ac54dfad91dbe3dbd3eac72a4e71052efe9d36 Mon Sep 17 00:00:00 2001 From: Pranav Jerry Date: Sun, 26 Sep 2021 13:25:35 +0530 Subject: [PATCH] removed arguments added in previous commit Too much configs and args make debugging harder. The class networkd will be used to add config files to the networkd runtime dir after formatting the file with str.format(). --- naxalnet/config.py | 7 ------- naxalnet/default.py | 3 ++- naxalnet/network.py | 7 +++++++ setup.cfg | 3 ++- .../{check.01-eth.network => tmp.01-eth.network} | 0 5 files changed, 11 insertions(+), 9 deletions(-) rename systemd-networkd/{check.01-eth.network => tmp.01-eth.network} (100%) diff --git a/naxalnet/config.py b/naxalnet/config.py index e061678..ecbab00 100644 --- a/naxalnet/config.py +++ b/naxalnet/config.py @@ -170,13 +170,6 @@ def parse_args() -> Namespace: "-v", "--verbose", action="count", default=0, help="increase output verbosity" ) - parser.add_argument( - "--glob-mesh-configs", - type=str, - default=config["globs"]["meshconfigs"], - help="glob matching filenames for mesh configuration", - ) - # logger.debug("Parsing arguments") return parser.parse_args() diff --git a/naxalnet/default.py b/naxalnet/default.py index f28bc76..fb5b5c7 100644 --- a/naxalnet/default.py +++ b/naxalnet/default.py @@ -31,7 +31,6 @@ CONFIG = { "confdir": "/usr/share/naxalnet/networkd", "runtimedir": "/run/systemd/network", }, - "globs": {"meshconfigs": "mesh.*", "checkconfigs": "check.*"}, "adhoc": {"name": "NxMesh"}, "ap": {"ssid": "MeshWiFi", "passwd": "naxalnet256"}, } @@ -39,6 +38,8 @@ CONFIG = { # glob CONFIG_FILES = ["naxalnet.conf", "naxalnet.conf.d/*.conf"] CONFIG_DIRS = ["/usr/share/naxalnet", "/usr/local/share/naxalnet", "/etc/naxalnet"] +MESH_GLOB = "mesh.*" +TMP_NET_GLOB = "tmp.*" ISSUE_URL = "https://git.disroot.org/pranav/naxalnet/issues" REPORT_BUG_INFO = "If you think this is a bug, report it to " + ISSUE_URL diff --git a/naxalnet/network.py b/naxalnet/network.py index 13574aa..dee26e0 100644 --- a/naxalnet/network.py +++ b/naxalnet/network.py @@ -42,4 +42,11 @@ class Networkd: def __init__(self, bus=SystemMessageBus()): self._bus = bus + self.proxy_reload() + + def proxy_reload(self): + """reload the proxy""" self.proxy = self._bus.get_proxy(NETWORKD_BUS, NETWORKD_PATH) + + def add_config(self, path: str): + """add config file to runtime directory and reload networkd""" diff --git a/setup.cfg b/setup.cfg index 3b9dd65..fe01735 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,7 +34,7 @@ console_scripts = lib/systemd/system = naxalnet.service # If installing with pip, this file will be copied to some other place. -# This is the reason we use setup.py instead of pip. +# This is the reason we use setup.py instead of pip in the Makefile. /etc/naxalnet = naxalnet.conf.example share/naxalnet/networkd = @@ -45,3 +45,4 @@ share/naxalnet/networkd = systemd-networkd/mesh.05-wireless-ap.network systemd-networkd/mesh.06-eth.network systemd-networkd/mesh.07-bridge.network + systemd-networkd/tmp.01-eth.network diff --git a/systemd-networkd/check.01-eth.network b/systemd-networkd/tmp.01-eth.network similarity index 100% rename from systemd-networkd/check.01-eth.network rename to systemd-networkd/tmp.01-eth.network