Enrich 400 error messages with ranch, user and token info

Summary

  • Call /v0.1/whoami in request, restart and reserve commands to obtain ranch, username and token name
  • Include this identity info in 400 error messages so users know which ranch rejected the compose and which credentials were used
  • Fix double period in error messages (API message already ends with ., CLI appended another)
  • Quote compose name in "Compose X does not exist" errors

Before

⛔ Request is invalid. Compose RHEL-10.3-image-mode does not exist. Go to
https://docs.testing-farm.io/Testing%20Farm/0.1/test-environment.html#_composes to find all
available composes..
Please file an issue to https://gitlab.com/testing-farm/general/-/issues/new if unsure.

After

⛔ Request is invalid (user mvadkert, token t14s). Compose 'RHEL-10.3-image-mode' does not
exist for 'public' ranch. Go to
https://docs.testing-farm.io/Testing%20Farm/0.1/test-environment.html#_composes to find all
available composes for 'public' ranch.
Please file an issue to https://gitlab.com/testing-farm/general/-/issues/new if unsure.

Assisted-by: Claude Code

Edited by Miroslav Vadkerti

Merge request reports

Loading