Exemplo n.º 1
0
    class Meta:
        event_types = ('iaas_membership_sync_failed', )


class CloudEventLogger(EventLogger):
    cloud = 'iaas.Cloud'

    class Meta:
        event_types = ('iaas_service_sync_failed', )


class QuotaEventLogger(EventLogger):
    quota = 'quotas.Quota'
    cloud = 'iaas.Cloud'
    project = 'structure.Project'
    project_group = 'structure.ProjectGroup'
    threshold = float

    class Meta:
        event_types = ('quota_threshold_reached', )


event_logger.register('instance', InstanceEventLogger)
event_logger.register('instance_import', InstanceImportEventLogger)
event_logger.register('instance_volume', InstanceVolumeChangeEventLogger)
event_logger.register('instance_flavor', InstanceFlavorChangeEventLogger)
event_logger.register('instance_licenses', InstanceLicensesEventLogger)
event_logger.register('cloud', CloudEventLogger)
event_logger.register('membership', MembershipEventLogger)
event_logger.register('membership_quota', QuotaEventLogger)
Exemplo n.º 2
0
        permitted_objects_uuids = staticmethod(
            lambda user: {'user_uuid': [user.uuid.hex]})
        event_types = ('user_creation_succeeded', 'user_update_succeeded',
                       'user_deletion_succeeded', 'user_password_updated',
                       'user_activated', 'user_deactivated')


class SshPublicKeyEventLogger(EventLogger):
    ssh_key = SshPublicKey

    class Meta:
        event_types = ('ssh_key_creation_succeeded',
                       'ssh_key_deletion_succeeded')


event_logger.register('auth', AuthEventLogger)
event_logger.register('user', UserEventLogger)
event_logger.register('sshkey', SshPublicKeyEventLogger)

# Backward compatibility imports
from nodeconductor.logging.log import TCPEventHandler, RequireEvent, RequireNotEvent
import warnings


class NodeConductorDeprecationWarning(PendingDeprecationWarning):
    pass


warnings.simplefilter('always', NodeConductorDeprecationWarning)
warnings.warn(
    "TCPEventHandler and RequireEvent/RequireNotEvent classes have been moved to "
Exemplo n.º 3
0
from nodeconductor.core.models import User
from nodeconductor.logging.log import EventLogger, event_logger


class Saml2AuthEventLogger(EventLogger):
    user = User

    class Meta:
        event_types = ('auth_logged_in_with_pki', )


event_logger.register('saml2_auth', Saml2AuthEventLogger)
Exemplo n.º 4
0
from nodeconductor.logging.log import EventLogger, event_logger

from .models import Invoice


class InvoiceEventLogger(EventLogger):
    invoice = Invoice

    class Meta:
        event_types = ('invoice_deletion_succeeded',
                       'invoice_update_succeeded',
                       'invoice_creation_succeeded')


event_logger.register('killbill_invoice', InvoiceEventLogger)
Exemplo n.º 5
0
                       'iaas_backup_deletion_scheduled',
                       'iaas_backup_deletion_succeeded',
                       'iaas_backup_deletion_failed')


class BackupScheduleEventLogger(EventLogger):
    cloud_account = 'iaas.Cloud'
    iaas_instance = 'iaas.Instance'
    customer = 'structure.Customer'
    project = 'structure.Project'

    class Meta:
        event_types = ('iaas_backup_schedule_creation_succeeded',
                       'iaas_backup_schedule_update_succeeded',
                       'iaas_backup_schedule_deletion_succeeded',
                       'iaas_backup_schedule_activated',
                       'iaas_backup_schedule_deactivated')


def extract_event_context(instance):
    context = {'iaas_instance': instance.backup_source}
    cpm = context['iaas_instance'].cloud_project_membership
    context['cloud_account'] = cpm.cloud
    context['project'] = cpm.project
    context['customer'] = context['project'].customer
    return context


event_logger.register('backup', BackupEventLogger)
event_logger.register('backup_schedule', BackupScheduleEventLogger)
Exemplo n.º 6
0
    error_message = six.text_type

    class Meta:
        event_types = ('service_settings_sync_failed',
                       'service_settings_recovered')


class ServiceProjectLinkEventLogger(EventLogger):
    service_project_link = models.ServiceProjectLink
    error_message = six.text_type

    class Meta:
        event_types = ('service_project_link_creation_failed',
                       'service_project_link_sync_failed',
                       'service_project_link_recovered')


event_logger.register('customer_role', CustomerRoleEventLogger)
event_logger.register('project_role', ProjectRoleEventLogger)
event_logger.register('project_group_role', ProjectGroupRoleEventLogger)
event_logger.register('project_group_membership',
                      ProjectGroupMembershipEventLogger)
event_logger.register('user_organization', UserOrganizationEventLogger)
event_logger.register('customer', CustomerEventLogger)
event_logger.register('project', ProjectEventLogger)
event_logger.register('project_group', ProjectGroupEventLogger)
event_logger.register('balance', BalanceEventLogger)
event_logger.register('resource', ResourceEventLogger)
event_logger.register('service_settings', ServiceSettingsEventLogger)
event_logger.register('service_project_link', ServiceProjectLinkEventLogger)
Exemplo n.º 7
0
from nodeconductor.logging.log import AlertLogger, EventLogger, alert_logger, event_logger
from nodeconductor.quotas import models


class QuotaAlertLogger(AlertLogger):
    quota = models.Quota

    class Meta:
        alert_types = ('quota_usage_is_over_threshold', )


class QuotaEventLogger(EventLogger):
    quota = 'quotas.Quota'
    service = 'structure.Service'
    project = 'structure.Project'
    project_group = 'structure.ProjectGroup'
    threshold = float

    class Meta:
        event_types = ('quota_threshold_reached', )


alert_logger.register('quota', QuotaAlertLogger)
event_logger.register('quota', QuotaEventLogger)