Renamed SiteDeployments->SiteDeployment
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index a84b8bc..1ef4106 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -409,7 +409,7 @@
return SitePrivilege.select_by_user(request.user)
class SiteDeploymentInline(PlStackTabularInline):
- model = SiteDeployments
+ model = SiteDeployment
extra = 0
suit_classes = 'suit-tab suit-tab-deployments'
fields = ['backend_status_icon', 'deployment','site']
@@ -424,7 +424,7 @@
return super(SiteDeploymentInline, self).formfield_for_foreignkey(db_field, request, **kwargs)
def queryset(self, request):
- return SiteDeployments.select_by_user(request.user)
+ return SiteDeployment.select_by_user(request.user)
class SlicePrivilegeInline(PlStackTabularInline):
@@ -560,7 +560,7 @@
# create/destroy the through models ourselves. There has to be
# a better way...
- self.manipulate_m2m_objs(deployment, self.cleaned_data['sites'], deployment.sitedeployments_set.all(), SiteDeployments, "deployment", "site")
+ self.manipulate_m2m_objs(deployment, self.cleaned_data['sites'], deployment.sitedeployments_set.all(), SiteDeployment, "deployment", "site")
self.manipulate_m2m_objs(deployment, self.cleaned_data['images'], deployment.imagedeployments_set.all(), ImageDeployments, "deployment", "image")
self.save_m2m()
diff --git a/planetstack/core/models/site.py b/planetstack/core/models/site.py
index 53c36ab..9ef48c2 100644
--- a/planetstack/core/models/site.py
+++ b/planetstack/core/models/site.py
@@ -105,7 +105,7 @@
abbreviated_name = models.CharField(max_length=80)
#deployments = models.ManyToManyField('Deployment', blank=True, related_name='sites')
- deployments = models.ManyToManyField('Deployment', through='SiteDeployments', blank=True, help_text="Select which sites are allowed to host nodes in this deployment", related_name='sites')
+ deployments = models.ManyToManyField('Deployment', through='SiteDeployment', blank=True, help_text="Select which sites are allowed to host nodes in this deployment", related_name='sites')
tags = generic.GenericRelation(Tag)
def __unicode__(self): return u'%s' % (self.name)
diff --git a/planetstack/ec2_observer/deleters/site_deleter.py b/planetstack/ec2_observer/deleters/site_deleter.py
index c97dee1..88a4008 100644
--- a/planetstack/ec2_observer/deleters/site_deleter.py
+++ b/planetstack/ec2_observer/deleters/site_deleter.py
@@ -1,4 +1,4 @@
-from core.models import Site, SiteDeployments
+from core.models import Site, SiteDeployment
from observer.deleter import Deleter
from observer.deleters.site_deployment_deleter import SiteDeploymentDeleter
@@ -7,7 +7,7 @@
def call(self, pk):
site = Site.objects.get(pk=pk)
- site_deployments = SiteDeployments.objects.filter(site=site)
+ site_deployments = SiteDeployment.objects.filter(site=site)
site_deployment_deleter = SiteDeploymentDeleter()
for site_deployment in site_deployments:
site_deployment_deleter(site_deployment.id)
diff --git a/planetstack/ec2_observer/deleters/site_deployment_deleter.py b/planetstack/ec2_observer/deleters/site_deployment_deleter.py
index fa97be2..db344cd 100644
--- a/planetstack/ec2_observer/deleters/site_deployment_deleter.py
+++ b/planetstack/ec2_observer/deleters/site_deployment_deleter.py
@@ -1,11 +1,11 @@
-from core.models import Site, SiteDeployments
+from core.models import Site, SiteDeployment
from observer.deleter import Deleter
class SiteDeploymentDeleter(Deleter):
- model='SiteDeployments'
+ model='SiteDeployment'
def call(self, pk):
- site_deployment = SiteDeployments.objects.get(pk=pk)
+ site_deployment = SiteDeployment.objects.get(pk=pk)
if site_deployment.tenant_id:
driver = self.driver.admin_driver(deployment=site_deployment.deployment.name)
driver.delete_tenant(site_deployment.tenant_id)
diff --git a/planetstack/ec2_observer/steps/sync_nodes.py b/planetstack/ec2_observer/steps/sync_nodes.py
index 9f032ed..0fa8b61 100644
--- a/planetstack/ec2_observer/steps/sync_nodes.py
+++ b/planetstack/ec2_observer/steps/sync_nodes.py
@@ -20,7 +20,7 @@
return []
deployment = Deployment.objects.filter(Q(name="Amazon EC2"))[0]
- current_site_deployments = SiteDeployments.objects.filter(Q(deployment=deployment))
+ current_site_deployments = SiteDeployment.objects.filter(Q(deployment=deployment))
zone_ret = aws_run('ec2 describe-availability-zones')
zones = zone_ret['AvailabilityZones']
diff --git a/planetstack/ec2_observer/steps/sync_site_deployments.py b/planetstack/ec2_observer/steps/sync_site_deployments.py
index 7c24f68..5adccb7 100644
--- a/planetstack/ec2_observer/steps/sync_site_deployments.py
+++ b/planetstack/ec2_observer/steps/sync_site_deployments.py
@@ -7,9 +7,9 @@
from ec2_observer.awslib import *
import pdb
-class SyncSiteDeployments(SyncStep):
+class SyncSiteDeployment(SyncStep):
requested_interval=86400
- provides=[SiteDeployments]
+ provides=[SiteDeployment]
def fetch_pending(self, deletion):
if (deletion):
@@ -29,7 +29,7 @@
# The syncstep should catch it
# At any rate, we should not run if there are no deployments
deployment = Deployment.objects.filter(Q(name="Amazon EC2"))[0]
- current_site_deployments = SiteDeployments.objects.filter(Q(deployment=deployment))
+ current_site_deployments = SiteDeployment.objects.filter(Q(deployment=deployment))
site_dict = {}
for sd in current_site_deployments:
@@ -40,7 +40,7 @@
try:
site_record = site_dict[site]
except KeyError:
- sd = SiteDeployments(site=site,deployment=deployment,tenant_id=base64.urlsafe_b64encode(os.urandom(12)))
+ sd = SiteDeployment(site=site,deployment=deployment,tenant_id=base64.urlsafe_b64encode(os.urandom(12)))
updated_site_deployments.append(sd)
return updated_site_deployments
diff --git a/planetstack/ec2_observer/steps/sync_sites.py b/planetstack/ec2_observer/steps/sync_sites.py
index 0c1c7cf..0959c71 100644
--- a/planetstack/ec2_observer/steps/sync_sites.py
+++ b/planetstack/ec2_observer/steps/sync_sites.py
@@ -16,7 +16,7 @@
return []
deployment = Deployment.objects.filter(Q(name="Amazon EC2"))[0]
- current_site_deployments = SiteDeployments.objects.filter(Q(deployment=deployment))
+ current_site_deployments = SiteDeployment.objects.filter(Q(deployment=deployment))
zone_ret = aws_run('ec2 describe-availability-zones')
zones = zone_ret['AvailabilityZones']
diff --git a/planetstack/ec2_observer/steps/sync_slivers.py b/planetstack/ec2_observer/steps/sync_slivers.py
index 15cd5eb..a7b1dad 100644
--- a/planetstack/ec2_observer/steps/sync_slivers.py
+++ b/planetstack/ec2_observer/steps/sync_slivers.py
@@ -5,7 +5,7 @@
from planetstack.config import Config
from ec2_observer.syncstep import SyncStep
from core.models.sliver import Sliver
-from core.models.slice import SlicePrivilege, SliceDeployments
+from core.models.slice import SlicePrivilege, SliceDeployment
from core.models.network import Network, NetworkSlice, NetworkDeployments
from util.logger import Logger, logging
from ec2_observer.awslib import *
diff --git a/planetstack/genapi.py b/planetstack/genapi.py
index 49317e7..efe42f7 100644
--- a/planetstack/genapi.py
+++ b/planetstack/genapi.py
@@ -159,8 +159,8 @@
url(r'plstackapi/usercredentials/$', UserCredentialList.as_view(), name='usercredential-list'),
url(r'plstackapi/usercredentials/(?P<pk>[a-zA-Z0-9\-]+)/$', UserCredentialDetail.as_view(), name ='usercredential-detail'),
- url(r'plstackapi/sitedeployments/$', SiteDeploymentsList.as_view(), name='sitedeployments-list'),
- url(r'plstackapi/sitedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteDeploymentsDetail.as_view(), name ='sitedeployments-detail'),
+ url(r'plstackapi/sitedeployments/$', SiteDeploymentList.as_view(), name='sitedeployments-list'),
+ url(r'plstackapi/sitedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', SiteDeploymentDetail.as_view(), name ='sitedeployments-detail'),
url(r'plstackapi/slicetags/$', SliceTagList.as_view(), name='slicetag-list'),
url(r'plstackapi/slicetags/(?P<pk>[a-zA-Z0-9\-]+)/$', SliceTagDetail.as_view(), name ='slicetag-detail'),
@@ -1095,18 +1095,18 @@
-class SiteDeploymentsSerializer(serializers.HyperlinkedModelSerializer):
+class SiteDeploymentSerializer(serializers.HyperlinkedModelSerializer):
id = serializers.Field()
class Meta:
- model = SiteDeployments
+ model = SiteDeployment
fields = ('id','created','updated','enacted','backend_status','deleted','site','deployment','tenant_id',)
-class SiteDeploymentsIdSerializer(serializers.ModelSerializer):
+class SiteDeploymentIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
class Meta:
- model = SiteDeployments
+ model = SiteDeployment
fields = ('id','created','updated','enacted','backend_status','deleted','site','deployment','tenant_id',)
@@ -1270,7 +1270,7 @@
UserCredential: UserCredentialSerializer,
- SiteDeployments: SiteDeploymentsSerializer,
+ SiteDeployment: SiteDeploymentSerializer,
SliceTag: SliceTagSerializer,
@@ -3663,10 +3663,10 @@
-class SiteDeploymentsList(generics.ListCreateAPIView):
- queryset = SiteDeployments.objects.select_related().all()
- serializer_class = SiteDeploymentsSerializer
- id_serializer_class = SiteDeploymentsIdSerializer
+class SiteDeploymentList(generics.ListCreateAPIView):
+ queryset = SiteDeployment.objects.select_related().all()
+ serializer_class = SiteDeploymentSerializer
+ id_serializer_class = SiteDeploymentIdSerializer
filter_backends = (filters.DjangoFilterBackend,)
filter_fields = ('id','created','updated','enacted','backend_status','deleted','site','deployment','tenant_id',)
@@ -3678,27 +3678,27 @@
return self.serializer_class
def get_queryset(self):
- return SiteDeployments.select_by_user(self.request.user)
+ return SiteDeployment.select_by_user(self.request.user)
def create(self, request, *args, **kwargs):
- obj = SiteDeployments(**request.DATA)
+ obj = SiteDeployment(**request.DATA)
obj.caller = request.user
if obj.can_update(request.user):
- return super(SiteDeploymentsList, self).create(request, *args, **kwargs)
+ return super(SiteDeploymentList, self).create(request, *args, **kwargs)
else:
raise Exception("failed obj.can_update")
- ret = super(SiteDeploymentsList, self).create(request, *args, **kwargs)
+ ret = super(SiteDeploymentList, self).create(request, *args, **kwargs)
if (ret.status_code%100 != 200):
raise Exception(ret.data)
return ret
-class SiteDeploymentsDetail(PlanetStackRetrieveUpdateDestroyAPIView):
- queryset = SiteDeployments.objects.select_related().all()
- serializer_class = SiteDeploymentsSerializer
- id_serializer_class = SiteDeploymentsIdSerializer
+class SiteDeploymentDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+ queryset = SiteDeployment.objects.select_related().all()
+ serializer_class = SiteDeploymentSerializer
+ id_serializer_class = SiteDeploymentIdSerializer
def get_serializer_class(self):
no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -3708,7 +3708,7 @@
return self.serializer_class
def get_queryset(self):
- return SiteDeployments.select_by_user(self.request.user)
+ return SiteDeployment.select_by_user(self.request.user)
# update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
diff --git a/planetstack/openstack_observer/steps/sync_site_deployments.py b/planetstack/openstack_observer/steps/sync_site_deployments.py
index b5e9f9a..27b8648 100644
--- a/planetstack/openstack_observer/steps/sync_site_deployments.py
+++ b/planetstack/openstack_observer/steps/sync_site_deployments.py
@@ -6,9 +6,9 @@
from core.models.site import *
from observer.ansible import *
-class SyncSiteDeployments(OpenStackSyncStep):
+class SyncSiteDeployment(OpenStackSyncStep):
requested_interval=0
- provides=[SiteDeployments, Site]
+ provides=[SiteDeployment, Site]
def sync_record(self, site_deployment):
diff --git a/planetstack/openstack_observer/steps/sync_site_privileges.py b/planetstack/openstack_observer/steps/sync_site_privileges.py
index d07b279..db2c012 100644
--- a/planetstack/openstack_observer/steps/sync_site_privileges.py
+++ b/planetstack/openstack_observer/steps/sync_site_privileges.py
@@ -3,7 +3,7 @@
from django.db.models import F, Q
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
-from core.models import User, UserDeployments, SitePrivilege, SiteDeployments
+from core.models import User, UserDeployment, SitePrivilege, SiteDeployment
class SyncSitePrivileges(OpenStackSyncStep):
requested_interval=0
diff --git a/planetstack/openstack_observer/steps/sync_sites.py b/planetstack/openstack_observer/steps/sync_sites.py
index c560a6a..4672878 100644
--- a/planetstack/openstack_observer/steps/sync_sites.py
+++ b/planetstack/openstack_observer/steps/sync_sites.py
@@ -14,7 +14,7 @@
site.save()
def delete_record(self, site):
- site_deployments = SiteDeployments.objects.filter(site=site)
- site_deployment_deleter = SyncSiteDeployments().delete_record
+ site_deployments = SiteDeployment.objects.filter(site=site)
+ site_deployment_deleter = SyncSiteDeployment().delete_record
for site_deployment in site_deployments:
site_deployment_deleter(site_deployment)
diff --git a/planetstack/openstack_observer/steps/sync_user_deployments.py b/planetstack/openstack_observer/steps/sync_user_deployments.py
index f7e41a0..6a87cbf 100644
--- a/planetstack/openstack_observer/steps/sync_user_deployments.py
+++ b/planetstack/openstack_observer/steps/sync_user_deployments.py
@@ -39,7 +39,7 @@
roles = []
# setup user deployment home site roles
if user_deployment.user.site:
- site_deployments = SiteDeployments.objects.filter(site=user_deployment.user.site,
+ site_deployments = SiteDeployment.objects.filter(site=user_deployment.user.site,
deployment=user_deployment.deployment)
if site_deployments:
# need the correct tenant id for site at the deployment