feat(xo-cli rest): explicit error if not registered

Fixes https://xcp-ng.org/forum/post/68698
This commit is contained in:
Julien Fontanet 2023-12-22 11:33:08 +01:00
parent 2ec164c560
commit 0d4cf48410
2 changed files with 7 additions and 0 deletions

View File

@ -35,6 +35,7 @@
<!--packages-start-->
- vhd-lib patch
- xo-cli minor
- xo-server minor
- xo-web minor

View File

@ -134,6 +134,12 @@ export async function rest(args) {
const { allowUnauthorized, server, token } = await config.load()
if (server === undefined) {
const errorMessage =
'Please use `xo-cli --register` to associate with an XO instance first.\n\nSee `xo-cli --help` for more info.'
throw errorMessage
}
const baseUrl = server
const baseOpts = {
headers: {