Fix error on containerless networks
This commit is contained in:
parent
4390b6da78
commit
ba2ca68284
1 changed files with 8 additions and 7 deletions
|
@ -93,16 +93,17 @@ def generate_graph(verbose: bool, file: str):
|
|||
style='filled'
|
||||
)
|
||||
|
||||
for container_id, container in sorted(net['Containers'].items()):
|
||||
if verbose:
|
||||
dump_json(container)
|
||||
print(" * ", container['Name'], container['IPv4Address'], container['IPv6Address'])
|
||||
if net['Containers']:
|
||||
for container_id, container in sorted(net['Containers'].items()):
|
||||
if verbose:
|
||||
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)
|
||||
if file:
|
||||
|
|
Loading…
Reference in a new issue