Merge branch 'master' of ssh://git.planet-lab.org/git/plstackapi
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index 0e38d43..c173cb1 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -432,14 +432,22 @@
suit_classes = 'suit-tab suit-tab-slicenetworks'
fields = ['network']
+class ImageDeploymentsROInline(ReadOnlyTabularInline):
+ model = ImageDeployments
+ extra = 0
+ verbose_name = "Image Deployments"
+ verbose_name_plural = "Image Deployments"
+ suit_classes = 'suit-tab suit-tab-imagedeployments'
+ fields = ['image', 'deployment', 'glance_image_id']
+
class ImageDeploymentsInline(PlStackTabularInline):
model = ImageDeployments
extra = 0
verbose_name = "Image Deployments"
verbose_name_plural = "Image Deployments"
suit_classes = 'suit-tab suit-tab-imagedeployments'
- fields = ['deployment', 'glance_image_id']
- readonly_fields = ['deployment', 'glance_image_id']
+ fields = ['image', 'deployment', 'glance_image_id']
+ readonly_fields = ['glance_image_id']
class PlainTextWidget(forms.HiddenInput):
input_type = 'hidden'
@@ -539,12 +547,12 @@
model = Deployment
fieldList = ['name','sites', 'accessControl']
fieldsets = [(None, {'fields': fieldList, 'classes':['suit-tab suit-tab-sites']})]
- inlines = [DeploymentPrivilegeInline,NodeInline,TagInline]
+ inlines = [DeploymentPrivilegeInline,NodeInline,TagInline,ImageDeploymentsInline]
- user_readonly_inlines = [DeploymentPrivilegeROInline,NodeROInline,TagROInline]
+ user_readonly_inlines = [DeploymentPrivilegeROInline,NodeROInline,TagROInline,ImageDeploymentsROInline]
user_readonly_fields = ['name']
- suit_form_tabs =(('sites','Deployment Details'),('nodes','Nodes'),('deploymentprivileges','Privileges'),('tags','Tags'))
+ suit_form_tabs =(('sites','Deployment Details'),('nodes','Nodes'),('deploymentprivileges','Privileges'),('tags','Tags'),('imagedeployments','Images'))
def get_form(self, request, obj=None, **kwargs):
if request.user.isReadOnlyUser():
@@ -789,9 +797,9 @@
suit_form_tabs =(('general','Image Details'),('slivers','Slivers'),('imagedeployments','Deployments'))
inlines = [SliverInline, ImageDeploymentsInline]
-
+
user_readonly_fields = ['name', 'disk_format', 'container_format']
- user_readonly_inlines = [SliverROInline]
+ user_readonly_inlines = [SliverROInline, ImageDeploymentsROInline]
class NodeForm(forms.ModelForm):
class Meta:
diff --git a/planetstack/observer/steps/sync_image_deployments.py b/planetstack/observer/steps/sync_image_deployments.py
index 52aaeef..3957e74 100644
--- a/planetstack/observer/steps/sync_image_deployments.py
+++ b/planetstack/observer/steps/sync_image_deployments.py
@@ -15,20 +15,24 @@
requested_interval=0
def fetch_pending(self):
- # ensure images are available across all deployments
- 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)
+ # smbaker: commented out automatic creation of ImageDeployments as
+ # as they will now be configured in GUI. Not sure if this is
+ # sufficient.
- all_deployments = Deployment.objects.all()
- for image in Image.objects.all():
- expected_deployments = all_deployments
- 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.save()
+# # ensure images are available across all deployments
+# 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)
+#
+# all_deployments = Deployment.objects.all()
+# for image in Image.objects.all():
+# expected_deployments = all_deployments
+# 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.save()
# now we return all images that need to be enacted
return ImageDeployments.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))