From edcbd915d4c0f4a833333c2b24025d80997f0636 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Sat, 23 Mar 2024 21:36:58 +0000 Subject: [PATCH] linting --- src/rtems_proxy/__main__.py | 1 - src/rtems_proxy/rsync.sh.jinja | 1 + src/rtems_proxy/telnet.py | 9 ++++++++- src/rtems_proxy/utils.py | 2 -- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/rtems_proxy/__main__.py b/src/rtems_proxy/__main__.py index 984c1e1..bad8526 100644 --- a/src/rtems_proxy/__main__.py +++ b/src/rtems_proxy/__main__.py @@ -1,5 +1,4 @@ from pathlib import Path -from time import sleep from typing import Optional import typer diff --git a/src/rtems_proxy/rsync.sh.jinja b/src/rtems_proxy/rsync.sh.jinja index 6bc86f1..08d8b93 100644 --- a/src/rtems_proxy/rsync.sh.jinja +++ b/src/rtems_proxy/rsync.sh.jinja @@ -10,6 +10,7 @@ export IOC_PATH={{ ioc_path }} pkill -f rsync-background &>/dev/null ibek dev instance $IOC_PATH +bash /epics/ioc/install.sh mkdir -p $RTEMS_TFTP_PATH cd $RTEMS_TFTP_PATH diff --git a/src/rtems_proxy/telnet.py b/src/rtems_proxy/telnet.py index dc54499..a9aa36e 100644 --- a/src/rtems_proxy/telnet.py +++ b/src/rtems_proxy/telnet.py @@ -92,6 +92,8 @@ def check_prompt(self, retries=5) -> RtemsState: bootloader. Because there is a possibility that we are in the middle of a reboot, we will retry for one before giving up. """ + assert self._child, "must call connect before check_prompt" + while retries > 0: try: # see if we are in the IOC shell @@ -123,6 +125,8 @@ def reboot(self, into: RtemsState): Reboot the board from IOC shell or bootloader and choose appropriate options to get to the state requested by the into argument. """ + assert self._child, "must call connect before reboot" + self.report(f"Rebooting into {into.name}") current_state = self.check_prompt() if current_state == RtemsState.MOT: @@ -144,6 +148,8 @@ def get_epics_prompt(self): it into the IOC shell. If the IOC is running, do a reboot only if requested (in order to pick up new binaries/startup/epics db) """ + assert self._child, "must call connect before get_epics_prompt" + current = self.check_prompt() if current != RtemsState.IOC: sleep(0.2) @@ -163,6 +169,8 @@ def get_boot_prompt(self): Get to the bootloader prompt, if the IOC shell is running then exit and send appropriate commands to get to the bootloader """ + assert self._child, "must call connect before get_boot_prompt" + current = self.check_prompt() if current != RtemsState.MOT: # get out of the IOC and return to MOT @@ -192,7 +200,6 @@ def ioc_connect(host_and_port: str, reboot: bool = False): telnet = TelnetRTEMS(host_and_port, reboot) try: - telnet.connect() telnet.get_epics_prompt() except (CannotConnect, pexpect.exceptions.TIMEOUT): print("\n\nNot Connected. Exiting...") diff --git a/src/rtems_proxy/utils.py b/src/rtems_proxy/utils.py index 745edde..c7c36b5 100644 --- a/src/rtems_proxy/utils.py +++ b/src/rtems_proxy/utils.py @@ -36,8 +36,6 @@ def run_command( if p_result.returncode != 0 and not error_OK: typer.echo("\nCommand Failed:") - if not globals.EC_VERBOSE: - typer.echo(command) typer.echo(output) typer.echo(error_out) raise typer.Exit(1)