Handle (dis|re)connect more appropriately.
Handle (dis|re)connect more appropriately.

This code was reconnecting via ssh on every iteration of the loop,
which is completely unnecessary.  It should use the existing
connection and only reconnect if there was an SSH error when exeuting
a command.  The code should also explicitly close the connection when
its done.

Change-Id: I2545a1ca5e0cd39a8b453445ea25927756b1fd19

JohnGarbutt/reviewstats,cp16net/reviewstats,openstack-infra/reviewstats,JohnGarbutt/reviewstats,cp16net/reviewstats,openstack-infra/reviewstats