Browse Source

BatcaveClient.find_node_by_mac: handle "not found" case

Helge Jung 9 years ago
parent
commit
cb8c63adfa
1 changed files with 4 additions and 1 deletions
  1. 4 1
      modules/batcave/client.py

+ 4 - 1
modules/batcave/client.py

@@ -11,7 +11,7 @@ class BatcaveClient(object):
         assert url.endswith("/"), "BATCAVE URL must end with slash."
 
         self.base_url = url
-        self.logger = logging.getLogger()
+        self.logger = logging.getLogger("BATCAVE")
 
     def __load_response(self, url, error_context):
         raw_data = None
@@ -63,6 +63,9 @@ class BatcaveClient(object):
         url = 'find?mac=' + mac
         matches = self.__load_response(url, 'find_mac=' + mac)
 
+        if matches is None:
+            return None
+
         if single_match_only:
             if len(matches) == 1:
                 return matches[0]