(fix) Support non-present networks

- Drydock should support defined networks that MAAS cannot
  see. This fixes an issue that caused this use-case to fail
  by ensuring that the MAAS client models with no internal
  resource IDs work.

Change-Id: I1a20d4730e94eee7268ff0cc3451e4b459a1e62b
This commit is contained in:
Scott Hussey 2019-02-19 11:26:08 -06:00
parent 8f7c91fb9d
commit 7504c2f907
2 changed files with 2 additions and 2 deletions

View File

@ -26,7 +26,7 @@ class Fabric(model_base.ResourceBase):
def __init__(self, api_client, **kwargs):
super(Fabric, self).__init__(api_client, **kwargs)
if hasattr(self, 'resource_id'):
if getattr(self, 'resource_id', None):
self.refresh_vlans()
def refresh(self):

View File

@ -46,7 +46,7 @@ class Machine(model_base.ResourceBase):
super(Machine, self).__init__(api_client, **kwargs)
# Replace generic dicts with interface collection model
if hasattr(self, 'resource_id'):
if getattr(self, 'resource_id', None):
self.interfaces = maas_interface.Interfaces(
api_client, system_id=self.resource_id)
self.interfaces.refresh()