Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Introduce new setting gallia.power_cycle_sleep_after #352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/gallia/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ def cmd_template(args: argparse.Namespace) -> None:
# power_supply = <string>
# power_cycle = <bool>
# power_cycle_sleep = <float>
# power_cycle_sleep_after = <float>
# dumpcap = <bool>
# artifacts_dir = <string>
# artifacts_base = <string>
Expand Down
12 changes: 11 additions & 1 deletion src/gallia/command/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,8 @@ async def setup(self, args: Namespace) -> None:
self.power_supply = await PowerSupply.connect(args.power_supply)
if args.power_cycle is True:
await self.power_supply.power_cycle(
args.power_cycle_sleep, lambda: asyncio.sleep(2)
args.power_cycle_sleep,
args.power_cycle_sleep_after,
)
elif args.power_cycle is True:
self.parser.error("--power-cycle needs --power-supply")
Expand Down Expand Up @@ -598,6 +599,15 @@ def configure_class_parser(self) -> None:
metavar="SECs",
type=float,
default=self.config.get_value("gallia.scanner.power_cycle_sleep", 5.0),
help="time to sleep after the power-off",
)
group.add_argument(
"--power-cycle-sleep-after",
metavar="SECs",
type=float,
default=self.config.get_value(
"gallia.scanner.power_cycle_sleep_after", 2.0
),
help="time to sleep after the power-cycle",
)

Expand Down