Fixed creation of machine settings file

If no vmnic setup is present a request to iterator over
a NoneType object is attempted and failed. This Fixes #710
This commit is contained in:
Marcus Schäfer 2018-04-20 10:42:36 +02:00
parent b2a0e1d2eb
commit ebbc4942b7
No known key found for this signature in database
GPG Key ID: AD11DD02B44996EF
2 changed files with 3 additions and 0 deletions

View File

@ -633,6 +633,8 @@ class XMLState(object):
machine_section = self.get_build_type_machine_section()
if machine_section:
return machine_section.get_vmnic()
else:
return []
def get_build_type_vmdvd_section(self):
"""

View File

@ -199,6 +199,7 @@ class TestXMLState(object):
def test_get_build_type_vmnic_entries(self):
assert self.state.get_build_type_vmnic_entries()[0].get_interface() \
== ''
assert self.boot_state.get_build_type_vmnic_entries() == []
def test_get_build_type_vmdvd_section(self):
assert self.state.get_build_type_vmdvd_section().get_id() == 0