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

Check to make sure vm.promptData.launchConf.passwords_needed_to_start exists before looping

This commit is contained in:
mabashian 2018-04-11 11:09:01 -04:00
parent 0459043b8e
commit 3dd9ca3fb6

View File

@ -67,31 +67,33 @@ export default [ 'Rest', 'GetBasePath', 'ProcessErrors', 'CredentialTypeModel',
vm.promptData.prompts.credentials.passwords = {}; vm.promptData.prompts.credentials.passwords = {};
vm.promptData.launchConf.passwords_needed_to_start.forEach((passwordNeeded) => { if(vm.promptData.launchConf.passwords_needed_to_start) {
if(passwordNeeded === "ssh_password") { vm.promptData.launchConf.passwords_needed_to_start.forEach((passwordNeeded) => {
vm.promptData.prompts.credentials.passwords.ssh = {}; if(passwordNeeded === "ssh_password") {
} vm.promptData.prompts.credentials.passwords.ssh = {};
if(passwordNeeded === "become_password") {
vm.promptData.prompts.credentials.passwords.become = {};
}
if(passwordNeeded === "ssh_key_unlock") {
vm.promptData.prompts.credentials.passwords.ssh_key_unlock = {};
}
if(passwordNeeded.startsWith("vault_password")) {
let vault_id;
if(passwordNeeded.includes('.')) {
vault_id = passwordNeeded.split(/\.(.+)/)[1];
} }
if(passwordNeeded === "become_password") {
if(!vm.promptData.prompts.credentials.passwords.vault) { vm.promptData.prompts.credentials.passwords.become = {};
vm.promptData.prompts.credentials.passwords.vault = [];
} }
if(passwordNeeded === "ssh_key_unlock") {
vm.promptData.prompts.credentials.passwords.ssh_key_unlock = {};
}
if(passwordNeeded.startsWith("vault_password")) {
let vault_id;
if(passwordNeeded.includes('.')) {
vault_id = passwordNeeded.split(/\.(.+)/)[1];
}
vm.promptData.prompts.credentials.passwords.vault.push({ if(!vm.promptData.prompts.credentials.passwords.vault) {
vault_id: vault_id vm.promptData.prompts.credentials.passwords.vault = [];
}); }
}
}); vm.promptData.prompts.credentials.passwords.vault.push({
vault_id: vault_id
});
}
});
}
vm.promptData.credentialTypeMissing = []; vm.promptData.credentialTypeMissing = [];