mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 03:17:39 -02:30
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:
@@ -111,15 +111,18 @@ angular.module('VariablesHelper', ['Utilities'])
|
|||||||
if(variables.trim() === "" || variables.trim() === "-" || variables.trim() === "--"){
|
if(variables.trim() === "" || variables.trim() === "-" || variables.trim() === "--"){
|
||||||
variables = '---';
|
variables = '---';
|
||||||
}
|
}
|
||||||
json_data = jsyaml.load(variables);
|
json_data = jsyaml.safeLoad(variables);
|
||||||
if(json_data!==null){
|
if(json_data!==null){
|
||||||
$.each( json_data, function( key, value ) {
|
// $.each( json_data, function( key, value ) {
|
||||||
// console.log( key + ": " + value );
|
// if(value.toString() === "[object Object]"){
|
||||||
if(value.toString() === "[object Object]"){
|
// json_data = undefined;
|
||||||
json_data = undefined;
|
// throw 'Failed to parse YAML string. Parser returned ' + key + ' : ' + value + '.';
|
||||||
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) {
|
catch(e) {
|
||||||
@@ -132,7 +135,7 @@ angular.module('VariablesHelper', ['Utilities'])
|
|||||||
// Make sure our JSON is actually an object
|
// Make sure our JSON is actually an object
|
||||||
if (typeof json_data !== 'object') {
|
if (typeof json_data !== 'object') {
|
||||||
ProcessErrors(null, variables, null, null, { hdr: 'Error!',
|
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() {
|
// setTimeout( function() {
|
||||||
throw 'Parse error. Failed to parse variables.';
|
throw 'Parse error. Failed to parse variables.';
|
||||||
// }, 1000);
|
// }, 1000);
|
||||||
|
|||||||
Reference in New Issue
Block a user