def _wait_keys(self):
        timeout = api.env.replication_wait_timeout
        deadline = int(time.time()) + timeout
        logger.debug("Waiting up to %s seconds to see our keys "
                     "appear on host %s", timeout, self.ldap_uri)

        konn = KEMLdap(self.ldap_uri)
        saved_e = None
        while True:
            try:
                return konn.check_host_keys(self.fqdn)
            except Exception as e:
                # Print message to console only once for first error.
                if saved_e is None:
                    # FIXME: Change once there's better way to show this
                    # message in installer output,
                    print(
                        "  Waiting for keys to appear on host: {}, please "
                        "wait until this has completed.".format(
                            self.ldap_uri)
                    )
                # log only once for the same error
                if not isinstance(e, type(saved_e)):
                    logger.debug(
                        "Transient error getting keys: '%s'", e)
                    saved_e = e
                if int(time.time()) > deadline:
                    raise RuntimeError("Timed out trying to obtain keys.")
                time.sleep(1)
Beispiel #2
0
    def __wait_keys(self, host, timeout=300):
        ldap_uri = 'ldap://%s' % host
        deadline = int(time.time()) + timeout
        logger.info(
            "Waiting up to %s seconds to see our keys "
            "appear on host: %s", timeout, host)

        konn = KEMLdap(ldap_uri)
        saved_e = None
        while True:
            try:
                return konn.check_host_keys(self.fqdn)
            except Exception as e:
                # log only once for the same error
                if not isinstance(e, type(saved_e)):
                    logger.debug("Transient error getting keys: '%s'", e)
                    saved_e = e
                if int(time.time()) > deadline:
                    raise RuntimeError("Timed out trying to obtain keys.")
                time.sleep(1)
Beispiel #3
0
    def __wait_keys(self, host, timeout=300):
        ldap_uri = 'ldap://%s' % host
        deadline = int(time.time()) + timeout
        logger.info("Waiting up to %s seconds to see our keys "
                    "appear on host: %s", timeout, host)

        konn = KEMLdap(ldap_uri)
        saved_e = None
        while True:
            try:
                return konn.check_host_keys(self.fqdn)
            except Exception as e:
                # log only once for the same error
                if not isinstance(e, type(saved_e)):
                    logger.debug(
                        "Transient error getting keys: '%s'", e)
                    saved_e = e
                if int(time.time()) > deadline:
                    raise RuntimeError("Timed out trying to obtain keys.")
                time.sleep(1)
Beispiel #4
0
    def __wait_keys(self, host, timeout=300):
        ldap_uri = 'ldap://%s' % host
        deadline = int(time.time()) + timeout
        logger.info("Waiting up to %s seconds to see our keys "
                    "appear on host: %s", timeout, host)
        # FIXME: Change once there's better way to show this mesage
        # in installer output
        print("Waiting for keys to appear on host: {}, "
              "please wait until this has completed.".format(host))

        konn = KEMLdap(ldap_uri)
        saved_e = None
        while True:
            try:
                return konn.check_host_keys(self.fqdn)
            except Exception as e:
                # log only once for the same error
                if not isinstance(e, type(saved_e)):
                    logger.debug(
                        "Transient error getting keys: '%s'", e)
                    saved_e = e
                if int(time.time()) > deadline:
                    raise RuntimeError("Timed out trying to obtain keys.")
                time.sleep(1)
Beispiel #5
0
    def __wait_keys(self, host, timeout=300):
        ldap_uri = 'ldap://%s' % host
        deadline = int(time.time()) + timeout
        logger.info("Waiting up to %s seconds to see our keys "
                    "appear on host: %s", timeout, host)
        # FIXME: Change once there's better way to show this mesage
        # in installer output
        print("Waiting for keys to appear on host: {}, "
              "please wait until this has completed.".format(host))

        konn = KEMLdap(ldap_uri)
        saved_e = None
        while True:
            try:
                return konn.check_host_keys(self.fqdn)
            except Exception as e:
                # log only once for the same error
                if not isinstance(e, type(saved_e)):
                    logger.debug(
                        "Transient error getting keys: '%s'", e)
                    saved_e = e
                if int(time.time()) > deadline:
                    raise RuntimeError("Timed out trying to obtain keys.")
                time.sleep(1)