We use Beaker to allocate and loan computer hardware. If you want to talk to it via the comand line, you can use the bkr executable. Some of the information comes back as json, but beaker tends to speak xml. To look up a host name from a job, you need to be able to parse the xml. To do that, I used the xq execuable from the python yq package. Yes, x and y.
I installed yq via pip. That puts both the xq and yq executablees into ~/.local/bin.
If i know the job ID, I can parse it using the following syntax.
bkr job-results 'J:5078388' | xq -r ".job | .recipeSet | .recipe| .task | . | .roles | .role | .system | .\"@value\"" hpe-apollo-cn99xx-14-vm-12.khw4.lab.eng.bos.redhat.com hpe-apollo-cn99xx-14-vm-12.khw4.lab.eng.bos.redhat.com
UPDATE: So here is a useful script that makes use of bkr, jq, and xq to list the hostnames of the hosts I currently have on loan from beaker.
for job in $( bkr job-list -o $USER --unfinished | jq -r '.' ) ; do bkr job-results $job | xq -r ".job | .recipeSet | .recipe| .task | . | .roles | .role | .system | .\"@value\"" ; done