fix(xo-server-netbox): fix site property null/undefined cases (#7145)
Introduced by 1d7559ded2
This commit is contained in:
@@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||||
|
|
||||||
|
- [Netbox] Fix VMs' `site` property being unnecessarily updated on some versions of Netbox (PR [#7145](https://github.com/vatesfr/xen-orchestra/pull/7145))
|
||||||
|
|
||||||
### Packages to release
|
### Packages to release
|
||||||
|
|
||||||
> When modifying a package, add it here with its release type.
|
> When modifying a package, add it here with its release type.
|
||||||
@@ -27,4 +29,6 @@
|
|||||||
|
|
||||||
<!--packages-start-->
|
<!--packages-start-->
|
||||||
|
|
||||||
|
- xo-server-netbox patch
|
||||||
|
|
||||||
<!--packages-end-->
|
<!--packages-end-->
|
||||||
|
|||||||
@@ -402,7 +402,9 @@ class Netbox {
|
|||||||
cluster: nbVm.cluster?.id ?? null,
|
cluster: nbVm.cluster?.id ?? null,
|
||||||
status: nbVm.status?.value ?? null,
|
status: nbVm.status?.value ?? null,
|
||||||
platform: nbVm.platform?.id ?? null,
|
platform: nbVm.platform?.id ?? null,
|
||||||
site: nbVm.site?.id,
|
// If site is not supported by Netbox, its value is undefined
|
||||||
|
// If site is supported by Netbox but empty, its value is null
|
||||||
|
site: nbVm.site == null ? nbVm.site : nbVm.site.id,
|
||||||
// Sort them so that they can be compared by diff()
|
// Sort them so that they can be compared by diff()
|
||||||
tags: nbVm.tags.map(nbTag => ({ id: nbTag.id })).sort(({ id: id1 }, { id: id2 }) => (id1 < id2 ? -1 : 1)),
|
tags: nbVm.tags.map(nbTag => ({ id: nbTag.id })).sort(({ id: id1 }, { id: id2 }) => (id1 < id2 ? -1 : 1)),
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user