def is_connected(self, attempts=3):
        """Try to reconnect if neccessary.

        :param   attempts: The amount of tries to reconnect if neccessary.
        :type    attempts: ``int``
        """
        if self.gce is None:
            while attempts > 0:
                self.logger.info("Attempting to connect ...")
                try:
                    self.connect()
                except ComputeEngineManagerException:
                    attempts -= 1
                    continue
                self.logger.info("Connection established.")
                return True
            self.logger.error("Unable to connect to Google Compute Engine.")
            return False

        return True
def is_connected ( self , attempts = 3 ) : if self . gce is None : while attempts > 0 : self . logger . info ( "Attempting to connect ..." ) try : self . connect ( ) except ComputeEngineManagerException : attempts -= 1 continue self . logger . info ( "Connection established." ) return True self . logger . error ( "Unable to connect to Google Compute Engine." ) return False return True
Try to reconnect if neccessary.

        :param   attempts: The amount of tries to reconnect if neccessary.
        :type    attempts: ``int``