1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

fill in extra_vars to content box even if ask_for_vars false and survey enabled

This commit is contained in:
AlanCoding 2016-04-15 14:59:20 -04:00
parent d196024155
commit e0bd906de8

View File

@ -2082,18 +2082,19 @@ class JobTemplateLaunch(RetrieveAPIView, GenericAPIView):
def update_raw_data(self, data):
obj = self.get_object()
extra_vars = data.get('extra_vars') or {}
extra_vars = data.pop('extra_vars', None) or {}
if obj:
for p in obj.passwords_needed_to_start:
data[p] = u''
for v in obj.variables_needed_to_start:
extra_vars.setdefault(v, u'')
if extra_vars:
data['extra_vars'] = extra_vars
ask_for_vars_dict = obj._ask_for_vars_dict()
ask_for_vars_dict.pop('extra_vars')
for field in ask_for_vars_dict:
if not ask_for_vars_dict[field]:
data.pop(field, None)
elif field == 'extra_vars':
data[field] = extra_vars
elif field == 'inventory' or field == 'credential':
data[field] = getattrd(obj, "%s.%s" % (field, 'id'), None)
else: