コード例 #1
0
    def send_client_reboot(self, client_id: str):
        """
        Triggers the reboot of the specified client

        :param client_id: ID of the client
        :return: None
        :raises UnknownClientException: If client id is unknown to the system
        :raises NoClientResponseException: If client did not respond to the request
        :raises ClientRebootError: If client could not be rebooted for aby reason
        """
        if client_id not in [x.get_name() for x in self._delegate.get_client_info()]:
            raise UnknownClientException(client_id)
        writer = ClientController(client_id, self._network)
        writer.reboot_client()
コード例 #2
0
    def _reboot_client(self):
        print()
        print("Rebooting Client:")

        reboot_controller = ClientController(self._client_name, self._network)

        try:
            with LoadingIndicator():
                reboot_controller.reboot_client()
            print("Client reboot successful\n")

        except NoClientResponseException:
            print("Received no response to reboot request\n")
            return
        except ClientRebootError:
            print("Failed to reboot client\n")
            return
コード例 #3
0
def test_client_controller_reboot(controller: ClientController, manager: ClientConfigManager,
                                  connector: DummyNetworkConnector):
    with pytest.raises(NoClientResponseException):
        controller.reboot_client()

    connector.reset()

    connector.mock_ack(False)
    with pytest.raises(ClientRebootError):
        controller.reboot_client()

    connector.reset()

    connector.mock_ack(True)
    controller.reboot_client()