Skip to content

Commit

Permalink
Merge pull request #1596 from pslldq/allowhint
Browse files Browse the repository at this point in the history
remote/client: add hint for the labgrid-client allow command
  • Loading branch information
Emantor authored Feb 4, 2025
2 parents fcd2698 + a334761 commit de5257d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions labgrid/remote/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down

0 comments on commit de5257d

Please sign in to comment.