osdict: _OsVariantOsInfo._init_ doesn't call _OsVariant._init_

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2014-09-09 17:03:59 +02:00
parent cbe5ffcee7
commit 1291ffc8b7

View File

@ -173,20 +173,16 @@ class _OSVariant(object):
return default return default
return val return val
if name != name.lower():
raise RuntimeError("OS dictionary wants lowercase name, not "
"'%s'" % name)
self.name = name self.name = name
self.label = label self.label = label
self.sortby = sortby self.sortby = sortby
self.is_type = bool(is_type) self.is_type = bool(is_type)
if typename == _SENTINEL and self.is_type:
self.typename = self.name
else:
self.typename = typename
self.typename = typename
if typename == _SENTINEL:
self.typename = _get_default("typename",
self.is_type and self.name or _SENTINEL)
# 'types' should rarely be altered, this check will make # 'types' should rarely be altered, this check will make
# doubly sure that a new type isn't accidentally added # doubly sure that a new type isn't accidentally added
@ -457,38 +453,46 @@ class _OsVariantOsInfo(_OSVariant):
def __init__(self, o): def __init__(self, o):
self._os = o self._os = o
name = self._get_name()
label = self.get_label() self.name = self._get_name()
sortby = self._get_sortby() if self.name != self.name.lower():
is_type = False raise RuntimeError("OS dictionary wants lowercase name, not "
typename = self._get_typename() "'%s'" % self.name)
urldistro = self._get_urldistro() self.is_type = False
supported = self._get_supported() self.typename = self._get_typename()
three_stage_install = self._is_three_stage_install()
acpi = self._is_acpi() if self.typename == _SENTINEL and self.is_type:
apic = self._is_apic() self.typename = self.name
clock = self._get_clock()
xen_disable_acpi = self._get_xen_disable_acpi() # 'types' should rarely be altered, this check will make
virtiommio = self._is_virtiommio() # doubly sure that a new type isn't accidentally added
qemu_ga = self._is_qemu_ga() _approved_types = ["linux", "windows", "unix",
hyperv_features = self._is_hyperv_features() "solaris", "other"]
virtioconsole = lambda: self._is_virtioconsole() if self.typename not in _approved_types:
netmodel = lambda: self._get_netmodel() raise RuntimeError("type '%s' for variant '%s' not in list "
diskbus = lambda: self._get_diskbus() "of approved distro types %s" %
inputtype = lambda: self._get_inputtype() (self.typename, self.name, _approved_types))
inputbus = lambda: self.get_inputbus()
virtiodisk = lambda: self._is_virtiodisk()
virtionet = lambda: self._is_virtionet() self.label = self.get_label()
_OSVariant.__init__(self, name=name, label=label, is_type=is_type, self.sortby = self._get_sortby()
typename=typename, sortby=sortby, self.urldistro = self._get_urldistro()
urldistro=urldistro, supported=supported, self.supported = self._get_supported()
three_stage_install=three_stage_install, acpi=acpi, apic=apic, self.three_stage_install = self._is_three_stage_install()
clock=clock, netmodel=netmodel, diskbus=diskbus, self.acpi = self._is_acpi()
inputtype=inputtype, inputbus=inputbus, self.apic = self._is_apic()
virtionet=virtionet, virtiodisk=virtiodisk, self.clock = self._get_clock()
virtiommio=virtiommio, virtioconsole=virtioconsole, self.xen_disable_acpi = self._get_xen_disable_acpi()
xen_disable_acpi=xen_disable_acpi, qemu_ga=qemu_ga, self.virtiommio = self._is_virtiommio()
hyperv_features=hyperv_features) self.qemu_ga = self._is_qemu_ga()
self.hyperv_features = self._is_hyperv_features()
self.virtioconsole = lambda: self._is_virtioconsole()
self.netmodel = lambda: self._get_netmodel()
self.diskbus = lambda: self._get_diskbus()
self.inputtype = lambda: self._get_inputtype()
self.inputbus = lambda: self.get_inputbus()
self.virtiodisk = lambda: self._is_virtiodisk()
self.virtionet = lambda: self._is_virtionet()
def get_recommended_resources(self, arch): def get_recommended_resources(self, arch):
ret = {} ret = {}