From 0676346aeb2299f8609f2330d3e26706169c76b0 Mon Sep 17 00:00:00 2001
From: cody burkard <cody@onlab.us>
Date: Fri, 7 Nov 2014 05:10:06 -0800
Subject: [PATCH] fix plot command to work when standard classes are present

---
 examples/clustercli.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/clustercli.py b/examples/clustercli.py
index 264f901c..c8d26de8 100644
--- a/examples/clustercli.py
+++ b/examples/clustercli.py
@@ -53,8 +53,8 @@ def do_plot( self, line ):
         pos = nx.graphviz_layout( g )
         opts = { 'ax': None, 'font_weight': 'bold',
 		 'width': 2, 'edge_color': 'darkblue' }
-        hcolors = [ color[ h.server ] for h in hosts ]
-        scolors = [ color[ s.server ] for s in switches ]
+        hcolors = [ color[ getattr( h, 'server', 'localhost' ) ] for h in hosts ]
+        scolors = [ color[ getattr( s, 'server', 'localhost' ) ] for s in switches ]
         nx.draw_networkx( g, pos=pos, nodelist=hosts, node_size=800, label='host',
                           node_color=hcolors, node_shape='s', **opts )
         nx.draw_networkx( g, pos=pos, nodelist=switches, node_size=1000,
-- 
GitLab