From 2b70ed8731ac229f56121977b07879f2e1dc95fa Mon Sep 17 00:00:00 2001 From: CamDavidsonPilon Date: Wed, 12 Jul 2023 09:13:30 -0400 Subject: [PATCH] confirm before deleting --- pioreactor/background_jobs/temperature_control.py | 1 - pioreactor/cli/pios.py | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pioreactor/background_jobs/temperature_control.py b/pioreactor/background_jobs/temperature_control.py index e6ed4f71..7be7cba1 100644 --- a/pioreactor/background_jobs/temperature_control.py +++ b/pioreactor/background_jobs/temperature_control.py @@ -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( diff --git a/pioreactor/cli/pios.py b/pioreactor/cli/pios.py index 5f8e2fc2..eca436fb 100644 --- a/pioreactor/cli/pios.py +++ b/pioreactor/cli/pios.py @@ -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)) @@ -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: