Merge pick up, tweaked role/site/plcore_base or os_manager path when OpenStack not present
diff --git a/planetstack/core/models/subnet.py b/planetstack/core/models/subnet.py
index cad9fea..37175ec 100644
--- a/planetstack/core/models/subnet.py
+++ b/planetstack/core/models/subnet.py
@@ -3,6 +3,7 @@
from django.db import models
from core.models import PlCoreBase
from core.models import Slice
+from openstack.manager import OpenStackManager
# Create your models here.
@@ -17,9 +18,13 @@
def __unicode__(self): return u'%s' % (self.slice.name)
def save(self, *args, **kwds):
- self.os_manager.save_subnet(self)
+ if not hasattr(self, 'os_manager'):
+ setattr(self, 'os_manager', OpenStackManager())
+ self.os_manager.save_subnet(self)
super(Subnet, self).save(*args, **kwds)
def delete(self, *args, **kwds):
- self.os_manager.delete_subnet(self)
+ if not hasattr(self, 'os_manager'):
+ setattr(self, 'os_manager', OpenStackManager())
+ self.os_manager.delete_subnet(self)
super(Subnet, self).delete(*args, **kwds)