From cf4194889410c1faab5d04ca307a85f4f9b4f656 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Sun, 14 Jun 2020 12:36:07 -0700 Subject: [PATCH] daemon: fixed error with EmaneNet startup throwing an error, updated Rj45Node and PhysicalNode to implement all abstract methods --- daemon/core/emane/nodes.py | 3 +++ daemon/core/nodes/physical.py | 26 ++++++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/daemon/core/emane/nodes.py b/daemon/core/emane/nodes.py index 68c1bc05..8383cdd1 100644 --- a/daemon/core/emane/nodes.py +++ b/daemon/core/emane/nodes.py @@ -76,6 +76,9 @@ class EmaneNet(CoreNetworkBase): def config(self, conf: str) -> None: self.conf = conf + def startup(self) -> None: + pass + def shutdown(self) -> None: pass diff --git a/daemon/core/nodes/physical.py b/daemon/core/nodes/physical.py index a2e39d49..13214093 100644 --- a/daemon/core/nodes/physical.py +++ b/daemon/core/nodes/physical.py @@ -217,14 +217,17 @@ class PhysicalNode(CoreNodeBase): return open(hostfilename, mode) def nodefile(self, filename: str, contents: str, mode: int = 0o644) -> None: - with self.opennodefile(filename, "w") as node_file: - node_file.write(contents) - os.chmod(node_file.name, mode) - logging.info("created nodefile: '%s'; mode: 0%o", node_file.name, mode) + with self.opennodefile(filename, "w") as f: + f.write(contents) + os.chmod(f.name, mode) + logging.info("created nodefile: '%s'; mode: 0%o", f.name, mode) def cmd(self, args: str, wait: bool = True, shell: bool = False) -> str: return self.host_cmd(args, wait=wait) + def addfile(self, srcname: str, filename: str) -> None: + raise NotImplementedError + class Rj45Node(CoreNodeBase): """ @@ -446,10 +449,13 @@ class Rj45Node(CoreNodeBase): self.interface.setposition() def termcmdstring(self, sh: str) -> str: - """ - Create a terminal command string. - - :param sh: shell to execute command in - :return: str - """ + raise NotImplementedError + + def addfile(self, srcname: str, filename: str) -> None: + raise NotImplementedError + + def nodefile(self, filename: str, contents: str, mode: int = 0o644) -> None: + raise NotImplementedError + + def cmd(self, args: str, wait: bool = True, shell: bool = False) -> str: raise NotImplementedError