1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

Fixed bug where vault password prompt was not being hidden after removing default credential

This commit is contained in:
mabashian 2018-04-23 12:26:07 -04:00
parent 4b4bbcebae
commit 19ef91f2aa
2 changed files with 20 additions and 12 deletions

View File

@ -53,7 +53,7 @@ function atLaunchTemplateCtrl (
launchConf: launchData.data,
launchOptions: launchOptions.data
}),
triggerModalOpen: true,
triggerModalOpen: true
};
if (launchData.data.survey_enabled) {

View File

@ -70,29 +70,37 @@ export default [ 'Rest', 'GetBasePath', 'ProcessErrors', 'CredentialTypeModel',
vm.promptDataClone.prompts.credentials.passwords = {};
if(vm.promptData.launchConf.passwords_needed_to_start) {
vm.promptData.launchConf.passwords_needed_to_start.forEach((passwordNeeded) => {
if(vm.promptDataClone.launchConf.passwords_needed_to_start) {
vm.promptDataClone.launchConf.passwords_needed_to_start.forEach((passwordNeeded) => {
if(passwordNeeded === "ssh_password") {
vm.promptData.prompts.credentials.passwords.ssh = {};
vm.promptDataClone.prompts.credentials.passwords.ssh = {};
}
if(passwordNeeded === "become_password") {
vm.promptData.prompts.credentials.passwords.become = {};
vm.promptDataClone.prompts.credentials.passwords.become = {};
}
if(passwordNeeded === "ssh_key_unlock") {
vm.promptData.prompts.credentials.passwords.ssh_key_unlock = {};
vm.promptDataClone.prompts.credentials.passwords.ssh_key_unlock = {};
}
if(passwordNeeded.startsWith("vault_password")) {
let vault_id;
if(passwordNeeded.includes('.')) {
let vault_id = null;
if (passwordNeeded.includes('.')) {
vault_id = passwordNeeded.split(/\.(.+)/)[1];
}
if(!vm.promptData.prompts.credentials.passwords.vault) {
vm.promptData.prompts.credentials.passwords.vault = [];
if (!vm.promptDataClone.prompts.credentials.passwords.vault) {
vm.promptDataClone.prompts.credentials.passwords.vault = [];
}
vm.promptData.prompts.credentials.passwords.vault.push({
vault_id: vault_id
// Loop across the default credentials to find the name of the
// credential that requires a password
vm.promptDataClone.prompts.credentials.value.forEach((defaultCredential) => {
if (defaultCredential.vault_id === vault_id) {
vm.promptDataClone.prompts.credentials.passwords.vault.push({
id: defaultCredential.id,
name: defaultCredential.name,
vault_id: defaultCredential.vault_id
});
}
});
}
});