mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 15:21:13 +03:00
Variable parsing
added a check for variables that are passed with double curly brackets '{{}}' and JT throws an error and doesn't save now
This commit is contained in:
parent
9e2571f853
commit
f4ac4a0bf9
@ -907,6 +907,9 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
|
||||
try {
|
||||
// Make sure we have valid variable data
|
||||
data.extra_vars = ToJSON($scope.parseType, $scope.variables, true);
|
||||
if(data.extra_vars === undefined ){
|
||||
throw 'undefined variables';
|
||||
}
|
||||
for (fld in form.fields) {
|
||||
if (form.fields[fld].type === 'select' && fld !== 'playbook') {
|
||||
data[fld] = $scope[fld].value;
|
||||
|
@ -126,6 +126,15 @@ angular.module('VariablesHelper', ['Utilities'])
|
||||
// else
|
||||
json_data = jsyaml.load(variables);
|
||||
|
||||
$.each( json_data, function( key, value ) {
|
||||
console.log( key + ": " + value );
|
||||
if(value.toString() === "[object Object]"){
|
||||
//$log.error('Failed to parse YAML string. Parser returned ' + key + ' : ' + value + '.');
|
||||
|
||||
throw 'Failed to parse YAML string. Parser returned ' + key + ' : ' + value + '.';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
catch(e) {
|
||||
@ -146,7 +155,7 @@ angular.module('VariablesHelper', ['Utilities'])
|
||||
result = json_data;
|
||||
if (stringify) {
|
||||
if ($.isEmptyObject(json_data)) {
|
||||
result = "";
|
||||
result = undefined;
|
||||
} else {
|
||||
result = JSON.stringify(json_data, undefined, '\t');
|
||||
}
|
||||
|
@ -71,17 +71,10 @@ angular.module('SocketIO', ['AuthService', 'Utilities'])
|
||||
// We have a valid session token, so attempt socket connection
|
||||
$log.debug('Socket connecting to: ' + url);
|
||||
self.scope.socket_url = url;
|
||||
// handshakeData = {
|
||||
// headers: {
|
||||
// 'Authorization': 'Token ' + token,
|
||||
// 'X-Auth-Token': 'Token ' + token
|
||||
// }
|
||||
// }
|
||||
|
||||
self.socket = io.connect(url, {
|
||||
headers:
|
||||
{
|
||||
'Authorization': 'Token ' + token,
|
||||
'Authorization': 'Token ' + token, // i don't think these are actually inserted into the header--jt
|
||||
'X-Auth-Token': 'Token ' + token
|
||||
},
|
||||
'connect timeout': 3000,
|
||||
|
Loading…
Reference in New Issue
Block a user