Refactor to /opt/planetstack, final tweaks to make sure planetstack can run in non-openstack mode, adjustments to GUI for model focus changes
diff --git a/planetstack/openstack/siteagent.py b/planetstack/openstack/siteagent.py
new file mode 100644
index 0000000..a57fa0b
--- /dev/null
+++ b/planetstack/openstack/siteagent.py
@@ -0,0 +1,22 @@
+import os
+import sys
+#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "planetstack.settings")
+import time
+from core.models.site import Site
+from openstack.manager import OpenStackManager
+
+class SiteAgent:
+ def run(self):
+ manager = OpenStackManager()
+ # exit if openstack is disable or unavailable
+ if manager.enabled and manager.has_openstack:
+ # fill in null tenant ids
+ sites = Site.objects.filter(tenant_id__in=[None, ''])
+ for site in sites:
+ # calling save() on the model should force the tenant_id to be set
+ site.os_manager = manager
+ site.save()
+
+if __name__ == '__main__':
+ SiteAgent().run()
+