Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Mar 23, 2024
1 parent 1252f95 commit edcbd91
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/rtems_proxy/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from pathlib import Path
from time import sleep
from typing import Optional

import typer
Expand Down
1 change: 1 addition & 0 deletions src/rtems_proxy/rsync.sh.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion src/rtems_proxy/telnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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...")
Expand Down
2 changes: 0 additions & 2 deletions src/rtems_proxy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit edcbd91

Please sign in to comment.