Adjusted Variable parsing

had to change variable parsing to a nested variable object but to not accept something like : "jenkins_uri: {{ ansible_ssh_host }}"
This commit is contained in:
Jared Tabor 2015-01-12 14:20:41 -05:00
parent a5bc796518
commit 8e8a125776

View File

@ -111,15 +111,18 @@ angular.module('VariablesHelper', ['Utilities'])
if(variables.trim() === "" || variables.trim() === "-" || variables.trim() === "--"){
variables = '---';
}
json_data = jsyaml.load(variables);
json_data = jsyaml.safeLoad(variables);
if(json_data!==null){
$.each( json_data, function( key, value ) {
// console.log( key + ": " + value );
if(value.toString() === "[object Object]"){
json_data = undefined;
throw 'Failed to parse YAML string. Parser returned ' + key + ' : ' + value + '.';
}
});
// $.each( json_data, function( key, value ) {
// if(value.toString() === "[object Object]"){
// json_data = undefined;
// throw 'Failed to parse YAML string. Parser returned ' + key + ' : ' + value + '.';
// }
// });
var tmp = jsyaml.dump(json_data);
if(tmp.indexOf('[object Object]')!==-1){
throw "Failed to parse YAML string. Parser returned' + key + ' : ' +value + '.' ";
}
}
}
catch(e) {
@ -132,7 +135,7 @@ angular.module('VariablesHelper', ['Utilities'])
// Make sure our JSON is actually an object
if (typeof json_data !== 'object') {
ProcessErrors(null, variables, null, null, { hdr: 'Error!',
msg: 'Failed to parse variables. Attempted to parse ' + parseType + ' Parser did not return an object.' });
msg: 'Failed to parse variables. Attempted to parse ' + parseType + '. Parser did not return an object.' });
// setTimeout( function() {
throw 'Parse error. Failed to parse variables.';
// }, 1000);