From 50372f9c3828a633b7a0bc35a32b9ef5a42bd460 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Thu, 18 Dec 2014 10:52:53 -0500 Subject: [PATCH] Prompt for credentials fixed prompt for credentials so that ssh and ssh key unlock were both accounted for --- awx/ui/static/js/helpers/JobSubmission.js | 50 +++++++++++++---------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/awx/ui/static/js/helpers/JobSubmission.js b/awx/ui/static/js/helpers/JobSubmission.js index 47ee634a0d..5e2883ccd3 100644 --- a/awx/ui/static/js/helpers/JobSubmission.js +++ b/awx/ui/static/js/helpers/JobSubmission.js @@ -757,29 +757,35 @@ function($location, Wait, GetBasePath, LookUpInit, JobTemplateForm, CredentialLi Rest.setUrl(GetBasePath('credentials')+credential); Rest.get() .success(function (data) { - if((data.kind === "ssh" && data.password === "ASK" ) || data.ssh_key_unlock === "ASK"){ - passwords.push("ssh_password"); + if(data.kind === "ssh"){ + if(data.password === "ASK" ){ + passwords.push("ssh_password"); + } + if(data.ssh_key_unlock === "ASK"){ + passwords.push("ssh_key_unlock"); + } + 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.passwords_needed_to_start = passwords; + scope.$emit('PromptForPasswords', passwords, html, url); + } + else if (scope.ask_variables_on_launch){ + scope.$emit('PromptForVars', html, url); + } + else if (!Empty(scope.survey_enabled) && scope.survey_enabled===true) { + scope.$emit('PromptForSurvey', html, url); + } + else scope.$emit('StartPlaybookRun', url); } - 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.passwords_needed_to_start = passwords; - scope.$emit('PromptForPasswords', passwords, html, url); - } - else if (scope.ask_variables_on_launch){ - scope.$emit('PromptForVars', html, url); - } - else if (!Empty(scope.survey_enabled) && scope.survey_enabled===true) { - scope.$emit('PromptForSurvey', html, url); - } - else scope.$emit('StartPlaybookRun', url); + }) .error(function (data, status) { ProcessErrors(scope, data, status, null, { hdr: 'Error!',