def ready(self):
        # structure
        from .backend import SugarCRMBackend
        SupportedServices.register_backend(SugarCRMBackend)

        # cost tracking
        from .cost_tracking import SugarCRMCostTrackingBackend
        CostTrackingRegister.register(self.label, SugarCRMCostTrackingBackend)

        # template
        from .template import CRMProvisionTemplateForm
        TemplateRegistry.register(CRMProvisionTemplateForm)

        from . import handlers
        CRM = self.get_model('CRM')

        signals.post_save.connect(
            handlers.update_user_limit_count_quota_on_crm_quota_change,
            sender=Quota,
            dispatch_uid='nodeconductor_sugarcrm.handlers.update_user_limit_count_quota_on_crm_quota_change',
        )

        signals.pre_delete.connect(
            handlers.update_user_limit_count_quota_on_crm_deletion,
            sender=CRM,
            dispatch_uid='nodeconductor_sugarcrm.handlers.update_user_limit_count_quota_on_crm_deletion'
        )
    def ready(self):
        from .cost_tracking import SaltStackCostTrackingBackend
        CostTrackingRegister.register(self.label, SaltStackCostTrackingBackend)

        # template
        from .template import SharepointTenantTemplateForm
        TemplateRegistry.register(SharepointTenantTemplateForm)

        # import it here in order to register as SaltStack backend
        from .backend import SharepointBackend

        from . import handlers
        SharepointTenant = self.get_model('SharepointTenant')
        User = self.get_model('User')
        SiteCollection = self.get_model('SiteCollection')

        signals.post_save.connect(
            handlers.increase_quotas_usage_on_tenant_creation,
            sender=SharepointTenant,
            dispatch_uid='nodeconductor.saltstack.sharepoint.handlers.increase_quotas_usage_on_tenant_creation',
        )

        signals.pre_delete.connect(
            handlers.decrease_quotas_usage_on_tenant_deletion,
            sender=SharepointTenant,
            dispatch_uid='nodeconductor.saltstack.sharepoint.handlers.decrease_quotas_usage_on_tenant_deletion',
        )
Example #3
0
    def ready(self):
        OpenStackService = self.get_model('OpenStackService')
        OpenStackServiceProjectLink = self.get_model('OpenStackServiceProjectLink')
        Instance = self.get_model('Instance')
        FloatingIP = self.get_model('FloatingIP')

        # structure
        from nodeconductor.openstack.backend import OpenStackBackend
        SupportedServices.register_backend(OpenStackService, OpenStackBackend)

        # cost tracking
        from nodeconductor.openstack.cost_tracking import OpenStackCostTrackingBackend
        CostTrackingRegister.register(self.label, OpenStackCostTrackingBackend)

        # template
        from nodeconductor.template import TemplateRegistry
        from nodeconductor.openstack.template import InstanceProvisionTemplateForm
        TemplateRegistry.register(InstanceProvisionTemplateForm)

        signals.post_save.connect(
            handlers.create_initial_security_groups,
            sender=OpenStackServiceProjectLink,
            dispatch_uid='nodeconductor.openstack.handlers.create_initial_security_groups',
        )

        signals.post_save.connect(
            quotas_handlers.add_quotas_to_scope,
            sender=OpenStackServiceProjectLink,
            dispatch_uid='nodeconductor.openstack.handlers.add_quotas_to_service_project_link',
        )

        signals.pre_save.connect(
            handlers.set_spl_default_availability_zone,
            sender=OpenStackServiceProjectLink,
            dispatch_uid='nodeconductor.openstack.handlers.set_spl_default_availability_zone',
        )

        signals.post_save.connect(
            handlers.increase_quotas_usage_on_instance_creation,
            sender=Instance,
            dispatch_uid='nodeconductor.openstack.handlers.increase_quotas_usage_on_instance_creation',
        )

        signals.post_delete.connect(
            handlers.decrease_quotas_usage_on_instances_deletion,
            sender=Instance,
            dispatch_uid='nodeconductor.openstack.handlers.decrease_quotas_usage_on_instances_deletion',
        )

        signals.post_save.connect(
            handlers.change_floating_ip_quota_on_status_change,
            sender=FloatingIP,
            dispatch_uid='nodeconductor.openstack.handlers.change_floating_ip_quota_on_status_change',
        )
    def ready(self):
        from .cost_tracking import SaltStackCostTrackingBackend
        CostTrackingRegister.register(self.label, SaltStackCostTrackingBackend)

        # template
        from .template import TenantProvisionTemplateForm
        TemplateRegistry.register(TenantProvisionTemplateForm)

        # import it here in order to register as SaltStack backend
        from .backend import ExchangeBackend

        from . import handlers
        ExchangeTenant = self.get_model('ExchangeTenant')
        User = self.get_model('User')

        # Tenants CRUD
        signals.post_save.connect(
            handlers.increase_exchange_storage_usage_on_tenant_creation,
            sender=ExchangeTenant,
            dispatch_uid='nodeconductor.saltstack.exchange.handlers.increase_exchange_storage_usage_on_tenant_creation',
        )

        signals.post_delete.connect(
            handlers.decrease_exchange_storage_usage_on_tenant_deletion,
            sender=ExchangeTenant,
            dispatch_uid='nodeconductor.saltstack.exchange.handlers.decrease_exchange_storage_usage_on_tenant_deletion',
        )

        # Users CRUD
        signals.post_save.connect(
            handlers.increase_global_mailbox_size_usage_on_user_creation_or_modification,
            sender=User,
            dispatch_uid=('nodeconductor.saltstack.exchange.handlers'
                          '.increase_global_mailbox_size_usage_on_user_creation_or_modification'),
        )

        signals.post_delete.connect(
            handlers.decrease_global_mailbox_size_usage_on_user_deletion,
            sender=User,
            dispatch_uid='nodeconductor.saltstack.exchange.handlers.decrease_global_mailbox_size_usage_on_user_deletion',
        )
