mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 02:47:35 -02:30
send the yaml extra vars in raw form to the backend
This commit is contained in:
@@ -35,11 +35,12 @@ angular.module('VariablesHelper', ['Utilities'])
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
$log.info('Attempt to parse extra_vars as JSON failed. Attempting to parse as YAML');
|
$log.info('Attempt to parse extra_vars as JSON failed. Send the yaml from the backend');
|
||||||
try {
|
try {
|
||||||
|
// do safeLoad, which well error if not valid yaml
|
||||||
json_obj = jsyaml.safeLoad(variables);
|
json_obj = jsyaml.safeLoad(variables);
|
||||||
json_obj = SortVariables(json_obj);
|
// but just send the variables
|
||||||
result = jsyaml.safeDump(json_obj);
|
result = variables;
|
||||||
}
|
}
|
||||||
catch(e2) {
|
catch(e2) {
|
||||||
ProcessErrors(null, variables, e2.message, null, { hdr: 'Error!',
|
ProcessErrors(null, variables, e2.message, null, { hdr: 'Error!',
|
||||||
@@ -114,12 +115,7 @@ angular.module('VariablesHelper', ['Utilities'])
|
|||||||
}
|
}
|
||||||
json_data = jsyaml.safeLoad(variables);
|
json_data = jsyaml.safeLoad(variables);
|
||||||
if(json_data!==null){
|
if(json_data!==null){
|
||||||
// $.each( json_data, function( key, value ) {
|
// unparsing just to make sure no weird characters are included.
|
||||||
// if(value.toString() === "[object Object]"){
|
|
||||||
// json_data = undefined;
|
|
||||||
// throw 'Failed to parse YAML string. Parser returned ' + key + ' : ' + value + '.';
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
tmp = jsyaml.dump(json_data);
|
tmp = jsyaml.dump(json_data);
|
||||||
if(tmp.indexOf('[object Object]')!==-1){
|
if(tmp.indexOf('[object Object]')!==-1){
|
||||||
throw "Failed to parse YAML string. Parser returned' + key + ' : ' +value + '.' ";
|
throw "Failed to parse YAML string. Parser returned' + key + ' : ' +value + '.' ";
|
||||||
@@ -149,7 +145,9 @@ angular.module('VariablesHelper', ['Utilities'])
|
|||||||
else if ($.isEmptyObject(json_data)) {
|
else if ($.isEmptyObject(json_data)) {
|
||||||
result = "";
|
result = "";
|
||||||
} else {
|
} else {
|
||||||
result = JSON.stringify(json_data, undefined, '\t');
|
// utilize the parsing to get here
|
||||||
|
// but send the raw variable string
|
||||||
|
result = variables;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -178,31 +176,3 @@ angular.module('VariablesHelper', ['Utilities'])
|
|||||||
return newObj;
|
return newObj;
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user