Skip to content

Commit 08eb0ea

Browse files
pslldqsebastianbergt
authored andcommitted
remote/client: add hint for the labgrid-client allow command
Add a hint for the labgrid-client allow command in lock error messages. Given the error message suggests that removing the lock is necessary (using unlock or kick), add a hint that there is also third choice. Signed-off-by: Sven Püschel <[email protected]>
1 parent fcd2698 commit 08eb0ea

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

labgrid/remote/client.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,13 @@ def _check_allowed(self, place):
448448
if f"{self.gethostname()}/{self.getuser()}" not in place.allowed:
449449
host, user = place.acquired.split("/")
450450
if user != self.getuser():
451-
raise UserError(f"place {place.name} is not acquired by your user, acquired by {user}")
451+
raise UserError(
452+
f"place {place.name} is not acquired by your user, acquired by {user}. To work simultaneously, {user} can execute labgrid-client -p {place.name} allow {self.gethostname()}/{self.getuser()}"
453+
)
452454
if host != self.gethostname():
453-
raise UserError(f"place {place.name} is not acquired on this computer, acquired on {host}")
455+
raise UserError(
456+
f"place {place.name} is not acquired on this computer, acquired on {host}. To allow this host, use labgrid-client -p {place.name} allow {self.gethostname()}/{self.getuser()} on the other host"
457+
)
454458

455459
def get_place(self, place=None):
456460
pattern = place or self.args.place
@@ -468,7 +472,10 @@ def get_place(self, place=None):
468472
def get_idle_place(self, place=None):
469473
place = self.get_place(place)
470474
if place.acquired:
471-
raise UserError(f"place {place.name} is not idle (acquired by {place.acquired})")
475+
_, user = place.acquired.split("/")
476+
raise UserError(
477+
f"place {place.name} is not idle (acquired by {place.acquired}). To work simultaneously, {user} can execute labgrid-client -p {place.name} allow {self.gethostname()}/{self.getuser()}"
478+
)
472479
return place
473480

474481
def get_acquired_place(self, place=None):

0 commit comments

Comments
 (0)