better error message for tenant view sanity check
diff --git a/planetstack/core/xoslib/methods/tenantview.py b/planetstack/core/xoslib/methods/tenantview.py
index 5694374..77adf57 100644
--- a/planetstack/core/xoslib/methods/tenantview.py
+++ b/planetstack/core/xoslib/methods/tenantview.py
@@ -15,6 +15,11 @@
BLESSED_DEPLOYMENTS = ["ViCCI"] # ["US-MaxPlanck", "US-GeorgiaTech", "US-Princeton", "US-Washington", "US-Stanford"]
def getTenantViewDict(user):
+ blessed_deployments = []
+ for deployment in Deployment.objects.all():
+ if deployment.name in BLESSED_DEPLOYMENTS:
+ blessed_deployments.append(deployment)
+
blessed_sites = []
for site in Site.objects.all():
good=False
@@ -70,6 +75,7 @@
return {"id": 0,
"blessed_deployment_names": BLESSED_DEPLOYMENTS,
+ "blessed_deployments": [deployment.id for deployment in blessed_deployments],
"blessed_site_names": [site.name for site in blessed_sites],
"blessed_sites": [site.id for site in blessed_sites],
"blessed_image_names": [image.name for image in blessed_images],
diff --git a/planetstack/core/xoslib/static/js/xosTenant.js b/planetstack/core/xoslib/static/js/xosTenant.js
index 4225cac..cd2b079 100644
--- a/planetstack/core/xoslib/static/js/xosTenant.js
+++ b/planetstack/core/xoslib/static/js/xosTenant.js
@@ -395,6 +395,9 @@
XOSTenantApp.sanityCheck = function() {
errors = [];
+ if (xos.tenant().blessed_deployments && xos.tenant().blessed_deployments.length == 0) {
+ errors.push("no blessed deployments");
+ }
if (xos.tenant().blessed_service_classes.length == 0) {
errors.push("no blessed service classes");
}
@@ -412,7 +415,10 @@
}
if (errors.length > 0) {
- $("#tenantSummary").html("Tenant view sanity check failed<br>" + errors.join("<br>"));
+ $("#tenantSummary").html("Tenant view sanity check failed: <blockquote>" + errors.join("<br>") + "</blockquote>" +
+ "Usually errors in the Tenant view imply that nodes, sites, or " +
+ "images need to be added to a Deployment. The Deployment(s) that " +
+ "the tenant view is hardcoded to use are " + xos.tenant().blessed_deployment_names.join(",") + ".");
return false;
}