mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 07:17:40 -02:30
ToJSON fix
Expanded the list of things the ToJSON method can accept
This commit is contained in:
@@ -88,7 +88,7 @@ angular.module('VariablesHelper', ['Utilities'])
|
|||||||
if (parseType === 'json') {
|
if (parseType === 'json') {
|
||||||
try {
|
try {
|
||||||
// perform a check to see if the user cleared the field completly
|
// perform a check to see if the user cleared the field completly
|
||||||
if(variables === "" ){
|
if(variables.trim() === "" || variables.trim() === "{" || variables.trim() === "}" ){
|
||||||
variables = "{}";
|
variables = "{}";
|
||||||
}
|
}
|
||||||
//parse a JSON string
|
//parse a JSON string
|
||||||
@@ -104,10 +104,11 @@ angular.module('VariablesHelper', ['Utilities'])
|
|||||||
$log.error('Failed to parse JSON string. Parser returned: ' + e.message);
|
$log.error('Failed to parse JSON string. Parser returned: ' + e.message);
|
||||||
ProcessErrors(null, variables, e.message, null, { hdr: 'Error!',
|
ProcessErrors(null, variables, e.message, null, { hdr: 'Error!',
|
||||||
msg: 'Failed to parse JSON string. Parser returned: ' + e.message });
|
msg: 'Failed to parse JSON string. Parser returned: ' + e.message });
|
||||||
|
throw 'Parse error. Failed to parse variables.';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
if(variables === ""){
|
if(variables.trim() === "" || variables.trim() === "-" || variables.trim() === "--"){
|
||||||
variables = '---';
|
variables = '---';
|
||||||
}
|
}
|
||||||
json_data = jsyaml.load(variables);
|
json_data = jsyaml.load(variables);
|
||||||
|
|||||||
Reference in New Issue
Block a user