Merge "Add /node-list to the webapp"

This commit is contained in:
Zuul 2018-02-07 19:53:33 +00:00 committed by Gerrit Code Review
commit e359c6018b
2 changed files with 8 additions and 0 deletions

View File

@ -102,6 +102,10 @@ def node_list(zk, node_id=None, detail=False):
return str(t)
def node_list_json(zk):
return json.dumps([node.toDict() for node in zk.nodeIterator()])
def dib_image_list(zk):
t = PrettyTable(["ID", "Image", "Builder", "Formats",
"State", "Age"])

View File

@ -83,6 +83,10 @@ class WebApp(threading.Thread):
output = status.dib_image_list(self.nodepool.getZK())
elif path == '/dib-image-list.json':
output = status.dib_image_list_json(self.nodepool.getZK())
elif path == '/node-list':
output = status.node_list(self.nodepool.getZK())
elif path == '/node-list.json':
output = status.node_list_json(self.nodepool.getZK())
else:
return None
return self.cache.put(path, output)