From 9b236a61917cb964540ca84265e5ba940de42bf4 Mon Sep 17 00:00:00 2001 From: Pierre Donias Date: Wed, 18 Oct 2023 11:56:10 +0200 Subject: [PATCH] fix(netbox/test): test custom fields first (#7104) More atomic and it makes more sense for users to check that the Netbox configuration is correct before doing any write operations --- CHANGELOG.unreleased.md | 1 + packages/xo-server-netbox/src/index.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 76bb562f3..8f9237432 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -41,6 +41,7 @@ - @xen-orchestra/xapi minor - xo-server minor - xo-server-backup-reports minor +- xo-server-netbox patch - xo-server-usage-report patch - xo-web minor diff --git a/packages/xo-server-netbox/src/index.js b/packages/xo-server-netbox/src/index.js index 3f5253af4..d35feff2c 100644 --- a/packages/xo-server-netbox/src/index.js +++ b/packages/xo-server-netbox/src/index.js @@ -103,6 +103,8 @@ class Netbox { } async test() { + await this.#checkCustomFields() + const randomSuffix = Math.random().toString(36).slice(2, 11) const name = '[TMP] Xen Orchestra Netbox plugin test - ' + randomSuffix await this.#request('/virtualization/cluster-types/', 'POST', { @@ -113,8 +115,6 @@ class Netbox { }) const nbClusterTypes = await this.#request(`/virtualization/cluster-types/?name=${encodeURIComponent(name)}`) - await this.#checkCustomFields() - if (nbClusterTypes.length !== 1) { throw new Error('Could not properly write and read Netbox') }