From e7f36eb2ead58a0e75f2e682463e5e09d0f8ccf0 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Tue, 3 Mar 2020 14:58:36 -0500 Subject: [PATCH] remove a few custom notification fields that don't work these aren't top-level serializer fields; they're summary fields if we want to support these properly, we should treat them as enhancements, and write support, tests, and documentation --- awx/main/models/notifications.py | 16 ++-------------- .../functional/models/test_notifications.py | 17 ++++++----------- 2 files changed, 8 insertions(+), 25 deletions(-) diff --git a/awx/main/models/notifications.py b/awx/main/models/notifications.py index 7a20ed4e19..f731a03ce0 100644 --- a/awx/main/models/notifications.py +++ b/awx/main/models/notifications.py @@ -272,20 +272,17 @@ class JobNotificationMixin(object): 'approval_status', 'approval_node_name', 'workflow_url', {'host_status_counts': ['skipped', 'ok', 'changed', 'failed', 'failures', 'dark' 'processed', 'rescued', 'ignored']}, - {'playbook_counts': ['play_count', 'task_count']}, {'summary_fields': [{'inventory': ['id', 'name', 'description', 'has_active_failures', 'total_hosts', 'hosts_with_active_failures', 'total_groups', 'has_inventory_sources', 'total_inventory_sources', 'inventory_sources_with_failures', 'organization_id', 'kind']}, {'project': ['id', 'name', 'description', 'status', 'scm_type']}, - {'project_update': ['id', 'name', 'description', 'status', 'failed']}, {'job_template': ['id', 'name', 'description']}, {'unified_job_template': ['id', 'name', 'description', 'unified_job_type']}, {'instance_group': ['name', 'id']}, {'created_by': ['id', 'username', 'first_name', 'last_name']}, - {'labels': ['count', 'results']}, - {'source_workflow_job': ['description', 'elapsed', 'failed', 'id', 'name', 'status']}]}] + {'labels': ['count', 'results']}]}] @classmethod def context_stub(cls): @@ -315,7 +312,6 @@ class JobNotificationMixin(object): 'limit': 'bar_limit', 'modified': datetime.datetime(2018, 12, 13, 6, 4, 0, 0, tzinfo=datetime.timezone.utc), 'name': 'Stub JobTemplate', - 'playbook_counts': {'play_count': 5, 'task_count': 10}, 'playbook': 'ping.yml', 'scm_revision': '', 'skip_tags': '', @@ -348,18 +344,10 @@ class JobNotificationMixin(object): 'name': 'Stub project', 'scm_type': 'git', 'status': 'successful'}, - 'project_update': {'id': 5, 'name': 'Stub Project Update', 'description': 'Project Update', - 'status': 'running', 'failed': False}, 'unified_job_template': {'description': 'Sample unified job template description', 'id': 39, 'name': 'Stub Job Template', - 'unified_job_type': 'job'}, - 'source_workflow_job': {'description': 'Sample workflow job description', - 'elapsed': 0.000, - 'failed': False, - 'id': 88, - 'name': 'Stub WorkflowJobTemplate', - 'status': 'running'}}, + 'unified_job_type': 'job'}}, 'timeout': 0, 'type': 'job', 'url': '/api/v2/jobs/13/', diff --git a/awx/main/tests/functional/models/test_notifications.py b/awx/main/tests/functional/models/test_notifications.py index 02a2b28e83..57fd4cca91 100644 --- a/awx/main/tests/functional/models/test_notifications.py +++ b/awx/main/tests/functional/models/test_notifications.py @@ -23,8 +23,11 @@ class TestJobNotificationMixin(object): 'finished': bool, 'force_handlers': bool, 'forks': int, - 'host_status_counts': {'skipped': int, 'ok': int, 'changed': int, - 'failures': int, 'dark': int}, + 'host_status_counts': { + 'skipped': int, 'ok': int, 'changed': int, + 'failures': int, 'dark': int, 'processed': int, + 'rescued': int, 'failed': bool + }, 'id': int, 'job_explanation': str, 'job_slice_count': int, @@ -36,7 +39,6 @@ class TestJobNotificationMixin(object): 'modified': datetime.datetime, 'name': str, 'playbook': str, - 'playbook_counts': {'play_count': int, 'task_count': int}, 'scm_revision': str, 'skip_tags': str, 'start_at_task': str, @@ -68,17 +70,10 @@ class TestJobNotificationMixin(object): 'name': str, 'scm_type': str, 'status': str}, - 'project_update': {'id': int, 'name': str, 'description': str, 'status': str, 'failed': bool}, 'unified_job_template': {'description': str, 'id': int, 'name': str, - 'unified_job_type': str}, - 'source_workflow_job': {'description': str, - 'elapsed': float, - 'failed': bool, - 'id': int, - 'name': str, - 'status': str}}, + 'unified_job_type': str}}, 'timeout': int, 'type': str,