Przeglądaj źródła

HUE-1793 [hbase] Api Error: 'NoneType' object has no attribute 'group'

Abraham Elmahrek 12 lat temu
rodzic
commit
9cb6857
1 zmienionych plików z 8 dodań i 5 usunięć
  1. 8 5
      apps/hbase/src/hbase/api.py

+ 8 - 5
apps/hbase/src/hbase/api.py

@@ -59,11 +59,14 @@ class HbaseApi(object):
       full_config = [conf.HBASE_CLUSTERS.get()]
     for config in full_config: #hack cause get() is weird
       match = re.match('\((?P<name>[^\(\)\|]+)\|(?P<host>.+):(?P<port>[0-9]+)\)', config)
-      clusters += [{
-        'name': match.group('name'),
-        'host': match.group('host'),
-        'port': int(match.group('port'))
-      }]
+      if match:
+        clusters += [{
+          'name': match.group('name'),
+          'host': match.group('host'),
+          'port': int(match.group('port'))
+        }]
+      else:
+        raise Exception(_("Cluster configuration %s isn't formatted correctly.") % config)
     return clusters
 
   def getCluster(self, name):