events: evaluate FLIPOFF_DRYRUN at trigger time, not import time

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I7ba13a47cba9f396bc91c994e0b5a0756a6a6964
This commit is contained in:
raf 2026-04-07 16:19:24 +03:00
commit 5d0c2782cb
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF

View file

@ -15,10 +15,9 @@ class Event(ABC):
class PoweroffEvent(Event):
name = "poweroff"
DEBUG: bool = os.environ.get("FLIPOFF_DRYRUN", "0") == "1"
async def trigger(self) -> None:
if self.DEBUG:
if os.environ.get("FLIPOFF_DRYRUN", "0") == "1":
print("DRYRUN: Would power off")
return
try: