Skip to content

Commit

Permalink
confirm before deleting
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Jul 12, 2023
1 parent d2ebf2a commit 2b70ed8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion pioreactor/background_jobs/temperature_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def __init__(
from TMP1075 import TMP1075 # type: ignore

self.pwm = self.setup_pwm()
self.update_heater(0)

self.heating_pcb_tmp_driver = TMP1075(address=hardware.TEMP)
self.read_external_temperature_timer = RepeatedTimer(
Expand Down
7 changes: 7 additions & 0 deletions pioreactor/cli/pios.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ def _thread_function(unit: str) -> bool:
type=click.STRING,
help="specify a Pioreactor name, default is all active non-leader units",
)
@click.option("-y", is_flag=True, help="Skip asking for confirmation.")
def rm(
filepath: str,
units: tuple[str, ...],
y: bool,
) -> None:
logger = create_logger("rm", unit=get_unit_name(), experiment=UNIVERSAL_EXPERIMENT)
units = remove_leader(universal_identifier_to_all_workers(units))
Expand All @@ -173,6 +175,11 @@ def rm(

command = join(["rm", filepath])

if not y:
confirm = input(f"Confirm running `{command}` on {units}? Y/n: ").strip()
if confirm != "Y":
raise click.Abort()

def _thread_function(unit: str) -> bool:
logger.debug(f"Removing {unit}:{filepath}...")
try:
Expand Down

0 comments on commit 2b70ed8

Please sign in to comment.