Example #5
0
    def ready(self):
        Instance = self.get_model('Instance')
        Cloud = self.get_model('Cloud')
        CloudProjectMembership = self.get_model('CloudProjectMembership')

        from nodeconductor.iaas import handlers, cost_tracking
        from nodeconductor.structure.serializers import CustomerSerializer, ProjectSerializer

        CostTrackingRegister.register(self.label,
                                      cost_tracking.IaaSCostTrackingBackend)

        pre_serializer_fields.connect(
            handlers.add_clouds_to_related_model,
            sender=CustomerSerializer,
            dispatch_uid='nodeconductor.iaas.handlers.add_clouds_to_customer',
        )

        pre_serializer_fields.connect(
            handlers.add_clouds_to_related_model,
            sender=ProjectSerializer,
            dispatch_uid='nodeconductor.iaas.handlers.add_clouds_to_project',
        )

        signals.post_save.connect(
            quotas_handlers.add_quotas_to_scope,
            sender=CloudProjectMembership,
            dispatch_uid=
            'nodeconductor.iaas.handlers.add_quotas_to_cloud_project_membership',
        )

        signals.post_save.connect(
            handlers.create_initial_security_groups,
            sender=CloudProjectMembership,
            dispatch_uid=
            'nodeconductor.iaas.handlers.create_initial_security_groups',
        )

        # protect against a deletion of the Instance with connected backups
        # TODO: introduces dependency of IaaS on Backups, should be reconsidered
        signals.pre_delete.connect(
            handlers.prevent_deletion_of_instances_with_connected_backups,
            sender=Instance,
            dispatch_uid=
            'nodeconductor.iaas.handlers.prevent_deletion_of_instances_with_connected_backups',
        )

        signals.pre_save.connect(
            core_handlers.preserve_fields_before_update,
            sender=Instance,
            dispatch_uid=
            'nodeconductor.iaas.handlers.preserve_fields_before_update',
        )

        # if instance name is updated, zabbix host visible name should be also updated
        signals.post_save.connect(
            handlers.check_instance_name_update,
            sender=Instance,
            dispatch_uid=
            'nodeconductor.iaas.handlers.check_instance_name_update',
        )

        signals.pre_save.connect(
            handlers.set_cpm_default_availability_zone,
            sender=CloudProjectMembership,
            dispatch_uid=
            'nodeconductor.iaas.handlers.set_cpm_default_availability_zone',
        )

        signals.post_save.connect(
            handlers.increase_quotas_usage_on_instance_creation,
            sender=Instance,
            dispatch_uid=
            'nodeconductor.iaas.handlers.increase_quotas_usage_on_instance_creation',
        )

        signals.post_delete.connect(
            handlers.decrease_quotas_usage_on_instances_deletion,
            sender=Instance,
            dispatch_uid=
            'nodeconductor.iaas.handlers.decrease_quotas_usage_on_instances_deletion',
        )

        signals.post_save.connect(
            handlers.change_customer_nc_service_quota,
            sender=Cloud,
            dispatch_uid=
            'nodeconductor.iaas.handlers.increase_customer_nc_service_quota')

        signals.post_delete.connect(
            handlers.change_customer_nc_service_quota,
            sender=Cloud,
            dispatch_uid=
            'nodeconductor.iaas.handlers.decrease_customer_nc_service_quota')

        signals.post_save.connect(
            handlers.check_project_name_update,
            sender=Project,
            dispatch_uid='nodeconductor.iaas.handlers.check_project_name_update'
        )