Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Commit 75236e2

Browse files
committed
Enable executing j commands within hooks
1 parent ce4f2aa commit 75236e2

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

  • packages/jumpstarter/jumpstarter/client

packages/jumpstarter/jumpstarter/client/core.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,24 @@ def __post_init__(self):
8585
self.logger.addHandler(handler)
8686

8787
async def check_exporter_status(self):
88-
"""Check if the exporter is ready to accept driver calls"""
88+
"""Check if the exporter is ready to accept driver calls.
89+
90+
Allows driver commands during hook execution (BEFORE_LEASE_HOOK, AFTER_LEASE_HOOK)
91+
in addition to the normal LEASE_READY status. This enables hooks to interact
92+
with drivers via the `j` CLI for automation use cases.
93+
"""
94+
# Statuses that allow driver commands
95+
ALLOWED_STATUSES = {
96+
ExporterStatus.LEASE_READY,
97+
ExporterStatus.BEFORE_LEASE_HOOK,
98+
ExporterStatus.AFTER_LEASE_HOOK,
99+
}
100+
89101
try:
90102
response = await self.stub.GetStatus(jumpstarter_pb2.GetStatusRequest())
91103
status = ExporterStatus.from_proto(response.status)
92104

93-
if status != ExporterStatus.LEASE_READY:
105+
if status not in ALLOWED_STATUSES:
94106
raise ExporterNotReady(f"Exporter status is {status}: {response.message}")
95107

96108
except AioRpcError as e:

0 commit comments

Comments
 (0)