From 0721972ac6b768b5e8bfbd807a64039bdbce2d3d Mon Sep 17 00:00:00 2001 From: wmlloyd <94763459+wmlloyd@users.noreply.github.com> Date: Mon, 22 Nov 2021 11:53:17 -0800 Subject: [PATCH] Update config.js For supportability write config, both as declared and saved, to /var/config/rest/iapps/f5-telemetry/telemetry_declaration.txt as formatted json. --- src/lib/config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/config.js b/src/lib/config.js index f473232c..36e33318 100644 --- a/src/lib/config.js +++ b/src/lib/config.js @@ -188,6 +188,11 @@ class ConfigWorker extends SafeEventEmitter { * @returns {Promise} resolved with copy of validated declaration resolved on success */ processDeclaration(declaration, options) { + + //save declaration to save in support config file + const declaration_as_submitted=JSON.stringify(declaration,null,2); + //fs required to save support config file + const fs = require('fs'); const setConfigOpts = {}; const storageData = util.deepCopy(BASE_STORAGE_DATA); let expandedConfig = {}; @@ -222,7 +227,12 @@ class ConfigWorker extends SafeEventEmitter { this.currentConfig ); } + + // write config as declared and saved to /var/config/rest/iapps/f5-telemetry/telemetry_declaration.txt + fs.writeFile("/var/config/rest/iapps/f5-telemetry/telemetry_declaration.txt", "\nAs declared:\n"+declaration_as_submitted+"\n\nAs saved:\n"+JSON.stringify(storageData,null,2)+"\n\n"); + // normalize the whole config, will generate new UUIDs + return configUtil.normalizeDeclaration(expandedConfig); }) .then((conf) => {