From 7504c2f907276ce4cc6e48c74755f3f9a9b4159c Mon Sep 17 00:00:00 2001 From: Scott Hussey Date: Tue, 19 Feb 2019 11:26:08 -0600 Subject: [PATCH] (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 --- .../drivers/node/maasdriver/models/fabric.py | 2 +- .../drivers/node/maasdriver/models/machine.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/drydock_provisioner/drivers/node/maasdriver/models/fabric.py b/python/drydock_provisioner/drivers/node/maasdriver/models/fabric.py index 70dfe5e1..996e62c1 100644 --- a/python/drydock_provisioner/drivers/node/maasdriver/models/fabric.py +++ b/python/drydock_provisioner/drivers/node/maasdriver/models/fabric.py @@ -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): diff --git a/python/drydock_provisioner/drivers/node/maasdriver/models/machine.py b/python/drydock_provisioner/drivers/node/maasdriver/models/machine.py index 4a926667..8350720e 100644 --- a/python/drydock_provisioner/drivers/node/maasdriver/models/machine.py +++ b/python/drydock_provisioner/drivers/node/maasdriver/models/machine.py @@ -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()