Scott Baker | 1a5fab3 | 2015-02-06 17:05:17 -0800 | [diff] [blame] | 1 | import os |
| 2 | import sys |
| 3 | sys.path.append("/opt/xos") |
Scott Baker | 86e132c | 2015-02-11 21:38:09 -0800 | [diff] [blame] | 4 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings") |
Scott Baker | 1a5fab3 | 2015-02-06 17:05:17 -0800 | [diff] [blame] | 5 | import django |
| 6 | from core.models import * |
| 7 | django.setup() |
| 8 | |
| 9 | # python ./manage.py sqlflush | python ./manage.py dbshell |
| 10 | |
| 11 | os.system("python /opt/xos/manage.py sqlflush | python /opt/xos/manage.py dbshell") |
| 12 | |
| 13 | ADMIN_USERNAME = "padmin@vicci.org" |
| 14 | ADMIN_PASSWORD = "letmein" |
| 15 | FLAVORS = ["m1.small", "m1.medium", "m1.large"] |
| 16 | SITE_ROLES = ["admin", "pi", "tech"] |
| 17 | SLICE_ROLES = ["admin", "access"] |
| 18 | DEPLOYMENT_ROLES = ["admin"] |
| 19 | |
Scott Baker | 3ed6958 | 2015-02-09 11:20:29 -0800 | [diff] [blame] | 20 | d = Deployment(name="ViCCI") |
Scott Baker | 1a5fab3 | 2015-02-06 17:05:17 -0800 | [diff] [blame] | 21 | d.save() |
| 22 | |
| 23 | s = Site(name="MySite", enabled=True, login_base="mysite", is_public=True, abbreviated_name="mysite") |
| 24 | s.save() |
| 25 | |
| 26 | sd = SiteDeployment(site=s, deployment=d) |
| 27 | sd.save(); |
| 28 | |
| 29 | u = User(email = "padmin@vicci.org", password="letmein", is_admin=True, is_active=True, site=s, firstname="XOS", |
| 30 | lastname="admin") |
| 31 | u.save() |
| 32 | |
| 33 | for flavor_name in FLAVORS: |
| 34 | f = Flavor(name=flavor_name, flavor=flavor_name) |
| 35 | f.save() |
| 36 | f.deployments.add(d) |
| 37 | f.save() |
| 38 | |
| 39 | for site_role_name in SITE_ROLES: |
| 40 | sr = SiteRole(role=site_role_name) |
| 41 | sr.save() |
| 42 | |
| 43 | for slice_role_name in SLICE_ROLES: |
| 44 | sr = SliceRole(role=slice_role_name) |
| 45 | sr.save() |
| 46 | |
| 47 | for deployment_role_name in DEPLOYMENT_ROLES: |
| 48 | dr = DeploymentRole(role=deployment_role_name) |
| 49 | dr.save() |
| 50 | |
| 51 | DashboardView(name="xsh", url="template:xsh", enabled=True).save() |
| 52 | DashboardView(name="Customize", url="template:customize", enabled=True).save() |
| 53 | DashboardView(name="Tenant", url="template:xosTenant", enabled=True).save() |
| 54 | DashboardView(name="Developer", url="template:xosDeveloper_datatables", enabled=True).save() |
| 55 | |
| 56 | ServiceClass(name="Best Effort", description="Best Effort").save() |
| 57 | |