def _get_wait_timeout(self, wait): if wait is False: return False if wait not in self.__timeout_cache: if not self.is_cib_live: raise LibraryError(reports.wait_for_idle_not_live_cluster()) ensure_wait_for_idle_support(self.cmd_runner()) self.__timeout_cache[wait] = get_valid_timeout_seconds(wait) return self.__timeout_cache[wait]
def _get_validated_wait_timeout(report_processor, wait, start): try: if wait is False: return False if not start: report_processor.report( reports.wait_for_node_startup_without_start()) return get_valid_timeout_seconds(wait) except LibraryError as e: report_processor.report_list(e.args) return None
def get_wait_timeout(self, wait): if wait is False: return False if wait not in self.__timeout_cache: if not self.is_cib_live: raise LibraryError( ReportItem.error( reports.messages.WaitForIdleNotLiveCluster())) self.__timeout_cache[wait] = get_valid_timeout_seconds(wait) return self.__timeout_cache[wait]
def _wait_type_to_int(wait: WaitType) -> int: """ Convert WaitType to int. wait -- wait value. If False, it means wait is disabled, therefore -1 is returned. If None, wait is enabled without timeout, therefore 0 is returned. If string representing timeout or positive integer, wait is enabled with timeout, therefore number of seconds is retuned. Otherwise a LibraryError is raised. """ if wait is False: return -1 wait_timeout = get_valid_timeout_seconds(wait) if wait_timeout is None: return 0 return wait_timeout