def exists(self):
        """
        check if db exists
        """
        logging.debug("verifying is db exists")

        # Making sure postgresql service is up
        postgresql = utils.Service("postgresql")
        postgresql.conditionalStart()

        try:
            # We want to make check if postgresql service is up
            logging.debug("making sure postgresql service is up")
            utils.retry(utils.checkIfRhevmDbIsUp, tries=5, timeout=15, sleep=3)
        except:
            # If we're here, it means something is wrong, either there is a real db error
            # or the db is not installed, let's check
            logging.debug("checking if db is already installed..")
            (out, rc) = utils.execSqlCommand(basedefs.DB_ADMIN, basedefs.DB_NAME, "select 1")
            if (rc != 0):
                if utils.verifyStringFormat(out,".*FATAL:\s*database\s*\"%s\"\s*does not exist" % (PREFIX)):
                    # This means that the db is not installed, so we return false
                    return False

        return True
Пример #2
0
def isDBUp():
    """
    check if ovirt-engine db is up
    """
    logging.debug("checking if %s db is already installed and running.." %
                  basedefs.DB_NAME)
    (out, rc) = utils.execSqlCommand(basedefs.DB_ADMIN, basedefs.DB_NAME,
                                     "select 1", True)
Пример #3
0
def isDBUp():
    """
    check if ovirt-engine db is up
    """
    logging.debug("checking if %s db is already installed and running.."%basedefs.DB_NAME)
    (out, rc) = utils.execSqlCommand(basedefs.DB_ADMIN, basedefs.DB_NAME, "select 1", True)