mirror of
https://github.com/ansible/awx.git
synced 2026-06-23 07:37:50 -02:30
Expose JOB_VARIABLE_PREFIXES as a configurable setting (#16452)
* INCLUDE_AWX_VAR_PREFIX to USE_TOWER_VAR_PREFIX boolean toggle replace the include legacy prefix boolean with a tower-or-awx toggle USE_TOWER_VAR_PREFIX=True (default) emits only tower_ prefixed variables, false emits only awx_ (deprecated) * Clean up dead constant and cache get_job_variable_prefixes() calls * Revise tests to reflect new behavior * Fix fragile fallback test to actually exercise getattr default * Fix mock target for settings fallback test
This commit is contained in:
@@ -17,7 +17,7 @@ from awx.api import serializers
|
||||
from awx.api.generics import APIView, GenericAPIView
|
||||
from awx.api.permissions import WebhookKeyPermission
|
||||
from awx.main.models import Job, JobTemplate, WorkflowJob, WorkflowJobTemplate
|
||||
from awx.main.constants import JOB_VARIABLE_PREFIXES
|
||||
from awx.main.utils.common import get_job_variable_prefixes
|
||||
|
||||
logger = logging.getLogger('awx.api.views.webhooks')
|
||||
|
||||
@@ -166,7 +166,7 @@ class WebhookReceiverBase(APIView):
|
||||
'extra_vars': {},
|
||||
}
|
||||
|
||||
for name in JOB_VARIABLE_PREFIXES:
|
||||
for name in get_job_variable_prefixes():
|
||||
kwargs['extra_vars']['{}_webhook_event_type'.format(name)] = event_type
|
||||
kwargs['extra_vars']['{}_webhook_event_guid'.format(name)] = event_guid
|
||||
kwargs['extra_vars']['{}_webhook_event_ref'.format(name)] = event_ref
|
||||
|
||||
Reference in New Issue
Block a user