Do not return broken appliances like ASA 8

This commit is contained in:
Julien Duponchelle 2017-03-09 15:44:48 +01:00
parent 21849656d1
commit 99ee40df3d
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
3 changed files with 8 additions and 1 deletions

View File

@ -67,7 +67,8 @@ class Controller:
for file in os.listdir(get_resource('appliances')):
with open(os.path.join(get_resource('appliances'), file)) as f:
appliance = ApplianceTemplate(None, json.load(f))
self._appliance_templates[appliance.id] = appliance
if appliance.status != 'broken':
self._appliance_templates[appliance.id] = appliance
@asyncio.coroutine
def start(self):

View File

@ -31,6 +31,10 @@ class ApplianceTemplate:
def id(self):
return self._id
@property
def status(self):
return self._data["status"]
def __json__(self):
"""
Appliance data (a hash)

View File

@ -451,6 +451,8 @@ def test_get_free_project_name(controller, async_run):
def test_appliance_templates(controller):
assert len(controller.appliance_templates) > 0
for appliance in controller.appliance_templates.values():
assert appliance.__json__()["status"] != "broken"
def test_load_base_files(controller, config, tmpdir):