Test if config specifies a zone before using it

Signed-off-by: Santhosh Edukulla <santhosh.edukulla@gmail.com>
This commit is contained in:
miguelaferreira 2014-07-23 13:50:47 +02:00 committed by Santhosh Edukulla
parent 9f4f9211d0
commit bb1c70b3d8

View File

@ -111,7 +111,7 @@ class MarvinInit:
if not self.__hypervisorType:
self.__hypervisorType = XEN_SERVER
if not self.__zoneForTests:
if self.__parsedConfig:
if self.__parsedConfig and self.__parsedConfig.zones is not None:
for zone in self.__parsedConfig.zones:
self.__zoneForTests = zone.name
break