mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
B OpenNebula/one#6751: Fix raw data validation handling (#3269)
Signed-off-by: Victor Hansson <vhansson@opennebula.io> Co-authored-by: Tino Vázquez <cvazquez@opennebula.io> (cherry picked from commit 5333608e42a4524947d17d268c565a62a0432bf4)
This commit is contained in:
parent
383bd5300a
commit
d8fcdbb046
@ -131,7 +131,9 @@ function CreateVmTemplate() {
|
||||
history.push(PATH.TEMPLATE.VMS.LIST)
|
||||
enqueueSuccess(T.SuccessVMTemplateUpdated, [templateId, NAME])
|
||||
}
|
||||
} catch {}
|
||||
} catch (error) {
|
||||
isDevelopment() && console.log('VM Template error: ', error)
|
||||
}
|
||||
}
|
||||
|
||||
return templateId &&
|
||||
|
@ -767,15 +767,18 @@ const transformActionsCommon = (template) => {
|
||||
})
|
||||
}
|
||||
|
||||
// If template has RAW attribute
|
||||
if (template.RAW) {
|
||||
// // Add type (hypervisor) on RAW data if exists data, if not, delete RAW section.
|
||||
if (template.RAW?.DATA) template.RAW.TYPE = template.HYPERVISOR
|
||||
else delete template.RAW
|
||||
// Clone template.RAW to ensure its mutable
|
||||
template.RAW = { ...template.RAW }
|
||||
|
||||
// ISSUE #6418: Raw data is in XML format, so it needs to be transform before sennding it to the API (otherwise the value of RAW.DATA will be treat as part of the XML template)
|
||||
template?.RAW?.DATA &&
|
||||
(template.RAW.DATA = transformXmlString(template.RAW.DATA))
|
||||
if (template.RAW.DATA) {
|
||||
// DATA exists, so we add TYPE and transform DATA
|
||||
template.RAW.TYPE = template.HYPERVISOR
|
||||
template.RAW.DATA = transformXmlString(template.RAW.DATA)
|
||||
} else {
|
||||
// DATA doesn't exist, remove RAW from template
|
||||
delete template.RAW
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user