removing ControllerSiteDeployment object. Move tenant_id field to SiteDeployments model
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'])