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:
parent
56f090fe4d
commit
26e18f6bdc
@ -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',
|
||||
|
@ -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])
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user