Tony Mack | bd3b26e | 2013-04-30 17:43:48 -0400 | [diff] [blame^] | 1 | import os |
| 2 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "plstackapi.planetstack.settings") |
| 3 | import time |
| 4 | from plstackapi.core.models.site import Site |
| 5 | from plstackapi.openstack.driver import OpenStackDriver |
| 6 | |
| 7 | class SiteAgent: |
| 8 | def run(self): |
| 9 | driver = OpenStackDriver() |
| 10 | # fill in null tenant ids |
| 11 | sites = Site.objects.filter(tenant_id=None) |
| 12 | for site in sites: |
| 13 | # calling save() on the model should force the tenant_id to be set |
| 14 | site.driver = driver |
| 15 | site.save() |
| 16 | |
| 17 | if __name__ == '__main__': |
| 18 | SiteAgent().run() |
| 19 | |