def _wait_for_device_reboot(self, timeout=3600): """ Wait for the device to finish reboot process and become accessible. Args: timeout (int): The length of time before considering the device unreachable. Raises: RebootTimeoutError: When a connection to the device is not established within the ``timeout`` period. Example: >>> device = AIREOSDevice(**connection_args): >>> device.reboot() >>> device._wait_for_device_reboot() >>> device.connected() True >>> """ start = time.time() while time.time() - start < timeout: try: self.open() return except: # noqa E722 pass # TODO: Get proper hostname parameter raise RebootTimeoutError(hostname=self.host, wait_time=timeout)
def _wait_for_device_reboot(self, timeout=3600): start = time.time() while time.time() - start < timeout: try: self.show("show hostname") return except: # noqa E722 # nosec pass raise RebootTimeoutError(hostname=self.hostname, wait_time=timeout)
def _wait_for_device_reboot(self, timeout=3600): start = time.time() while time.time() - start < timeout: try: self.open() return except: # noqa E722 pass raise RebootTimeoutError(hostname=self.facts["hostname"], wait_time=timeout)
def _wait_for_device_reboot(self, timeout=3600): start = time.time() while time.time() - start < timeout: try: self.open() return except: # noqa E722 # nosec pass # TODO: Get proper hostname parameter raise RebootTimeoutError(hostname=self.host, wait_time=timeout)
def _wait_for_device_reboot(self, timeout=600): start = time.time() while time.time() - start < timeout: try: self.refresh_facts() if self.uptime < 180: return except: # noqa E722 # nosec pass raise RebootTimeoutError(hostname=self.hostname, wait_time=timeout)
def _wait_for_device_reboot(self, timeout=600): start = time.time() while time.time() - start < timeout: try: self.refresh_facts() if self.facts["uptime"] < 180: return except: pass raise RebootTimeoutError(hostname=self.facts["hostname"], wait_time=timeout)
def _wait_for_peer_reboot(self, acceptable_states: Iterable[str], timeout: int = 3600) -> None: """ Wait for peer device to come online and reach an acceptable state. Args: acceptable_states (iter): A list of states that are acceptable for considering peer to be ready. timeout (int): The maximum amount of time to wait for peer device to be online and reach a state in ``acceptable_states``. Raises: RebootTimeoutError: When the ``timeout`` value has been reached and the peer has not reached a state in ``acceptable_states``. Example: >>> dev = ASADevice(**connection_args) >>> dev.peer_redundancy_state 'standby ready' >>> dev.show("failover reload-standby") >>> dev._wait_for_peer_reboot(acceptable_states=["standy ready"]) RebootTimeoutError... >>> dev.peer_redundancy_state 'cold standby' >>> dev.show("failover reload-standby") >>> dev._wait_for_peer_reboot(acceptable_states=["cold-standby", "standy ready"]) >>> dev.peer_redundancy_state 'cold standby' >>> """ start = time.time() while time.time() - start < timeout: if self.peer_redundancy_state == "failed": break while time.time() - start < timeout: if self.peer_redundancy_state in acceptable_states: return time.sleep(1) # TODO: Get proper hostname parameter raise RebootTimeoutError(hostname=f"{self.host}-peer", wait_time=timeout)