diff --git a/dentos-poe-agent/opt/poeagent/bin/poecli.py b/dentos-poe-agent/opt/poeagent/bin/poecli.py index e626297..78a0407 100755 --- a/dentos-poe-agent/opt/poeagent/bin/poecli.py +++ b/dentos-poe-agent/opt/poeagent/bin/poecli.py @@ -430,6 +430,9 @@ def send_ipc_event(self, action=POECLI_SET): def main(argv): try: poecli = PoeCLI() + except FileNotFoundError as e: + print_stderr("This platform does not support PoE.") + os._exit(-10) except Exception as e: print_stderr("Failed to load poe platform! (%s)" % str(e)) os._exit(-9) diff --git a/dentos-poe-agent/opt/poeagent/bin/poed.py b/dentos-poe-agent/opt/poeagent/bin/poed.py index 97f76aa..8598e9d 100755 --- a/dentos-poe-agent/opt/poeagent/bin/poed.py +++ b/dentos-poe-agent/opt/poeagent/bin/poed.py @@ -183,11 +183,14 @@ def platform_src_path(self): def load_poe_plat(self): poe_plat = None - try: - plat_src = imp.load_source("poe_plat", self.platform_src_path()) - poe_plat = plat_src.get_poe_platform() - except Exception as e: - self.log.alert("Failed to load PoE platform. err: %s" % str(e)) + if os.path.exists(self.platform_src_path()): + try: + plat_src = imp.load_source("poe_plat", self.platform_src_path()) + poe_plat = plat_src.get_poe_platform() + except Exception as e: + self.log.alert("Failed to load PoE platform. err: %s" % str(e)) + else: + self.log.info("No PoE platform found, assuming no PoE support.") return poe_plat def is_valid_plat(self, poe_plat):