Merge branch 'master' of ssh://git.planet-lab.org/git/plstackapi
diff --git a/planetstack/ec2_observer/__init__.pyc b/planetstack/ec2_observer/__init__.pyc
index c43a857..0be477a 100644
--- a/planetstack/ec2_observer/__init__.pyc
+++ b/planetstack/ec2_observer/__init__.pyc
Binary files differ
diff --git a/planetstack/ec2_observer/event_manager.pyc b/planetstack/ec2_observer/event_manager.pyc
index d514197..a916928 100644
--- a/planetstack/ec2_observer/event_manager.pyc
+++ b/planetstack/ec2_observer/event_manager.pyc
Binary files differ
diff --git a/planetstack/model_policies/__init__.py b/planetstack/model_policies/__init__.py
index e69de29..8671d6a 100644
--- a/planetstack/model_policies/__init__.py
+++ b/planetstack/model_policies/__init__.py
@@ -0,0 +1,3 @@
+from .model_policy_Slice import *
+from .model_policy_User import *
+from .model_policy_Network import *
diff --git a/planetstack/model_policies/model_policy_Network.py b/planetstack/model_policies/model_policy_Network.py
index 0511bee..f48b25a 100644
--- a/planetstack/model_policies/model_policy_Network.py
+++ b/planetstack/model_policies/model_policy_Network.py
@@ -1,6 +1,8 @@
from core.models import *
def handle(network):
+ from core.models import SliceDeployments,NetworkDeployments
+ from collections import defaultdict
# network deployments are not visible to users. We must ensure
# networks are deployed at all deploymets available to their slices.
slice_deployments = SliceDeployments.objects.all()
diff --git a/planetstack/model_policies/model_policy_Slice.py b/planetstack/model_policies/model_policy_Slice.py
index 5d66903..6fd968c 100644
--- a/planetstack/model_policies/model_policy_Slice.py
+++ b/planetstack/model_policies/model_policy_Slice.py
@@ -1,6 +1,7 @@
-from core.models import *
def handle(slice):
+ from core.models import SiteDeployments,SliceDeployments,Deployment
+ from collections import defaultdict
site_deployments = SiteDeployments.objects.all()
site_deploy_lookup = defaultdict(list)
for site_deployment in site_deployments:
diff --git a/planetstack/model_policies/model_policy_User.py b/planetstack/model_policies/model_policy_User.py
index 1b1895e..6118a7b 100644
--- a/planetstack/model_policies/model_policy_User.py
+++ b/planetstack/model_policies/model_policy_User.py
@@ -1,6 +1,8 @@
from core.models import *
def handle(user):
+ from core.models import Deployment,SiteDeployments,UserDeployments
+ from collections import defaultdict
deployments = Deployment.objects.all()
site_deployments = SiteDeployments.objects.all()
site_deploy_lookup = defaultdict(list)
diff --git a/planetstack/model_policy.py b/planetstack/model_policy.py
index 38caf01..fa55817 100644
--- a/planetstack/model_policy.py
+++ b/planetstack/model_policy.py
@@ -1,14 +1,15 @@
from django.db.models.signals import post_save
from django.dispatch import receiver
import pdb
-from model_policies import *
+from core.models import *
+import model_policies
@receiver(post_save)
def post_save_handler(sender, **kwargs):
sender_name = sender.__name__
policy_name = 'model_policy_%s'%sender_name
try:
- policy_handler = globals[policy_name]
- policy_handler(sender)
+ policy_handler = getattr(model_policies, policy_name)
+ policy_handler.handle(sender)
except:
pass