diff --git a/awx/api/serializers.py b/awx/api/serializers.py index 7348769628..6d6d18ebe6 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -1233,10 +1233,11 @@ class JobTemplateSerializer(UnifiedJobTemplateSerializer, JobOptionsSerializer): class JobSerializer(UnifiedJobSerializer, JobOptionsSerializer): passwords_needed_to_start = serializers.Field(source='passwords_needed_to_start') + vars_prompt_on_launch = serializers.Field(source='vars_prompt_on_launch') class Meta: model = Job - fields = ('*', 'job_template', 'passwords_needed_to_start') + fields = ('*', 'job_template', 'passwords_needed_to_start', 'vars_prompt_on_launch') def get_related(self, obj): res = super(JobSerializer, self).get_related(obj) diff --git a/awx/api/views.py b/awx/api/views.py index a2a62b7cb9..cd516e8087 100644 --- a/awx/api/views.py +++ b/awx/api/views.py @@ -1301,6 +1301,7 @@ class JobStart(GenericAPIView): ) if obj.can_start: data['passwords_needed_to_start'] = obj.passwords_needed_to_start + data['vars_prompt_on_launch'] = obj.vars_prompt_on_launch return Response(data) def post(self, request, *args, **kwargs): diff --git a/awx/main/models/jobs.py b/awx/main/models/jobs.py index afdfbf658c..063101ada5 100644 --- a/awx/main/models/jobs.py +++ b/awx/main/models/jobs.py @@ -230,6 +230,10 @@ class Job(UnifiedJob, JobOptions): h = hmac.new(settings.SECRET_KEY, self.created.isoformat()) return '%d-%s' % (self.pk, h.hexdigest()) + @property + def vars_prompt_on_launch(self): + return self.job_template.vars_prompt_on_launch + @property def passwords_needed_to_start(self): '''Return list of password field names needed to start the job.'''