Open Tulux opened 9 months ago
Quick work-around to set OEM strings from list:
Terraform part:
xml {
xslt = templatefile("${path.module}/smbios.xsl.tftpl", {"oemstrings": ["hello", "world"]})
}
XSLT/template smbios.xsl.tftpl
part:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/domain/os">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<xsl:element name ="smbios">
<xsl:attribute name="mode">sysinfo</xsl:attribute>
</xsl:element>
</xsl:copy>
</xsl:template>
<xsl:template match="/domain">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<xsl:element name ="sysinfo">
<xsl:attribute name="type">smbios</xsl:attribute>
<xsl:element name="oemStrings">
%{ for oemstring in oemstrings ~}
<xsl:element name="entry">${oemstring}</xsl:element>
%{ endfor ~}
</xsl:element>
</xsl:element>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Hi, thanks for the report and workaround. Could you provide a little bigger example XML using dict (the second one in first post)?
Hello,
Actually it was only a suggestion, I am only using lists in my projects.
Florent
That's fine, I was just curious how it looks like in entirety.
A quick and portable way to transmit information such as strings to guest is using SMBIOS tables.
Can be implemented in a simple way by using a list that would fill the OEM section:
smbios = ['string1', 'string2']
which would be converted to:Or by using a mix of dict/list:
smbios = {'system':{'manufacturer':'Fedora'}}
Which would be converted to: