removing ControllerSiteDeployment object. Move tenant_id field to SiteDeployments model
diff --git a/planetstack/core/migrations/0001_initial.py b/planetstack/core/migrations/0001_initial.py
index de0de8a..8e1ec76 100644
--- a/planetstack/core/migrations/0001_initial.py
+++ b/planetstack/core/migrations/0001_initial.py
@@ -211,23 +211,6 @@
             bases=(models.Model,),
         ),
         migrations.CreateModel(
-            name='ControllerSiteDeployments',
-            fields=[
-                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
-                ('created', models.DateTimeField(default=django.utils.timezone.now, auto_now_add=True)),
-                ('updated', models.DateTimeField(default=django.utils.timezone.now, auto_now=True)),
-                ('enacted', models.DateTimeField(default=None, null=True, blank=True)),
-                ('backend_status', models.CharField(default=b'Provisioning in progress', max_length=140)),
-                ('deleted', models.BooleanField(default=False)),
-                ('tenant_id', models.CharField(help_text=b'Keystone tenant id', max_length=200, null=True, blank=True)),
-                ('controller', models.ForeignKey(related_name=b'controllersitedeployments', to='core.Controller')),
-            ],
-            options={
-                'abstract': False,
-            },
-            bases=(models.Model,),
-        ),
-        migrations.CreateModel(
             name='ControllerSlices',
             fields=[
                 ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
@@ -829,6 +812,7 @@
                 ('enacted', models.DateTimeField(default=None, null=True, blank=True)),
                 ('backend_status', models.CharField(default=b'Provisioning in progress', max_length=140)),
                 ('deleted', models.BooleanField(default=False)),
+                ('tenant_id', models.CharField(help_text=b'Keystone tenant id', max_length=200, null=True, blank=True)),
                 ('availability_zone', models.CharField(help_text=b'OpenStack availability zone', max_length=200, null=True, blank=True)),
                 ('controller', models.ForeignKey(related_name=b'sitedeployments', blank=True, to='core.Controller', null=True)),
                 ('deployment', models.ForeignKey(related_name=b'sitedeployments', to='core.Deployment')),
diff --git a/planetstack/core/models/site.py b/planetstack/core/models/site.py
index c7516d8..c61f5eb 100644
--- a/planetstack/core/models/site.py
+++ b/planetstack/core/models/site.py
@@ -316,15 +316,6 @@
     deployment = models.ForeignKey(Deployment,related_name='sitedeployments')
     controller = models.ForeignKey(Controller, null=True, blank=True, related_name='sitedeployments')
     availability_zone = models.CharField(max_length=200, null=True, blank=True, help_text="OpenStack availability zone")
-
-    def __unicode__(self):  return u'%s %s' % (self.deployment, self.site)
-
-class ControllerSiteDeployments(PlCoreBase):
-    objects = ControllerLinkManager()
-    deleted_objects = ControllerLinkDeletionManager()
-    
-    controller = models.ForeignKey(Controller, related_name='controllersitedeployments')
-    site_deployment = models.ForeignKey(SiteDeployments, related_name='controllersitedeployments') 
     tenant_id = models.CharField(null=True, blank=True, max_length=200, help_text="Keystone tenant id")
 
-    def __unicode__(self):  return u'%s %s' % (self.controller, self.site_deployment)
+    def __unicode__(self):  return u'%s %s' % (self.deployment, self.site)
diff --git a/planetstack/model_policies/model_policy_Site.py b/planetstack/model_policies/model_policy_Site.py
deleted file mode 100644
index 5b713e1..0000000
--- a/planetstack/model_policies/model_policy_Site.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from core.models import *
-
-def handle(site):
-    """ 
-    ensure ControllerSiteDeployment object exists for each of the site's SiteDeployment objects
-    """
-    from core.models import SiteDeployments, Controller, ControllerSiteDeployments 
-    from collections import defaultdict
-    
-    # get current controller site deployments	
-    ctrl_site_deployments = ControllerSiteDeployments.objects.filter(site_deployment__site = site)
-    ctrl_site_deployments_dict = {} 
-    for ctrl_site_depl in controller_site_deployments:
-        ctrl_site_deployments_dict[ctrl_site_depl.site_deployment] = ctrl_cite_depl
-
-    # get current site deployments
-    site_deployments = SiteDeployments.objects.filter(site=site)
- 
-    # for each site deployment, if there is no controller site deployment create one 
-    for site_deployment in site_deployments:
-        if site_deployment not in ctrl_site_deployments_dict:
-            ctrl_site_deployment = ControllerSiteDeployment(
-                site_deployment=site_deployment,
-                controller=site_deployment.controller,
-            )
-            ctrl_site_deployment.save()         
diff --git a/planetstack/openstack_observer/steps/sync_controller_site_deployments.py b/planetstack/openstack_observer/steps/sync_controller_site_deployments.py
index d0e4a7f..a923608 100644
--- a/planetstack/openstack_observer/steps/sync_controller_site_deployments.py
+++ b/planetstack/openstack_observer/steps/sync_controller_site_deployments.py
@@ -8,51 +8,51 @@
 
 class SyncControllerSiteDeployments(OpenStackSyncStep):
     requested_interval=0
-    provides=[ControllerSiteDeployments, SiteDeployments]
+    provides=[SiteDeployments]
 
-    def sync_record(self, controller_site_deployment):
+    def sync_record(self, site_deployment):
 
 	template = os_template_env.get_template('sync_controller_site_deployments.yaml')
-	tenant_fields = {'endpoint':controller_site_deployment.controller.auth_url,
-		         'admin_user': controller_site_deployment.controller.admin_user,
-		         'admin_password': controller_site_deployment.controller.admin_password,
-		         'admin_tenant': controller_site_deployment.controller.admin_tenant,
-	                 'ansible_tag': '%s@%s'%(controller_site_deployment.site_deployment.site.login_base,controller_site_deployment.site_deployment.deployment.name), # name of ansible playbook
-		         'tenant': controller_site_deployment.site_deployment.site.login_base,
-		         'tenant_description': controller_site_deployment.site_deployment.site.name}
+	tenant_fields = {'endpoint':site_deployment.controller.auth_url,
+		         'admin_user': site_deployment.controller.admin_user,
+		         'admin_password': site_deployment.controller.admin_password,
+		         'admin_tenant': site_deployment.controller.admin_tenant,
+	                 'ansible_tag': '%s@%s'%(site_deployment.site.login_base,site_deployment.site_deployment.deployment.name), # name of ansible playbook
+		         'tenant': site_deployment.site.login_base,
+		         'tenant_description': site_deployment.site.name}
 
 	rendered = template.render(tenant_fields)
-	res = run_template('sync_controller_site_deployments.yaml', tenant_fields, path='site_deployments')
+	res = run_template('sync_controller_site_deployments.yaml', tenant_fields, path='controller_site_deployments')
 
 	if (len(res)==1):
-		controller_site_deployment.tenant_id = res[0]['id']
-        	controller_site_deployment.save()
+		site_deployment.tenant_id = res[0]['id']
+        	site_deployment.save()
 	elif (len(res)):
 		raise Exception('Could not assign roles for user %s'%tenant_fields['tenant'])
 	else:
 		raise Exception('Could not create or update user %s'%tenant_fields['tenant'])
             
-    def delete_record(self, controller_site_deployment):
-	if controller_site_deployment.tenant_id:
-            driver = self.driver.admin_driver(controller=controller_site_deployment.controller)
-            driver.delete_tenant(controller_site_deployment.tenant_id)
+    def delete_record(self, site_deployment):
+	if site_deployment.tenant_id:
+            driver = self.driver.admin_driver(controller=site_deployment.controller)
+            driver.delete_tenant(site_deployment.tenant_id)
 
 	"""
         Ansible does not support tenant deletion yet
 
 	import pdb
 	pdb.set_trace()
-        template = os_template_env.get_template('delete_controller_site_deployments.yaml')
-	tenant_fields = {'endpoint':controller_site_deployment.controller.auth_url,
-		         'admin_user': controller_site_deployment.controller.admin_user,
-		         'admin_password': controller_site_deployment.controller.admin_password,
+        template = os_template_env.get_template('delete_site_deployments.yaml')
+	tenant_fields = {'endpoint':site_deployment.controller.auth_url,
+		         'admin_user': site_deployment.controller.admin_user,
+		         'admin_password': site_deployment.controller.admin_password,
 		         'admin_tenant': 'admin',
-	                 'ansible_tag': 'site_deployments/%s@%s'%(controller_site_deployment.site_deployment.site.login_base,controller_site_deployment.site_deployment.deployment.name), # name of ansible playbook
-		         'tenant': controller_site_deployment.site_deployment.site.login_base,
+	                 'ansible_tag': 'site_deployments/%s@%s'%(site_deployment.site_deployment.site.login_base,site_deployment.site_deployment.deployment.name), # name of ansible playbook
+		         'tenant': site_deployment.site_deployment.site.login_base,
 		         'delete': True}
 
 	rendered = template.render(tenant_fields)
-	res = run_template('sync_controller_site_deployments.yaml', tenant_fields)
+	res = run_template('sync_site_deployments.yaml', tenant_fields)
 
 	if (len(res)!=1):
 		raise Exception('Could not assign roles for user %s'%tenant_fields['tenant'])