示例#1
0
    def is_nifi_service_started(cls,
                                no_of_retries=no_of_retries,
                                sleep_duration=retry_sleep_duration):
        """
        Nifi service status will be checked on the value of NO_OF_RETRIES times.
        After every try the code will sleep for RETRY_SLEEP_DURATION seconds.
        If the nifi service status is "STARTED" we will be returning True
        else the function will return a false
        """
        status = False
        for i in range(cls.no_of_retries):
            service_status = cls.get_nifi_service_status(
                cls.get_ambari_cluster_name())

            logger.info("Host names : " + str(cls._hosts))
            logger.info("Nifi service status is : " + service_status)

            if service_status == "STARTED":
                # If service started mark then return True. Assert in test_nifi.py will handle assert Success
                status = True
                break
            logger.info("Nifi service not started yet. Attempt " + str(i))
            sleep(cls.retry_sleep_duration)
        if not status:
            logger.error(
                'Nifi service has not been started/active on any of the hosts')
        return status
示例#2
0
 def is_secure(cls):
     url = "%s/api/v1/clusters/%s" % (Ambari.getWebUrl(), Ambari.getClusterName())
     retcode = None
     for i in range(10):
         retcode, retdata, retheaders = Ambari.performRESTCall(url)
         if retcode == 200:
             jsoncontent = util.getJSON(retdata)
             try:
                 if jsoncontent['Clusters']['security_type'] == "KERBEROS":
                     return True
             except:
                 pass
         util.sleep(5)
     return False
示例#3
0
 def is_smm_service_started(cls, no_of_retries=10, sleep_duration=6):
     """
     SMM service status will be checked on the value of NO_OF_RETRIES times.
     After every try the code will sleep for RETRY_SLEEP_DURATION seconds.
     If the smm service status is "STARTED" we will be returning True
     else the function will return a false
     """
     for i in range(no_of_retries):
         service_status = cls.get_smm_service_status(cls.get_ambari_cluster_name())
         logger.info("SMM service status is : " + service_status)
         if service_status == "STARTED":
             # If service started mark then return True. Assert in test_smm.py will handle assert Success
             return True
         logger.info("SMM service not started yet. Attempt " + str(i))
         util.sleep(sleep_duration)
     logger.error('SMM service is not yet started')
     return False