mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -02:30
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:
@@ -907,6 +907,9 @@ function JobTemplatesEdit($scope, $rootScope, $compile, $location, $log, $routeP
|
|||||||
try {
|
try {
|
||||||
// Make sure we have valid variable data
|
// Make sure we have valid variable data
|
||||||
data.extra_vars = ToJSON($scope.parseType, $scope.variables, true);
|
data.extra_vars = ToJSON($scope.parseType, $scope.variables, true);
|
||||||
|
if(data.extra_vars === undefined ){
|
||||||
|
throw 'undefined variables';
|
||||||
|
}
|
||||||
for (fld in form.fields) {
|
for (fld in form.fields) {
|
||||||
if (form.fields[fld].type === 'select' && fld !== 'playbook') {
|
if (form.fields[fld].type === 'select' && fld !== 'playbook') {
|
||||||
data[fld] = $scope[fld].value;
|
data[fld] = $scope[fld].value;
|
||||||
|
|||||||
@@ -126,6 +126,15 @@ angular.module('VariablesHelper', ['Utilities'])
|
|||||||
// else
|
// else
|
||||||
json_data = jsyaml.load(variables);
|
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) {
|
catch(e) {
|
||||||
@@ -146,7 +155,7 @@ angular.module('VariablesHelper', ['Utilities'])
|
|||||||
result = json_data;
|
result = json_data;
|
||||||
if (stringify) {
|
if (stringify) {
|
||||||
if ($.isEmptyObject(json_data)) {
|
if ($.isEmptyObject(json_data)) {
|
||||||
result = "";
|
result = undefined;
|
||||||
} else {
|
} else {
|
||||||
result = JSON.stringify(json_data, undefined, '\t');
|
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
|
// We have a valid session token, so attempt socket connection
|
||||||
$log.debug('Socket connecting to: ' + url);
|
$log.debug('Socket connecting to: ' + url);
|
||||||
self.scope.socket_url = url;
|
self.scope.socket_url = url;
|
||||||
// handshakeData = {
|
|
||||||
// headers: {
|
|
||||||
// 'Authorization': 'Token ' + token,
|
|
||||||
// 'X-Auth-Token': 'Token ' + token
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
self.socket = io.connect(url, {
|
self.socket = io.connect(url, {
|
||||||
headers:
|
headers:
|
||||||
{
|
{
|
||||||
'Authorization': 'Token ' + token,
|
'Authorization': 'Token ' + token, // i don't think these are actually inserted into the header--jt
|
||||||
'X-Auth-Token': 'Token ' + token
|
'X-Auth-Token': 'Token ' + token
|
||||||
},
|
},
|
||||||
'connect timeout': 3000,
|
'connect timeout': 3000,
|
||||||
|
|||||||
Reference in New Issue
Block a user