Fix error on containerless networks

This commit is contained in:
LeoVerto 2018-11-08 14:59:01 +01:00
parent 4390b6da78
commit ba2ca68284

View file

@ -93,16 +93,17 @@ def generate_graph(verbose: bool, file: str):
style='filled' style='filled'
) )
for container_id, container in sorted(net['Containers'].items()): if net['Containers']:
if verbose: for container_id, container in sorted(net['Containers'].items()):
dump_json(container) if verbose:
print(" * ", container['Name'], container['IPv4Address'], container['IPv6Address']) dump_json(container)
print(" * ", container['Name'], container['IPv4Address'], container['IPv6Address'])
container_node_id = 'container_%s' % container_id container_node_id = 'container_%s' % container_id
container_iface_ref = "%s:%s" % (container_node_id, container['EndpointID']) container_iface_ref = "%s:%s" % (container_node_id, container['EndpointID'])
g.edge(container_iface_ref, net_node_id+":gw_iface", color=color) g.edge(container_iface_ref, net_node_id+":gw_iface", color=color)
print(g.source) print(g.source)
if file: if file: