From e0bd906de885c7e138c79018c8b9f0948655b14d Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Fri, 15 Apr 2016 14:59:20 -0400 Subject: [PATCH] fill in extra_vars to content box even if ask_for_vars false and survey enabled --- awx/api/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/awx/api/views.py b/awx/api/views.py index a3ba16f9bb..2538035410 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -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: