Exemplo n.º 1
0
    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'
        )
Exemplo n.º 2
0
    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',
        )
Exemplo n.º 3
0
    def ready(self):
        # structure
        from .backend import ZabbixBackend
        SupportedServices.register_backend(ZabbixBackend)

        # templates
        from nodeconductor.template import TemplateRegistry
        from nodeconductor_zabbix.template import HostProvisionTemplateForm
        TemplateRegistry.register(HostProvisionTemplateForm)

        from . import handlers
        for index, resource_model in enumerate(
                structure_models.Resource.get_all_models()):
            signals.post_save.connect(
                handlers.update_hosts_visible_name_on_scope_name_change,
                sender=resource_model,
                dispatch_uid=
                'nodeconductor_zabbix.handlers.update_hosts_visible_name_on_scope_name_change_%s_%s'
                % (index, resource_model.__name__))

            signals.pre_delete.connect(
                handlers.delete_hosts_on_scope_deletion,
                sender=resource_model,
                dispatch_uid=
                'nodeconductor_zabbix.handlers.delete_hosts_on_scope_deletion_%s_%s'
                % (index, resource_model.__name__))
Exemplo n.º 4
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',
        )
Exemplo n.º 5
0
    def get_inlines(self):
        if not hasattr(self, '_inlines'):
            self._inlines = []
            for resource_model in TemplateRegistry.get_resource_models():
                template_form = TemplateRegistry.get_resource_form(
                    resource_model)

                class TemplateInline(BaseTemplateInline):
                    form = template_form
                    verbose_name = "Template for %s %s provision" % (
                        resource_model._meta.app_label,
                        resource_model._meta.verbose_name)
                    verbose_name_plural = "Templates for %s %s provision" % (
                        resource_model._meta.app_label,
                        resource_model._meta.verbose_name)

                self._inlines.append(TemplateInline)
        return self._inlines
Exemplo n.º 6
0
    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',
        )