From 9c679d27836c764d0191e6db6029e6fd1ec0b4ac Mon Sep 17 00:00:00 2001 From: Jed Reynolds Date: Fri, 7 Aug 2020 08:18:11 -0700 Subject: [PATCH] tip_station_powersave.py: adds new way of testing for no results --- py-scripts/tip_station_powersave.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/py-scripts/tip_station_powersave.py b/py-scripts/tip_station_powersave.py index 483c3d6c..6a453df2 100755 --- a/py-scripts/tip_station_powersave.py +++ b/py-scripts/tip_station_powersave.py @@ -197,7 +197,8 @@ class TIPStationPowersave(LFCliBase): print("Collecting lanforge eth0 IP...") eth0_resp = self.json_get("/port/1/%s/eth0?fields=port,alias,ip"%self.resource, debug_=self.debug) - if (eth0_resp is None) or ("items" in eth0_resp) or ("interface" not in eth0_resp): + # would be nice to have a not_found() kind of method + if (eth0_resp is None) or ("items" in eth0_resp) or ("empty" in eth0_resp) or ("interface" not in eth0_resp): self._fail("Unable to query %s.eth0"%self.resource, print_=True) exit(1) self.eth0_ip = eth0_resp["interface"]["ip"]