Renamed ImageDeployments->ImageDeployment
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index b26194a..cd0e5dd 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -455,8 +455,8 @@
fields = ['backend_status_icon', 'network']
readonly_fields = ('backend_status_icon', )
-class ImageDeploymentsInline(PlStackTabularInline):
- model = ImageDeployments
+class ImageDeploymentInline(PlStackTabularInline):
+ model = ImageDeployment
extra = 0
verbose_name = "Image Deployments"
verbose_name_plural = "Image Deployments"
@@ -561,7 +561,7 @@
# a better way...
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.manipulate_m2m_objs(deployment, self.cleaned_data['images'], deployment.imagedeployments_set.all(), ImageDeployment, "deployment", "image")
self.save_m2m()
@@ -580,7 +580,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] # ,ImageDeploymentsInline]
+ inlines = [DeploymentPrivilegeInline,NodeInline,TagInline] # ,ImageDeploymentInline]
list_display = ['backend_status_icon', 'name']
list_display_links = ('backend_status_icon', 'name', )
readonly_fields = ('backend_status_text', )
@@ -892,7 +892,7 @@
suit_form_tabs =(('general','Image Details'),('slivers','Slivers'),('imagedeployments','Deployments'))
- inlines = [SliverInline, ImageDeploymentsInline]
+ inlines = [SliverInline, ImageDeploymentInline]
user_readonly_fields = ['name', 'disk_format', 'container_format']
diff --git a/planetstack/core/models/__init__.py b/planetstack/core/models/__init__.py
index b1175f1..821939e 100644
--- a/planetstack/core/models/__init__.py
+++ b/planetstack/core/models/__init__.py
@@ -13,7 +13,7 @@
from .slice import Slice, SliceDeployment
from .site import SitePrivilege, SiteDeployment
from .userdeployments import UserDeployment
-from .image import Image, ImageDeployments
+from .image import Image, ImageDeployment
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 fdeb2cc..1bca1b9 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 ImageDeployments(PlCoreBase):
+class ImageDeployment(PlCoreBase):
objects = DeploymentLinkManager()
deleted_objects = DeploymentLinkDeletionManager()
image = models.ForeignKey(Image,related_name='imagedeployments')
diff --git a/planetstack/genapi.py b/planetstack/genapi.py
index dcc35a1..b368a9a 100644
--- a/planetstack/genapi.py
+++ b/planetstack/genapi.py
@@ -105,8 +105,8 @@
url(r'plstackapi/dashboardviews/$', DashboardViewList.as_view(), name='dashboardview-list'),
url(r'plstackapi/dashboardviews/(?P<pk>[a-zA-Z0-9\-]+)/$', DashboardViewDetail.as_view(), name ='dashboardview-detail'),
- url(r'plstackapi/imagedeployments/$', ImageDeploymentsList.as_view(), name='imagedeployments-list'),
- url(r'plstackapi/imagedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDeploymentsDetail.as_view(), name ='imagedeployments-detail'),
+ url(r'plstackapi/imagedeployments/$', ImageDeploymentList.as_view(), name='imagedeployments-list'),
+ url(r'plstackapi/imagedeployments/(?P<pk>[a-zA-Z0-9\-]+)/$', ImageDeploymentDetail.as_view(), name ='imagedeployments-detail'),
url(r'plstackapi/reservedresources/$', ReservedResourceList.as_view(), name='reservedresource-list'),
url(r'plstackapi/reservedresources/(?P<pk>[a-zA-Z0-9\-]+)/$', ReservedResourceDetail.as_view(), name ='reservedresource-detail'),
@@ -757,18 +757,18 @@
-class ImageDeploymentsSerializer(serializers.HyperlinkedModelSerializer):
+class ImageDeploymentSerializer(serializers.HyperlinkedModelSerializer):
id = serializers.Field()
class Meta:
- model = ImageDeployments
+ model = ImageDeployment
fields = ('id','created','updated','enacted','backend_status','deleted','image','deployment','glance_image_id',)
-class ImageDeploymentsIdSerializer(serializers.ModelSerializer):
+class ImageDeploymentIdSerializer(serializers.ModelSerializer):
id = serializers.Field()
class Meta:
- model = ImageDeployments
+ model = ImageDeployment
fields = ('id','created','updated','enacted','backend_status','deleted','image','deployment','glance_image_id',)
@@ -1234,7 +1234,7 @@
DashboardView: DashboardViewSerializer,
- ImageDeployments: ImageDeploymentsSerializer,
+ ImageDeployment: ImageDeploymentSerializer,
ReservedResource: ReservedResourceSerializer,
@@ -2709,10 +2709,10 @@
-class ImageDeploymentsList(generics.ListCreateAPIView):
- queryset = ImageDeployments.objects.select_related().all()
- serializer_class = ImageDeploymentsSerializer
- id_serializer_class = ImageDeploymentsIdSerializer
+class ImageDeploymentList(generics.ListCreateAPIView):
+ queryset = ImageDeployment.objects.select_related().all()
+ serializer_class = ImageDeploymentSerializer
+ id_serializer_class = ImageDeploymentIdSerializer
filter_backends = (filters.DjangoFilterBackend,)
filter_fields = ('id','created','updated','enacted','backend_status','deleted','image','deployment','glance_image_id',)
@@ -2724,27 +2724,27 @@
return self.serializer_class
def get_queryset(self):
- return ImageDeployments.select_by_user(self.request.user)
+ return ImageDeployment.select_by_user(self.request.user)
def create(self, request, *args, **kwargs):
- obj = ImageDeployments(**request.DATA)
+ obj = ImageDeployment(**request.DATA)
obj.caller = request.user
if obj.can_update(request.user):
- return super(ImageDeploymentsList, self).create(request, *args, **kwargs)
+ return super(ImageDeploymentList, self).create(request, *args, **kwargs)
else:
raise Exception("failed obj.can_update")
- ret = super(ImageDeploymentsList, self).create(request, *args, **kwargs)
+ ret = super(ImageDeploymentList, self).create(request, *args, **kwargs)
if (ret.status_code%100 != 200):
raise Exception(ret.data)
return ret
-class ImageDeploymentsDetail(PlanetStackRetrieveUpdateDestroyAPIView):
- queryset = ImageDeployments.objects.select_related().all()
- serializer_class = ImageDeploymentsSerializer
- id_serializer_class = ImageDeploymentsIdSerializer
+class ImageDeploymentDetail(PlanetStackRetrieveUpdateDestroyAPIView):
+ queryset = ImageDeployment.objects.select_related().all()
+ serializer_class = ImageDeploymentSerializer
+ id_serializer_class = ImageDeploymentIdSerializer
def get_serializer_class(self):
no_hyperlinks = self.request.QUERY_PARAMS.get('no_hyperlinks', False)
@@ -2754,7 +2754,7 @@
return self.serializer_class
def get_queryset(self):
- return ImageDeployments.select_by_user(self.request.user)
+ return ImageDeployment.select_by_user(self.request.user)
# update() is handled by PlanetStackRetrieveUpdateDestroyAPIView
diff --git a/planetstack/openstack_observer/steps/__init__.py b/planetstack/openstack_observer/steps/__init__.py
index 0151af3..74f38b7 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 SyncImageDeployments
+#from .sync_image_deployments import SyncImageDeployment
#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 20c22a2..4bdad87 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, ImageDeployments
+from core.models import Image, ImageDeployment
from util.logger import Logger, logging
logger = Logger(level=logging.INFO)
-class SyncImageDeployments(OpenStackSyncStep):
- provides=[ImageDeployments]
+class SyncImageDeployment(OpenStackSyncStep):
+ provides=[ImageDeployment]
requested_interval=0
def fetch_pending(self, deleted):
if (deleted):
return []
- # smbaker: commented out automatic creation of ImageDeployments as
+ # smbaker: commented out automatic creation of ImageDeployment as
# as they will now be configured in GUI. Not sure if this is
# sufficient.
# # ensure images are available across all deployments
-# image_deployments = ImageDeployments.objects.all()
+# image_deployments = ImageDeployment.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 = ImageDeployments(image=image, deployment=expected_deployment)
+# id = ImageDeployment(image=image, deployment=expected_deployment)
# id.save()
# now we return all images that need to be enacted
- return ImageDeployments.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+ return ImageDeployment.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))