From a33476176c03aae0fefa31907cf709aafb76eb4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20P=C3=BCschel?= Date: Tue, 4 Feb 2025 08:55:12 +0100 Subject: [PATCH] remote/client: add hint for the labgrid-client allow command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- labgrid/remote/client.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/labgrid/remote/client.py b/labgrid/remote/client.py index 5ab4f0683..500162c2a 100755 --- a/labgrid/remote/client.py +++ b/labgrid/remote/client.py @@ -448,9 +448,13 @@ def _check_allowed(self, place): if f"{self.gethostname()}/{self.getuser()}" not in place.allowed: host, user = place.acquired.split("/") if user != self.getuser(): - raise UserError(f"place {place.name} is not acquired by your user, acquired by {user}") + raise UserError( + 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()}" + ) if host != self.gethostname(): - raise UserError(f"place {place.name} is not acquired on this computer, acquired on {host}") + raise UserError( + 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" + ) def get_place(self, place=None): pattern = place or self.args.place @@ -468,7 +472,10 @@ def get_place(self, place=None): def get_idle_place(self, place=None): place = self.get_place(place) if place.acquired: - raise UserError(f"place {place.name} is not idle (acquired by {place.acquired})") + _, user = place.acquired.split("/") + raise UserError( + 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()}" + ) return place def get_acquired_place(self, place=None):