Fix #139. Adjust Debian OS type depending on architecture

This commit is contained in:
Anders Ingemann 2015-05-02 12:16:00 +02:00
parent df224e61a4
commit e783927ea0
2 changed files with 14 additions and 3 deletions

View file

@ -15,10 +15,10 @@
</NetworkSection>
<VirtualSystem ovf:id="[BOXNAME]">
<Info>A virtual machine</Info>
<OperatingSystemSection ovf:id="96">
<OperatingSystemSection ovf:id="[OS_ID]">
<Info>The kind of installed guest operating system</Info>
<Description>Debian_64</Description>
<vbox:OSType ovf:required="false">Debian_64</vbox:OSType>
<Description>[OS_DESCRIPTION]</Description>
<vbox:OSType ovf:required="false">[OS_TYPE]</vbox:OSType>
</OperatingSystemSection>
<VirtualHardwareSection>
<Info>Virtual hardware requirements for a virtual machine</Info>

View file

@ -189,6 +189,17 @@ class PackageBox(Task):
[system] = root.findall('./ovf:VirtualSystem', namespaces)
attr(system, 'ovf:id', info._vagrant['box_name'])
# Set the operating system
[os_section] = system.findall('./ovf:OperatingSystemSection', namespaces)
os_info = {'i386': {'id': 96, 'name': 'Debian'},
'amd64': {'id': 96, 'name': 'Debian_64'}
}.get(info.manifest.system['architecture'])
attr(os_section, 'ovf:id', os_info['id'])
[os_desc] = os_section.findall('./ovf:Description', namespaces)
os_desc.text = os_info['name']
[os_type] = os_section.findall('./vbox:OSType', namespaces)
os_type.text = os_info['name']
[sysid] = system.findall('./ovf:VirtualHardwareSection/ovf:System/'
'vssd:VirtualSystemIdentifier', namespaces)
sysid.text = info._vagrant['box_name']