mirror of
https://github.com/ansible/awx.git
synced 2026-03-26 13:25:02 -02:30
Use on_commit hook for triggering ig policy
* also Apply console handlers to loggers for dev environment
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
# Copyright (c) 2015 Ansible, Inc.
|
# Copyright (c) 2015 Ansible, Inc.
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models, connection
|
||||||
from django.db.models.signals import post_save, post_delete
|
from django.db.models.signals import post_save, post_delete
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
@@ -140,26 +140,26 @@ class JobOrigin(models.Model):
|
|||||||
def on_instance_group_saved(sender, instance, created=False, raw=False, **kwargs):
|
def on_instance_group_saved(sender, instance, created=False, raw=False, **kwargs):
|
||||||
if created:
|
if created:
|
||||||
from awx.main.tasks import apply_cluster_membership_policies
|
from awx.main.tasks import apply_cluster_membership_policies
|
||||||
apply_cluster_membership_policies.apply_async(countdown=5)
|
connection.on_commit(lambda: apply_cluster_membership_policies.apply_async())
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_save, sender=Instance)
|
@receiver(post_save, sender=Instance)
|
||||||
def on_instance_saved(sender, instance, created=False, raw=False, **kwargs):
|
def on_instance_saved(sender, instance, created=False, raw=False, **kwargs):
|
||||||
if created:
|
if created:
|
||||||
from awx.main.tasks import apply_cluster_membership_policies
|
from awx.main.tasks import apply_cluster_membership_policies
|
||||||
apply_cluster_membership_policies.apply_async(countdown=5)
|
connection.on_commit(lambda: apply_cluster_membership_policies.apply_async())
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_delete, sender=InstanceGroup)
|
@receiver(post_delete, sender=InstanceGroup)
|
||||||
def on_instance_group_deleted(sender, instance, using, **kwargs):
|
def on_instance_group_deleted(sender, instance, using, **kwargs):
|
||||||
from awx.main.tasks import apply_cluster_membership_policies
|
from awx.main.tasks import apply_cluster_membership_policies
|
||||||
apply_cluster_membership_policies.apply_async(countdown=5)
|
connection.on_commit(lambda: apply_cluster_membership_policies.apply_async())
|
||||||
|
|
||||||
|
|
||||||
@receiver(post_delete, sender=Instance)
|
@receiver(post_delete, sender=Instance)
|
||||||
def on_instance_deleted(sender, instance, using, **kwargs):
|
def on_instance_deleted(sender, instance, using, **kwargs):
|
||||||
from awx.main.tasks import apply_cluster_membership_policies
|
from awx.main.tasks import apply_cluster_membership_policies
|
||||||
apply_cluster_membership_policies.apply_async(countdown=5)
|
connection.on_commit(lambda: apply_cluster_membership_policies.apply_async())
|
||||||
|
|
||||||
|
|
||||||
# Unfortunately, the signal can't just be connected against UnifiedJob; it
|
# Unfortunately, the signal can't just be connected against UnifiedJob; it
|
||||||
|
|||||||
@@ -198,6 +198,27 @@ LOGGING['handlers']['syslog'] = {
|
|||||||
'formatter': 'simple',
|
'formatter': 'simple',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOGGING['loggers']['django.request']['handlers'] = ['console']
|
||||||
|
LOGGING['loggers']['rest_framework.request']['handlers'] = ['console']
|
||||||
|
LOGGING['loggers']['awx']['handlers'] = ['console']
|
||||||
|
LOGGING['loggers']['awx.main.commands.run_callback_receiver']['handlers'] = ['console']
|
||||||
|
LOGGING['loggers']['awx.main.commands.inventory_import']['handlers'] = ['console']
|
||||||
|
LOGGING['loggers']['awx.main.tasks']['handlers'] = ['console']
|
||||||
|
LOGGING['loggers']['awx.main.scheduler']['handlers'] = ['console']
|
||||||
|
LOGGING['loggers']['django_auth_ldap']['handlers'] = ['console']
|
||||||
|
LOGGING['loggers']['social']['handlers'] = ['console']
|
||||||
|
LOGGING['loggers']['system_tracking_migrations']['handlers'] = ['console']
|
||||||
|
LOGGING['loggers']['rbac_migrations']['handlers'] = ['console']
|
||||||
|
LOGGING['loggers']['awx.isolated.manager.playbooks']['handlers'] = ['console']
|
||||||
|
LOGGING['handlers']['callback_receiver'] = {'class': 'logging.NullHandler'}
|
||||||
|
LOGGING['handlers']['fact_receiver'] = {'class': 'logging.NullHandler'}
|
||||||
|
LOGGING['handlers']['task_system'] = {'class': 'logging.NullHandler'}
|
||||||
|
LOGGING['handlers']['tower_warnings'] = {'class': 'logging.NullHandler'}
|
||||||
|
LOGGING['handlers']['rbac_migrations'] = {'class': 'logging.NullHandler'}
|
||||||
|
LOGGING['handlers']['system_tracking_migrations'] = {'class': 'logging.NullHandler'}
|
||||||
|
LOGGING['handlers']['management_playbooks'] = {'class': 'logging.NullHandler'}
|
||||||
|
|
||||||
|
|
||||||
# Enable the following lines to also log to a file.
|
# Enable the following lines to also log to a file.
|
||||||
#LOGGING['handlers']['file'] = {
|
#LOGGING['handlers']['file'] = {
|
||||||
# 'class': 'logging.FileHandler',
|
# 'class': 'logging.FileHandler',
|
||||||
|
|||||||
Reference in New Issue
Block a user