1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

B OpenNebula/one#6106: Show all IPs from nic on FSunstone (#2487)

(cherry picked from commit 65e1549d9290b53c1e577d1a3128ce79f3a6804f)
This commit is contained in:
Frederick Borges 2023-02-08 12:05:19 +01:00 committed by Tino Vázquez
parent 56f090fe4d
commit 26e18f6bdc
No known key found for this signature in database
GPG Key ID: 14201E424D02047E
2 changed files with 4 additions and 10 deletions

View File

@ -2013,7 +2013,6 @@ export const NIC_IP_ATTRS = [
'EXTERNAL_IP', // external IP must be first
'IP',
'IP6',
['IP6_ULA', 'IP6_GLOBAL'],
'IP6_GLOBAL',
'IP6_ULA',
'MAC',

View File

@ -218,18 +218,13 @@ export const getNics = (vm, options = {}) => {
/**
* @param {Nic} nic - NIC
* @returns {string} Ips from resource
* @returns {string[]} Ips from resource
*/
export const getIpsFromNic = (nic) => {
const attributeIp = NIC_IP_ATTRS.find((attr) =>
[attr].flat().every((flatted) => nic[flatted] !== undefined)
)
const ipAttributes = NIC_IP_ATTRS.filter((attr) => nic[attr] !== undefined)
if (attributeIp) {
return [attributeIp]
.flat()
.map((attribute) => nic[attribute])
.join(' ')
if (ipAttributes) {
return [ipAttributes].flat().map((attribute) => nic[attribute])
}
}