Add /node-list to the webapp
This change adds /node-list and /node-list.json to enable listing current node list over http. Change-Id: I256ebbba8692e78827a9104b08b433aafa26c71c
This commit is contained in:
parent
b7efdb36f2
commit
f2ad9ee0bc
@ -102,6 +102,10 @@ def node_list(zk, node_id=None, detail=False):
|
|||||||
return str(t)
|
return str(t)
|
||||||
|
|
||||||
|
|
||||||
|
def node_list_json(zk):
|
||||||
|
return json.dumps([node.toDict() for node in zk.nodeIterator()])
|
||||||
|
|
||||||
|
|
||||||
def dib_image_list(zk):
|
def dib_image_list(zk):
|
||||||
t = PrettyTable(["ID", "Image", "Builder", "Formats",
|
t = PrettyTable(["ID", "Image", "Builder", "Formats",
|
||||||
"State", "Age"])
|
"State", "Age"])
|
||||||
|
@ -83,6 +83,10 @@ class WebApp(threading.Thread):
|
|||||||
output = status.dib_image_list(self.nodepool.getZK())
|
output = status.dib_image_list(self.nodepool.getZK())
|
||||||
elif path == '/dib-image-list.json':
|
elif path == '/dib-image-list.json':
|
||||||
output = status.dib_image_list_json(self.nodepool.getZK())
|
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:
|
else:
|
||||||
return None
|
return None
|
||||||
return self.cache.put(path, output)
|
return self.cache.put(path, output)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user