diff --git a/awx/ui/static/js/helpers/JobSubmission.js b/awx/ui/static/js/helpers/JobSubmission.js index 80671750b4..d1efb3aac5 100644 --- a/awx/ui/static/js/helpers/JobSubmission.js +++ b/awx/ui/static/js/helpers/JobSubmission.js @@ -90,7 +90,8 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi field: 'credential', hdr: 'Credential Required', instructions: "Launching this job requires a machine credential. Please select your machine credential now or Cancel to quit.", - postAction: selectionMade + postAction: selectionMade, + input_type: 'radio' }); scope.lookUpCredential(); }); @@ -674,7 +675,6 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi system_job = params.system_job || false, base = $location.path().replace(/^\//, '').split('/')[0], url, - job_template, extra_vars, new_job_id, launch_url, @@ -813,10 +813,34 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi scope.removeCredentialReady(); } scope.removeCredentialReady = scope.$on('CredentialReady', function(e, credential) { + var passwords = []; if (!Empty(credential)) { - job_template.credential = credential; - scope.$emit('PostTheJob'); + Rest.setUrl(GetBasePath('credentials')+credential); + Rest.get() + .success(function (data) { + if(data.ssh_key_unlock === "ASK"){ + passwords.push("ssh_password"); + } + if(data.sudo_password === "ASK"){ + passwords.push("sudo_password"); + } + if(data.su_password === "ASK"){ + passwords.push("su_password"); + } + if(data.vault_password === "ASK"){ + passwords.push("vault_password"); + } + if(passwords.length>0){ + scope.$emit('PromptForPasswords', passwords, html, url); + } + else scope.$emit('StartPlaybookRun', url); + }) + .error(function (data, status) { + ProcessErrors(scope, data, status, null, { hdr: 'Error!', + msg: 'Failed to get job template details. GET returned status: ' + status }); + }); } + }); // Get the job or job_template record @@ -831,14 +855,18 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi // scope.extra_vars = data.variables_needed_to_start; scope.survey_enabled = data.survey_enabled; - // new_job = data; - html = '