daemon: fixed error with EmaneNet startup throwing an error, updated Rj45Node and PhysicalNode to implement all abstract methods

This commit is contained in:
Blake Harnden 2020-06-14 12:36:07 -07:00
parent c4c667bb74
commit cf41948894
2 changed files with 19 additions and 10 deletions

View file

@ -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

View file

@ -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