mirror of
https://github.com/ansible/awx.git
synced 2026-07-05 05:18:02 -02:30
Adding awx_task_env as wrapper while invoking backend
This commit is contained in:
@@ -172,6 +172,7 @@ from awx.api.views.root import ( # noqa
|
|||||||
)
|
)
|
||||||
from awx.api.views.webhooks import WebhookKeyView, GithubWebhookReceiver, GitlabWebhookReceiver # noqa
|
from awx.api.views.webhooks import WebhookKeyView, GithubWebhookReceiver, GitlabWebhookReceiver # noqa
|
||||||
from awx.api.pagination import UnifiedJobEventPagination
|
from awx.api.pagination import UnifiedJobEventPagination
|
||||||
|
from awx.main.utils import set_environ
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger('awx.api.views')
|
logger = logging.getLogger('awx.api.views')
|
||||||
@@ -1555,6 +1556,7 @@ class CredentialExternalTest(SubDetailAPIView):
|
|||||||
backend_kwargs[field_name] = value
|
backend_kwargs[field_name] = value
|
||||||
backend_kwargs.update(request.data.get('metadata', {}))
|
backend_kwargs.update(request.data.get('metadata', {}))
|
||||||
try:
|
try:
|
||||||
|
with set_environ(**settings.AWX_TASK_ENV):
|
||||||
obj.credential_type.plugin.backend(**backend_kwargs)
|
obj.credential_type.plugin.backend(**backend_kwargs)
|
||||||
return Response({}, status=status.HTTP_202_ACCEPTED)
|
return Response({}, status=status.HTTP_202_ACCEPTED)
|
||||||
except requests.exceptions.HTTPError as exc:
|
except requests.exceptions.HTTPError as exc:
|
||||||
|
|||||||
Reference in New Issue
Block a user