mirror of
https://github.com/ansible/awx.git
synced 2026-02-25 15:06:02 -03:30
Merge pull request #4459 from chrismeyersfsu/fix-4358
filter out ansible_* facts from provision callback extra_vars
This commit is contained in:
@@ -65,6 +65,9 @@ from awx.api.generics import * # noqa
|
|||||||
from awx.conf.license import get_license, feature_enabled, feature_exists, LicenseForbids
|
from awx.conf.license import get_license, feature_enabled, feature_exists, LicenseForbids
|
||||||
from awx.main.models import * # noqa
|
from awx.main.models import * # noqa
|
||||||
from awx.main.utils import * # noqa
|
from awx.main.utils import * # noqa
|
||||||
|
from awx.main.utils import (
|
||||||
|
callback_filter_out_ansible_extra_vars
|
||||||
|
)
|
||||||
from awx.api.permissions import * # noqa
|
from awx.api.permissions import * # noqa
|
||||||
from awx.api.renderers import * # noqa
|
from awx.api.renderers import * # noqa
|
||||||
from awx.api.serializers import * # noqa
|
from awx.api.serializers import * # noqa
|
||||||
@@ -2663,7 +2666,7 @@ class JobTemplateCallback(GenericAPIView):
|
|||||||
# Send a signal to celery that the job should be started.
|
# Send a signal to celery that the job should be started.
|
||||||
kv = {"inventory_sources_already_updated": inventory_sources_already_updated}
|
kv = {"inventory_sources_already_updated": inventory_sources_already_updated}
|
||||||
if extra_vars is not None:
|
if extra_vars is not None:
|
||||||
kv['extra_vars'] = extra_vars
|
kv['extra_vars'] = callback_filter_out_ansible_extra_vars(extra_vars)
|
||||||
result = job.signal_start(**kv)
|
result = job.signal_start(**kv)
|
||||||
if not result:
|
if not result:
|
||||||
data = dict(msg=_('Error starting job!'))
|
data = dict(msg=_('Error starting job!'))
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ __all__ = ['get_object_or_400', 'get_object_or_403', 'camelcase_to_underscore',
|
|||||||
'copy_m2m_relationships' ,'cache_list_capabilities', 'to_python_boolean',
|
'copy_m2m_relationships' ,'cache_list_capabilities', 'to_python_boolean',
|
||||||
'ignore_inventory_computed_fields', 'ignore_inventory_group_removal',
|
'ignore_inventory_computed_fields', 'ignore_inventory_group_removal',
|
||||||
'_inventory_updates', 'get_pk_from_dict', 'getattrd', 'NoDefaultProvided',
|
'_inventory_updates', 'get_pk_from_dict', 'getattrd', 'NoDefaultProvided',
|
||||||
'get_current_apps', 'set_current_apps', 'OutputEventFilter']
|
'get_current_apps', 'set_current_apps', 'OutputEventFilter',
|
||||||
|
'callback_filter_out_ansible_extra_vars',]
|
||||||
|
|
||||||
|
|
||||||
def get_object_or_400(klass, *args, **kwargs):
|
def get_object_or_400(klass, *args, **kwargs):
|
||||||
@@ -824,3 +825,12 @@ class OutputEventFilter(object):
|
|||||||
self._current_event_data = next_event_data
|
self._current_event_data = next_event_data
|
||||||
else:
|
else:
|
||||||
self._current_event_data = None
|
self._current_event_data = None
|
||||||
|
|
||||||
|
|
||||||
|
def callback_filter_out_ansible_extra_vars(extra_vars):
|
||||||
|
extra_vars_redacted = {}
|
||||||
|
for key, value in extra_vars.iteritems():
|
||||||
|
if not key.startswith('ansible_'):
|
||||||
|
extra_vars_redacted[key] = value
|
||||||
|
return extra_vars_redacted
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user