why the need for the if/else here?

Wouldn't this be enough: 

    self.ssh = ssh or self.connect()