fix(xo-server/xapi-object-to-xo): handle guest metrics reporting empty IP field (#6328)
See https://xcp-ng.org/forum/topic/4810/netbox-plugin-error-ipaddr-the-address-has-neither-ipv6-nor-ipv4-format/27?_=1658735770330
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
- [Home/VM] Show error when deleting VMs failed (PR [#6323](https://github.com/vatesfr/xen-orchestra/pull/6323))
|
- [Home/VM] Show error when deleting VMs failed (PR [#6323](https://github.com/vatesfr/xen-orchestra/pull/6323))
|
||||||
- [REST API] Fix broken VDI after VHD import [#6327](https://github.com/vatesfr/xen-orchestra/issues/6327) (PR [#6326](https://github.com/vatesfr/xen-orchestra/pull/6326))
|
- [REST API] Fix broken VDI after VHD import [#6327](https://github.com/vatesfr/xen-orchestra/issues/6327) (PR [#6326](https://github.com/vatesfr/xen-orchestra/pull/6326))
|
||||||
|
- [Netbox] Fix `ipaddr: the address has neither IPv6 nor IPv4 format` error (PR [#6328](https://github.com/vatesfr/xen-orchestra/pull/6328))
|
||||||
|
|
||||||
### Packages to release
|
### Packages to release
|
||||||
|
|
||||||
|
|||||||
@@ -341,6 +341,11 @@ const TRANSFORMS = {
|
|||||||
// See https://xcp-ng.org/forum/topic/4810
|
// See https://xcp-ng.org/forum/topic/4810
|
||||||
const addresses = {}
|
const addresses = {}
|
||||||
for (const key in networks) {
|
for (const key in networks) {
|
||||||
|
// Some fields may be emtpy
|
||||||
|
// See https://xcp-ng.org/forum/topic/4810/netbox-plugin-error-ipaddr-the-address-has-neither-ipv6-nor-ipv4-format/27?_=1658735770330
|
||||||
|
if (networks[key].trim() === '') {
|
||||||
|
continue
|
||||||
|
}
|
||||||
const [, device, index] = /^(\d+)\/ip(?:v[46]\/(\d))?$/.exec(key) ?? []
|
const [, device, index] = /^(\d+)\/ip(?:v[46]\/(\d))?$/.exec(key) ?? []
|
||||||
const ips = networks[key].split(/\s+/)
|
const ips = networks[key].split(/\s+/)
|
||||||
if (ips.length === 1 && index !== undefined) {
|
if (ips.length === 1 && index !== undefined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user