removing plural from model names. some cleanup
diff --git a/planetstack/openstack_observer/steps/__init__.py b/planetstack/openstack_observer/steps/__init__.py
index 3f8dca4..92cc7f2 100644
--- a/planetstack/openstack_observer/steps/__init__.py
+++ b/planetstack/openstack_observer/steps/__init__.py
@@ -1,14 +1 @@
-from .sync_controller_site_deployments import SyncControllerSiteDeployments
-from .sync_network_slivers import SyncNetworkSlivers
-from .sync_networks import SyncNetworks
-from .sync_controller_networks import SyncControllerNetworks
-from .sync_site_privileges import SyncSitePrivileges
-from .sync_sites import SyncSites
-from .sync_slice_memberships import SyncSliceMemberships
-from .sync_slices import SyncSlices
-from .sync_slivers import SyncSlivers
-from .sync_users import SyncUsers
-from .sync_roles import SyncRoles
-from .sync_nodes import SyncNodes
-from .sync_images import SyncImages
-from .sync_controller_images import SyncControllerImages
+from .sync_controller_sites import SyncControllerSite
diff --git a/planetstack/openstack_observer/steps/sync_controller_networks.py b/planetstack/openstack_observer/steps/sync_controller_networks.py
index 3cff7c2..fa1f439 100644
--- a/planetstack/openstack_observer/steps/sync_controller_networks.py
+++ b/planetstack/openstack_observer/steps/sync_controller_networks.py
@@ -13,9 +13,9 @@
logger = Logger(level=logging.INFO)
-class SyncControllerNetworks(OpenStackSyncStep):
+class SyncControllerNetwork(OpenStackSyncStep):
requested_interval = 0
- provides=[Network, ControllerNetworks, Sliver]
+ provides=[Network, ControllerNetwork, Sliver]
def alloc_subnet(self, uuid):
a = 10
@@ -29,9 +29,9 @@
def fetch_pending(self, deleted):
if (deleted):
- return ControllerNetworks.deleted_objects.all()
+ return ControllerNetwork.deleted_objects.all()
else:
- return ControllerNetworks.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+ return ControllerNetwork.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
def save_controller_network(self, controller_network):
diff --git a/planetstack/openstack_observer/steps/sync_controller_site_deployments.py b/planetstack/openstack_observer/steps/sync_controller_site_deployments.py
deleted file mode 100644
index 907325a..0000000
--- a/planetstack/openstack_observer/steps/sync_controller_site_deployments.py
+++ /dev/null
@@ -1,63 +0,0 @@
-import os
-import base64
-from django.db.models import F, Q
-from planetstack.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.site import *
-from observer.ansible import *
-
-class SyncControllerSiteDeployments(OpenStackSyncStep):
- requested_interval=0
- provides=[SiteDeployments]
-
- def fetch_pending(self, deleted=False):
- pending = super(OpenStackSyncStep, self).fetch_pending(deleted)
- return pending.filter(controller__isnull=False)
-
- def sync_record(self, site_deployment):
-
- template = os_template_env.get_template('sync_controller_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': site_deployment.controller.admin_tenant,
- 'ansible_tag': '%s@%s'%(site_deployment.site.login_base,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='controller_site_deployments')
-
- if (len(res)==1):
- 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, 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_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'%(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_site_deployments.yaml', tenant_fields)
-
- if (len(res)!=1):
- raise Exception('Could not assign roles for user %s'%tenant_fields['tenant'])
- """
diff --git a/planetstack/openstack_observer/steps/sync_controller_sites.py b/planetstack/openstack_observer/steps/sync_controller_sites.py
new file mode 100644
index 0000000..f6425ae
--- /dev/null
+++ b/planetstack/openstack_observer/steps/sync_controller_sites.py
@@ -0,0 +1,63 @@
+import os
+import base64
+from django.db.models import F, Q
+from planetstack.config import Config
+from observer.openstacksyncstep import OpenStackSyncStep
+from core.models.site import *
+from observer.ansible import *
+
+class SyncControllerSite(OpenStackSyncStep):
+ requested_interval=0
+ provides=[ControllerSite]
+
+ def fetch_pending(self, deleted=False):
+ pending = super(OpenStackSyncStep, self).fetch_pending(deleted)
+ return pending.filter(controller__isnull=False)
+
+ def sync_record(self, controller_site):
+
+ template = os_template_env.get_template('sync_controller_sites.yaml')
+ tenant_fields = {'endpoint':controller_site.controller.auth_url,
+ 'admin_user': controller_site.controller.admin_user,
+ 'admin_password': controller_site.controller.admin_password,
+ 'admin_tenant': controller_site.controller.admin_tenant,
+ 'ansible_tag': '%s@%s'%(controller_site.site.login_base,controller_site.deployment.name), # name of ansible playbook
+ 'tenant': controller_site.site.login_base,
+ 'tenant_description': controller_site.site.name}
+
+ rendered = template.render(tenant_fields)
+ res = run_template('sync_controller_sites.yaml', tenant_fields, path='controller_sites')
+
+ if (len(res)==1):
+ controller_site.tenant_id = res[0]['id']
+ controller_site.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):
+ if controller_site.tenant_id:
+ driver = self.driver.admin_driver(controller=controller_site.controller)
+ driver.delete_tenant(controller_site.tenant_id)
+
+ """
+ Ansible does not support tenant deletion yet
+
+ import pdb
+ pdb.set_trace()
+ template = os_template_env.get_template('delete_controller_sites.yaml')
+ tenant_fields = {'endpoint':controller_site.controller.auth_url,
+ 'admin_user': controller_site.controller.admin_user,
+ 'admin_password': controller_site.controller.admin_password,
+ 'admin_tenant': 'admin',
+ 'ansible_tag': 'controller_sites/%s@%s'%(controller_site.controller_site.site.login_base,controller_site.controller_site.deployment.name), # name of ansible playbook
+ 'tenant': controller_site.controller_site.site.login_base,
+ 'delete': True}
+
+ rendered = template.render(tenant_fields)
+ res = run_template('sync_controller_sites.yaml', tenant_fields)
+
+ if (len(res)!=1):
+ raise Exception('Could not assign roles for user %s'%tenant_fields['tenant'])
+ """
diff --git a/planetstack/openstack_observer/steps/sync_controller_site_deployments.yaml b/planetstack/openstack_observer/steps/sync_controller_sites.yaml
similarity index 100%
rename from planetstack/openstack_observer/steps/sync_controller_site_deployments.yaml
rename to planetstack/openstack_observer/steps/sync_controller_sites.yaml
diff --git a/planetstack/openstack_observer/steps/sync_controller_slices.py b/planetstack/openstack_observer/steps/sync_controller_slices.py
index b1a1f55..24453e3 100644
--- a/planetstack/openstack_observer/steps/sync_controller_slices.py
+++ b/planetstack/openstack_observer/steps/sync_controller_slices.py
@@ -5,22 +5,22 @@
from django.db.models import F, Q
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.slice import Slice, ControllerSlices
-from core.models.controllerusers import ControllerUsers
+from core.models.slice import Slice, ControllerSlice
+from core.models.controllerusers import ControllerUser
from util.logger import Logger, logging
from observer.ansible import *
logger = Logger(level=logging.INFO)
-class SyncControllerSlices(OpenStackSyncStep):
- provides=[ControllerSlices]
+class SyncControllerSlice(OpenStackSyncStep):
+ provides=[ControllerSlice]
requested_interval=0
def fetch_pending(self, deleted):
if (deleted):
- return ControllerSlices.deleted_objects.all()
+ return ControllerSlice.deleted_objects.all()
else:
- return ControllerSlices.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+ return ControllerSlice.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
def sync_record(self, controller_slice):
logger.info("sync'ing slice controller %s" % controller_slice)
@@ -29,7 +29,7 @@
logger.info("controller %r has no admin_user, skipping" % controller_slice.controller)
return
- controller_users = ControllerUsers.objects.filter(user=controller_slice.slice.creator,
+ controller_users = ControllerUser.objects.filter(user=controller_slice.slice.creator,
controller=controller_slice.controller)
if not controller_users:
raise Exception("slice createor %s has not accout at controller %s" % (controller_slice.slice.creator, controller_slice.controller.name))
diff --git a/planetstack/openstack_observer/steps/sync_controller_user_site_privileges.py b/planetstack/openstack_observer/steps/sync_controller_user_site_privileges.py
new file mode 100644
index 0000000..6a62104
--- /dev/null
+++ b/planetstack/openstack_observer/steps/sync_controller_user_site_privileges.py
@@ -0,0 +1,86 @@
+import os
+import base64
+from collections import defaultdict
+from django.db.models import F, Q
+from planetstack.config import Config
+from observer.openstacksyncstep import OpenStackSyncStep
+from core.models.site import Controller, SitePrivilege
+from core.models.user import User
+from core.models.controlleruser import ControllerUser
+from util.logger import Logger, logging
+
+from observer.ansible import *
+
+logger = Logger(level=logging.INFO)
+
+class SyncControllerUser(OpenStackSyncStep):
+ provides=[SitePrivilege]
+ requested_interval=0
+
+ def fetch_pending(self, deleted):
+
+ if (deleted):
+ return SitePrivilege.deleted_objects.all()
+ else:
+ return ControllerUser.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+
+ def sync_record(self, controller_user):
+ logger.info("sync'ing user %s at controller %s" % (controller_user.user, controller_user.controller))
+
+ if not controller_user.controller.admin_user:
+ logger.info("controller %r has no admin_user, skipping" % controller_user.controller)
+ return
+
+ template = os_template_env.get_template('sync_controller_users.yaml')
+
+ # All users will have at least the 'user' role at their home site/tenant.
+ # We must also check if the user should have the admin role
+ roles = ['user']
+ if controller_user.user.is_admin:
+ roles.append('admin')
+
+ # setup user home site roles at controller
+ if not controller_user.user.site:
+ raise Exception('Siteless user %s'%controller_user.user.email)
+ else:
+ # look up tenant id for the user's site at the controller
+ #ctrl_site_deployments = SiteDeployment.objects.filter(
+ # site_deployment__site=controller_user.user.site,
+ # controller=controller_user.controller)
+
+ #if ctrl_site_deployments:
+ # # need the correct tenant id for site at the controller
+ # tenant_id = ctrl_site_deployments[0].tenant_id
+ # tenant_name = ctrl_site_deployments[0].site_deployment.site.login_base
+ user_fields = {
+ 'endpoint':controller_user.controller.auth_url,
+ 'name': controller_user.user.email,
+ 'email': controller_user.user.email,
+ 'password': controller_user.user.remote_password,
+ 'admin_user': controller_user.controller.admin_user,
+ 'admin_password': controller_user.controller.admin_password,
+ 'ansible_tag':'%s@%s'%(controller_user.user.email.replace('@','-at-'),controller_user.controller.name),
+ 'admin_tenant': controller_user.controller.admin_tenant,
+ 'roles':roles,
+ 'tenant':controller_user.user.site.login_base}
+
+ rendered = template.render(user_fields)
+ res = run_template('sync_controller_users.yaml', user_fields,path='controller_users')
+
+ # results is an array in which each element corresponds to an
+ # "ok" string received per operation. If we get as many oks as
+ # the number of operations we issued, that means a grand success.
+ # Otherwise, the number of oks tell us which operation failed.
+ expected_length = len(roles) + 1
+ if (len(res)==expected_length):
+ controller_user.kuser_id = res[0]['id']
+ controller_user.save()
+ elif (len(res)):
+ raise Exception('Could not assign roles for user %s'%user_fields['name'])
+ else:
+ raise Exception('Could not create or update user %s'%user_fields['name'])
+
+ def delete_record(self, controller_user):
+ if controller_user.kuser_id:
+ driver = self.driver.admin_driver(controller=controller_user.controller)
+ driver.delete_user(controller_user.kuser_id)
diff --git a/planetstack/openstack_observer/steps/sync_controller_user_slice_privileges.py b/planetstack/openstack_observer/steps/sync_controller_user_slice_privileges.py
new file mode 100644
index 0000000..4c68a40
--- /dev/null
+++ b/planetstack/openstack_observer/steps/sync_controller_user_slice_privileges.py
@@ -0,0 +1,86 @@
+import os
+import base64
+from collections import defaultdict
+from django.db.models import F, Q
+from planetstack.config import Config
+from observer.openstacksyncstep import OpenStackSyncStep
+from core.models.site import Controller, SiteDeployment
+from core.models.user import User
+from core.models.controllerusers import ControllerUser
+from util.logger import Logger, logging
+
+from observer.ansible import *
+
+logger = Logger(level=logging.INFO)
+
+class SyncControllerUser(OpenStackSyncStep):
+ provides=[ControllerUser, User]
+ requested_interval=0
+
+ def fetch_pending(self, deleted):
+
+ if (deleted):
+ return ControllerUser.deleted_objects.all()
+ else:
+ return ControllerUser.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+
+ def sync_record(self, controller_user):
+ logger.info("sync'ing user %s at controller %s" % (controller_user.user, controller_user.controller))
+
+ if not controller_user.controller.admin_user:
+ logger.info("controller %r has no admin_user, skipping" % controller_user.controller)
+ return
+
+ template = os_template_env.get_template('sync_controller_users.yaml')
+
+ # All users will have at least the 'user' role at their home site/tenant.
+ # We must also check if the user should have the admin role
+ roles = ['user']
+ if controller_user.user.is_admin:
+ roles.append('admin')
+
+ # setup user home site roles at controller
+ if not controller_user.user.site:
+ raise Exception('Siteless user %s'%controller_user.user.email)
+ else:
+ # look up tenant id for the user's site at the controller
+ #ctrl_site_deployments = SiteDeployment.objects.filter(
+ # site_deployment__site=controller_user.user.site,
+ # controller=controller_user.controller)
+
+ #if ctrl_site_deployments:
+ # # need the correct tenant id for site at the controller
+ # tenant_id = ctrl_site_deployments[0].tenant_id
+ # tenant_name = ctrl_site_deployments[0].site_deployment.site.login_base
+ user_fields = {
+ 'endpoint':controller_user.controller.auth_url,
+ 'name': controller_user.user.email,
+ 'email': controller_user.user.email,
+ 'password': controller_user.user.remote_password,
+ 'admin_user': controller_user.controller.admin_user,
+ 'admin_password': controller_user.controller.admin_password,
+ 'ansible_tag':'%s@%s'%(controller_user.user.email.replace('@','-at-'),controller_user.controller.name),
+ 'admin_tenant': controller_user.controller.admin_tenant,
+ 'roles':roles,
+ 'tenant':controller_user.user.site.login_base}
+
+ rendered = template.render(user_fields)
+ res = run_template('sync_controller_users.yaml', user_fields,path='controller_users')
+
+ # results is an array in which each element corresponds to an
+ # "ok" string received per operation. If we get as many oks as
+ # the number of operations we issued, that means a grand success.
+ # Otherwise, the number of oks tell us which operation failed.
+ expected_length = len(roles) + 1
+ if (len(res)==expected_length):
+ controller_user.kuser_id = res[0]['id']
+ controller_user.save()
+ elif (len(res)):
+ raise Exception('Could not assign roles for user %s'%user_fields['name'])
+ else:
+ raise Exception('Could not create or update user %s'%user_fields['name'])
+
+ def delete_record(self, controller_user):
+ if controller_user.kuser_id:
+ driver = self.driver.admin_driver(controller=controller_user.controller)
+ driver.delete_user(controller_user.kuser_id)
diff --git a/planetstack/openstack_observer/steps/sync_controller_users.py b/planetstack/openstack_observer/steps/sync_controller_users.py
index 1b57b81..1ace6db 100644
--- a/planetstack/openstack_observer/steps/sync_controller_users.py
+++ b/planetstack/openstack_observer/steps/sync_controller_users.py
@@ -4,25 +4,25 @@
from django.db.models import F, Q
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.site import Controller, SiteDeployments, SiteDeployments
+from core.models.site import Controller, SiteDeployment, SiteDeployment
from core.models.user import User
-from core.models.controllerusers import ControllerUsers
+from core.models.controllerusers import ControllerUser
from util.logger import Logger, logging
from observer.ansible import *
logger = Logger(level=logging.INFO)
-class SyncControllerUsers(OpenStackSyncStep):
- provides=[ControllerUsers, User]
+class SyncControllerUser(OpenStackSyncStep):
+ provides=[ControllerUser, User]
requested_interval=0
def fetch_pending(self, deleted):
if (deleted):
- return ControllerUsers.deleted_objects.all()
+ return ControllerUser.deleted_objects.all()
else:
- return ControllerUsers.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
+ return ControllerUser.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
def sync_record(self, controller_user):
logger.info("sync'ing user %s at controller %s" % (controller_user.user, controller_user.controller))
@@ -44,7 +44,7 @@
raise Exception('Siteless user %s'%controller_user.user.email)
else:
# look up tenant id for the user's site at the controller
- #ctrl_site_deployments = SiteDeployments.objects.filter(
+ #ctrl_site_deployments = SiteDeployment.objects.filter(
# site_deployment__site=controller_user.user.site,
# controller=controller_user.controller)
diff --git a/planetstack/openstack_observer/steps/sync_networks.py b/planetstack/openstack_observer/steps/sync_networks.py
index a4e9552..9f36ed5 100644
--- a/planetstack/openstack_observer/steps/sync_networks.py
+++ b/planetstack/openstack_observer/steps/sync_networks.py
@@ -17,8 +17,8 @@
network.save()
def delete_record(self, network):
- controller_networks_deleter = SyncControllerNetworks().delete_record
- for controller_network in ControllerNetworks.objects.filter(network=network):
+ controller_networks_deleter = SyncControllerNetwork().delete_record
+ for controller_network in ControllerNetwork.objects.filter(network=network):
try:
controller_network_deleter(controller_network)
except Exception,e:
diff --git a/planetstack/openstack_observer/steps/sync_nodes.py b/planetstack/openstack_observer/steps/sync_nodes.py
index 9d51073..e2c63bc 100644
--- a/planetstack/openstack_observer/steps/sync_nodes.py
+++ b/planetstack/openstack_observer/steps/sync_nodes.py
@@ -6,7 +6,7 @@
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.node import Node
-from core.models.site import SiteDeployments, Controller, SiteDeployments
+from core.models.site import SiteDeployment, Controller
from util.logger import Logger, logging
logger = Logger(level=logging.INFO)
@@ -30,7 +30,7 @@
new_nodes = []
for controller in controllers:
try:
- controller_site_deployments = SiteDeployments.objects.filter(controller=controller)[0]
+ controller_site_deployments = SiteDeployment.objects.filter(controller=controller)[0]
except IndexError:
raise Exception("Controller %s not bound to any site deployments"%controller.name)
diff --git a/planetstack/openstack_observer/steps/sync_site_privileges.py b/planetstack/openstack_observer/steps/sync_site_privileges.py
index 6354d1f..bfc04b3 100644
--- a/planetstack/openstack_observer/steps/sync_site_privileges.py
+++ b/planetstack/openstack_observer/steps/sync_site_privileges.py
@@ -3,9 +3,9 @@
from django.db.models import F, Q
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
-from core.models import User, ControllerUsers, SitePrivilege, SiteDeployments
+from core.models import User, ControllerUser, SitePrivilege, SiteDeployment
-class SyncSitePrivileges(OpenStackSyncStep):
+class SyncSitePrivilege(OpenStackSyncStep):
requested_interval=0
provides=[SitePrivilege]
@@ -18,9 +18,9 @@
def sync_record(self, site_priv):
# sync site privileges at all site controllers
- ctrl_site_deployments = SiteDeployments.objects.filter(site_deployment__site=site_priv.site)
+ ctrl_site_deployments = SiteDeployment.objects.filter(site_deployment__site=site_priv.site)
for ctrl_site_deployment in ctrl_site_deployments:
- controller_users = ControllerUsers.objects.filter(controller=ctrl_site_deployment.controller,
+ controller_users = ControllerUser.objects.filter(controller=ctrl_site_deployment.controller,
user=site_priv.user)
if controller_users:
kuser_id = controller_users[0].kuser_id
diff --git a/planetstack/openstack_observer/steps/sync_sites.py b/planetstack/openstack_observer/steps/sync_sites.py
deleted file mode 100644
index ea7df7e..0000000
--- a/planetstack/openstack_observer/steps/sync_sites.py
+++ /dev/null
@@ -1,25 +0,0 @@
-import os
-import base64
-from django.db.models import F, Q
-from planetstack.config import Config
-from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.site import Site, SiteDeployments, SiteDeployments
-from observer.steps.sync_controller_site_deployments import *
-
-class SyncSites(OpenStackSyncStep):
- provides=[Site]
- requested_interval=0
-
- def sync_record(self, site):
- site.save()
-
- def delete_record(self, site):
- # delete associated controllers site deployments
- site_deployments = SiteDeployments.objects.filter(site=site)
- site_deploy_deleter = SyncControllerSiteDeployments().delete_record
- for site_deployment in site_deployments:
- site_deployment_deleter(site_deployment)
-
-
-
-
diff --git a/planetstack/openstack_observer/steps/sync_slice_memberships.py b/planetstack/openstack_observer/steps/sync_slice_memberships.py
index 600f012..e95c533 100644
--- a/planetstack/openstack_observer/steps/sync_slice_memberships.py
+++ b/planetstack/openstack_observer/steps/sync_slice_memberships.py
@@ -4,7 +4,7 @@
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.slice import *
-from core.models.controllerusers import ControllerUsers
+from core.models.controllerusers import ControllerUser
from util.logger import Logger, logging
logger = Logger(level=logging.INFO)
@@ -22,11 +22,11 @@
def sync_record(self, slice_memb):
# sync slice memberships at all slice controllers
logger.info("syncing slice privilege: %s %s" % (slice_memb.slice.name, slice_memb.user.email))
- slice_controllers = ControllerSlices.objects.filter(slice=slice_memb.slice)
+ slice_controllers = ControllerSlice.objects.filter(slice=slice_memb.slice)
for slice_controller in slice_controllers:
if not slice_controller.tenant_id:
continue
- controller_users = ControllerUsers.objects.filter(controller=slice_controller.controller,
+ controller_users = ControllerUser.objects.filter(controller=slice_controller.controller,
user=slice_memb.user)
if controller_users:
kuser_id = controller_users[0].kuser_id
diff --git a/planetstack/openstack_observer/steps/sync_slices.py b/planetstack/openstack_observer/steps/sync_slices.py
index a792b48..99ed44c 100644
--- a/planetstack/openstack_observer/steps/sync_slices.py
+++ b/planetstack/openstack_observer/steps/sync_slices.py
@@ -4,7 +4,7 @@
from django.db.models import F, Q
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
-from core.models.slice import Slice, ControllerSlices
+from core.models.slice import Slice, ControllerSlice
from util.logger import Logger, logging
from observer.steps.sync_controller_slices import *
@@ -15,14 +15,14 @@
requested_interval=0
def sync_record(self, slice):
- for controller_slice in ControllerSlices.objects.filter(slice=slice):
+ for controller_slice in ControllerSlice.objects.filter(slice=slice):
# bump the 'updated' timestamp and trigger observer to update
# slice across all controllers
controller_slice.save()
def delete_record(self, slice):
- controller_slice_deleter = SyncControllerSlices().delete_record
- for controller_slice in ControllerSlices.objects.filter(slice=slice):
+ controller_slice_deleter = SyncControllerSlice().delete_record
+ for controller_slice in ControllerSlice.objects.filter(slice=slice):
try:
controller_slice_deleter(controller_slice)
except Exception,e:
diff --git a/planetstack/openstack_observer/steps/sync_slivers.py b/planetstack/openstack_observer/steps/sync_slivers.py
index 94fd0d5..8adb50c 100644
--- a/planetstack/openstack_observer/steps/sync_slivers.py
+++ b/planetstack/openstack_observer/steps/sync_slivers.py
@@ -4,8 +4,8 @@
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.sliver import Sliver
-from core.models.slice import Slice, SlicePrivilege, ControllerSlices
-from core.models.network import Network, NetworkSlice, ControllerNetworks
+from core.models.slice import Slice, SlicePrivilege, ControllerSlice
+from core.models.network import Network, NetworkSlice, ControllerNetwork
from util.logger import Logger, logging
from observer.ansible import *
@@ -45,7 +45,7 @@
nics = []
networks = [ns.network for ns in NetworkSlice.objects.filter(slice=sliver.slice)]
- controller_networks = ControllerNetworks.objects.filter(network__in=networks,
+ controller_networks = ControllerNetwork.objects.filter(network__in=networks,
controller=sliver.node.site_deployment.controller)
for controller_network in controller_networks:
diff --git a/planetstack/openstack_observer/steps/sync_users.py b/planetstack/openstack_observer/steps/sync_users.py
index 3c69cad..4cb1a26 100644
--- a/planetstack/openstack_observer/steps/sync_users.py
+++ b/planetstack/openstack_observer/steps/sync_users.py
@@ -5,20 +5,20 @@
from planetstack.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.user import User
-from core.models.controllerusers import ControllerUsers
-from observer.steps.sync_controller_users import SyncControllerUsers
+from core.models.controllerusers import ControllerUser
+from observer.steps.sync_controller_users import SyncControllerUser
class SyncUsers(OpenStackSyncStep):
provides=[User]
requested_interval=0
def sync_record(self, user):
- for controller_user in ControllerUsers.objects.filter(user=user):
+ for controller_user in ControllerUser.objects.filter(user=user):
# bump the 'updated' field so user account are updated across
# controllers.
controller_user.save()
def delete_record(self, user):
- controller_user_deleter = SyncControllerUsers().delete_record
- for controller_user in ControllerUsers.objects.filter(user=user):
+ controller_user_deleter = SyncControllerUser().delete_record
+ for controller_user in ControllerUser.objects.filter(user=user):
controller_user_deleter(controller_user)