mirror of
https://github.com/Telecominfraproject/ols-ucentral-schema.git
synced 2025-11-01 10:37:48 +00:00
schema: fix log generation
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
@@ -17,12 +17,15 @@ inputfile.close();
|
|||||||
let logs = [];
|
let logs = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let batch = renderer.render(schemareader.validate(inputjson), logs);
|
let state = schemareader.validate(inputjson, logs);
|
||||||
|
|
||||||
|
let batch = state ? renderer.render(state, logs) : "";
|
||||||
|
|
||||||
fs.stdout.write("Log messages:\n" + join("\n", logs) + "\n\n");
|
fs.stdout.write("Log messages:\n" + join("\n", logs) + "\n\n");
|
||||||
|
|
||||||
fs.stdout.write("UCI batch output:\n" + batch + "\n");
|
fs.stdout.write("UCI batch output:\n" + batch + "\n");
|
||||||
|
|
||||||
|
if (state) {
|
||||||
let outputjson = fs.open("/tmp/ucentral.uci", "w");
|
let outputjson = fs.open("/tmp/ucentral.uci", "w");
|
||||||
outputjson.write(batch);
|
outputjson.write(batch);
|
||||||
outputjson.close();
|
outputjson.close();
|
||||||
@@ -43,7 +46,9 @@ try {
|
|||||||
|
|
||||||
fs.unlink('/etc/ucentral/ucentral.active');
|
fs.unlink('/etc/ucentral/ucentral.active');
|
||||||
fs.symlink(ARGV[2], '/etc/ucentral/ucentral.active');
|
fs.symlink(ARGV[2], '/etc/ucentral/ucentral.active');
|
||||||
|
} else {
|
||||||
|
error = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
error = 1;
|
error = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user