Changed attempts functionality to only SSH.

The old attempts functionality would retry if the subprocess error code
was not 0. The new functionality only retries if the SSH connection couldn't
be established. This was the original intention of the functionality, but
wasn't designed to strictly be only that. The new functionality reflects the
designed intent.

The two tests (Python and shell) have been modified accordingly).