Renamed ImageDeployment back to ImageDeployments
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index 747062c..5590144 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -469,8 +469,8 @@
fields = ['backend_status_icon', 'network']
readonly_fields = ('backend_status_icon', )
-class ImageDeploymentInline(PlStackTabularInline):
- model = ImageDeployment
+class ImageDeploymentsInline(PlStackTabularInline):
+ model = ImageDeployments
extra = 0
verbose_name = "Image Deployments"
verbose_name_plural = "Image Deployments"
@@ -575,7 +575,7 @@
# a better way...
self.manipulate_m2m_objs(deployment, self.cleaned_data['sites'], deployment.sitedeployments.all(), SiteDeployments, "deployment", "site")
- self.manipulate_m2m_objs(deployment, self.cleaned_data['images'], deployment.imagedeployments.all(), ImageDeployment, "deployment", "image")
+ self.manipulate_m2m_objs(deployment, self.cleaned_data['images'], deployment.imagedeployments.all(), ImageDeployments, "deployment", "image")
self.save_m2m()
@@ -594,7 +594,7 @@
model = Deployment
fieldList = ['backend_status_text', 'name', 'availability_zone', 'sites', 'images', 'flavors', 'accessControl']
fieldsets = [(None, {'fields': fieldList, 'classes':['suit-tab suit-tab-sites']})]
- inlines = [DeploymentPrivilegeInline,NodeInline,TagInline] # ,ImageDeploymentInline]
+ inlines = [DeploymentPrivilegeInline,NodeInline,TagInline] # ,ImageDeploymentsInline]
list_display = ['backend_status_icon', 'name']
list_display_links = ('backend_status_icon', 'name', )
readonly_fields = ('backend_status_text', )
@@ -906,7 +906,7 @@
suit_form_tabs =(('general','Image Details'),('slivers','Slivers'),('imagedeployments','Deployments'))
- inlines = [SliverInline, ImageDeploymentInline]
+ inlines = [SliverInline, ImageDeploymentsInline]
user_readonly_fields = ['name', 'disk_format', 'container_format']
diff --git a/planetstack/core/migrations/0001_initial.py b/planetstack/core/migrations/0001_initial.py
index 8523936..3ce8e6e 100644
--- a/planetstack/core/migrations/0001_initial.py
+++ b/planetstack/core/migrations/0001_initial.py
@@ -213,7 +213,7 @@
bases=(models.Model,),
),
migrations.CreateModel(
- name='ImageDeployments',
+ name='ImageDeploymentss',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('created', models.DateTimeField(default=django.utils.timezone.now, auto_now_add=True)),
diff --git a/planetstack/core/models/__init__.py b/planetstack/core/models/__init__.py
index 76c9590..b539bb8 100644
--- a/planetstack/core/models/__init__.py
+++ b/planetstack/core/models/__init__.py
@@ -13,7 +13,7 @@
from .slice import Slice, SliceDeployments
from .site import SitePrivilege, SiteDeployments
from .userdeployments import UserDeployment
-from .image import Image, ImageDeployment
+from .image import Image, ImageDeployments
from .node import Node
from .serviceresource import ServiceResource
from .slice import SliceRole
diff --git a/planetstack/core/models/image.py b/planetstack/core/models/image.py
index 1bca1b9..fdeb2cc 100644
--- a/planetstack/core/models/image.py
+++ b/planetstack/core/models/image.py
@@ -14,7 +14,7 @@
def __unicode__(self): return u'%s' % (self.name)
-class ImageDeployment(PlCoreBase):
+class ImageDeployments(PlCoreBase):
objects = DeploymentLinkManager()
deleted_objects = DeploymentLinkDeletionManager()
image = models.ForeignKey(Image,related_name='imagedeployments')
diff --git a/planetstack/genapi.py b/planetstack/genapi.py
index bac66d8..c14f72b 100644
--- a/planetstack/genapi.py
+++ b/planetstack/genapi.py
@@ -196,9 +196,9 @@
url(r'plstackapi/deploymentprivileges/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentPrivilegeDetail.as_view(), name ='deploymentprivilege-detail'),
# url(r'plstackapi/deploymentprivileges/!new/$', DeploymentPrivilegeNew.as_view(), name ='deploymentprivilege-new'),
- url(r'plstackapi/imagedeployments/$', ImageDeploymentList.as_view(), name='imagedeployment-list'),
- url(r'plstackapi/imagedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDeploymentDetail.as_view(), name ='imagedeployment-detail'),
-# url(r'plstackapi/imagedeployments/!new/$', ImageDeploymentNew.as_view(), name ='imagedeployment-new'),
+ url(r'plstackapi/imagedeployments/$', ImageDeploymentsList.as_view(), name='imagedeployment-list'),
+ url(r'plstackapi/imagedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDeploymentsDetail.as_view(), name ='imagedeployment-detail'),
+# url(r'plstackapi/imagedeployments/!new/$', ImageDeploymentsNew.as_view(), name ='imagedeployment-new'),
url(r'plstackapi/deploymentroles/$', DeploymentRoleList.as_view(), name='deploymentrole-list'),
url(r'plstackapi/deploymentroles/(?P<pk>[a-zA-Z0-9\-]+)/$', DeploymentRoleDetail.as_view(), name ='deploymentrole-detail'),
@@ -1111,18 +1111,18 @@
-class ImageDeploymentSerializer(serializers.HyperlinkedModelSerializer):
+class ImageDeploymentsSerializer(serializers.HyperlinkedModelSerializer):
id = serializers.Field()
class Meta:
- model = ImageDeployment
+ model = ImageDeployments
fields = ('id','created','updated','enacted','backend_status','deleted','image','deployment','glance_image_id',)
-class ImageDeploymentIdSerializer(serializers.ModelSerializer):
+class ImageDeploymentsIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
class Meta:
- model = ImageDeployment
+ model = ImageDeployments
fields = ('id','created','updated','enacted','backend_status','deleted','image','deployment','glance_image_id',)
@@ -1316,7 +1316,7 @@
DeploymentPrivilege: DeploymentPrivilegeSerializer,
- ImageDeployment: ImageDeploymentSerializer,
+ ImageDeployments: ImageDeploymentsSerializer,
DeploymentRole: DeploymentRoleSerializer,
@@ -4783,10 +4783,10 @@
-class ImageDeploymentList(generics.ListCreateAPIView):
- queryset = ImageDeployment.objects.select_related().all()
- serializer_class = ImageDeploymentSerializer
- id_serializer_class = ImageDeploymentIdSerializer
+class ImageDeploymentsList(generics.ListCreateAPIView):
+ queryset = ImageDeployments.objects.select_related().all()
+ serializer_class = ImageDeploymentsSerializer
+ id_serializer_class = ImageDeploymentsIdSerializer
filter_backends = (filters.DjangoFilterBackend,)
filter_fields = ('id','created','updated','enacted','backend_status','deleted','image','deployment','glance_image_id',)
@@ -4798,7 +4798,7 @@
return self.serializer_class
def get_queryset(self):
- return ImageDeployment.select_by_user(self.request.user)
+ return ImageDeployments.select_by_user(self.request.user)
def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.DATA, files=request.FILES)
@@ -4807,21 +4807,21 @@
obj = serializer.object
obj.caller = request.user
if obj.can_update(request.user):
- return super(ImageDeploymentList, self).create(request, *args, **kwargs)
+ return super(ImageDeploymentsList, self).create(request, *args, **kwargs)
else:
raise Exception("failed obj.can_update")
- ret = super(ImageDeploymentList, self).create(request, *args, **kwargs)
+ ret = super(ImageDeploymentsList, self).create(request, *args, **kwargs)
if (ret.status_code%100 != 200):
raise Exception(ret.data)
return ret
-class ImageDeploymentDetail(PlanetStackRetrieveUpdateDestroyAPIView):
- queryset = ImageDeployment.objects.select_related().all()
- serializer_class = ImageDeploymentSerializer
- id_serializer_class = ImageDeploymentIdSerializer
+class ImageDeploymentsDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+ queryset = ImageDeployments.objects.select_related().all()
+ serializer_class = ImageDeploymentsSerializer
+ id_serializer_class = ImageDeploymentsIdSerializer
def get_serializer_class(self):
no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -4831,7 +4831,7 @@
return self.serializer_class
def get_queryset(self):
- return ImageDeployment.select_by_user(self.request.user)
+ return ImageDeployments.select_by_user(self.request.user)
# update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
@@ -4842,9 +4842,9 @@
filled with defaults. I solved it another way, so this code may soon be
abandoned.
-class ImageDeploymentNew(GenericAPIView):
- serializer_class = ImageDeploymentSerializer
- id_serializer_class = ImageDeploymentIdSerializer
+class ImageDeploymentsNew(GenericAPIView):
+ serializer_class = ImageDeploymentsSerializer
+ id_serializer_class = ImageDeploymentsIdSerializer
def get(self, request, *args, **kwargs):
return self.makenew(request, *args, **kwargs)
@@ -4857,7 +4857,7 @@
return self.serializer_class
def makenew(self, request, *args, **kwargs):
- obj = ImageDeployment()
+ obj = ImageDeployments()
serializer = self.get_serializer(obj)
return Response(serializer.data)
"""
diff --git a/planetstack/openstack_observer/steps/__init__.py b/planetstack/openstack_observer/steps/__init__.py
index 74f38b7..0151af3 100644
--- a/planetstack/openstack_observer/steps/__init__.py
+++ b/planetstack/openstack_observer/steps/__init__.py
@@ -12,5 +12,5 @@
#from .sync_roles import SyncRoles
#from .sync_nodes import SyncNodes
#from .sync_images import SyncImages
-#from .sync_image_deployments import SyncImageDeployment
+#from .sync_image_deployments import SyncImageDeployments
#from .garbage_collector import GarbageCollector
diff --git a/planetstack/openstack_observer/steps/sync_image_deployments.py b/planetstack/openstack_observer/steps/sync_image_deployments.py
index 4bdad87..20c22a2 100644
--- a/planetstack/openstack_observer/steps/sync_image_deployments.py
+++ b/planetstack/openstack_observer/steps/sync_image_deployments.py
@@ -5,24 +5,24 @@
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models import Deployment
-from core.models import Image, ImageDeployment
+from core.models import Image, ImageDeployments
from util.logger import Logger, logging
logger = Logger(level=logging.INFO)
-class SyncImageDeployment(OpenStackSyncStep):
- provides=[ImageDeployment]
+class SyncImageDeployments(OpenStackSyncStep):
+ provides=[ImageDeployments]
requested_interval=0
def fetch_pending(self, deleted):
if (deleted):
return []
- # smbaker: commented out automatic creation of ImageDeployment as
+ # smbaker: commented out automatic creation of ImageDeployments as
# as they will now be configured in GUI. Not sure if this is
# sufficient.
# # ensure images are available across all deployments
-# image_deployments = ImageDeployment.objects.all()
+# image_deployments = ImageDeployments.objects.all()
# image_deploy_lookup = defaultdict(list)
# for image_deployment in image_deployments:
# image_deploy_lookup[image_deployment.image].append(image_deployment.deployment)
@@ -33,11 +33,11 @@
# for expected_deployment in expected_deployments:
# if image not in image_deploy_lookup or \
# expected_deployment not in image_deploy_lookup[image]:
-# id = ImageDeployment(image=image, deployment=expected_deployment)
+# id = ImageDeployments(image=image, deployment=expected_deployment)
# id.save()
# now we return all images that need to be enacted
- return ImageDeployment.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+ return ImageDeployments.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
def sync_record(self, image_deployment):
logger.info("Working on image %s on deployment %s" % (image_deployment.image.name, image_deployment.deployment.name))