diff --git a/package-lock.json b/package-lock.json index 757721eb2d..5857058a1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -60,7 +60,7 @@ "uuid": "10.0.0", "ws": "8.17.1", "xml2js": "0.6.2", - "yamljs": "0.3.0", + "yaml": "2.4.5", "yauzl": "3.1.3", "yazl": "2.5.1" }, @@ -11679,32 +11679,17 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true }, - "node_modules/yamljs": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/yamljs/-/yamljs-0.3.0.tgz", - "integrity": "sha512-C/FsVVhht4iPQYXOInoxUM/1ELSf9EsgKH34FofQOp6hwCPrW4vG4w5++TED3xRUo8gD7l0P1J1dLlDYzODsTQ==", - "dependencies": { - "argparse": "^1.0.7", - "glob": "^7.0.5" - }, + "node_modules/yaml": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.5.tgz", + "integrity": "sha512-aBx2bnqDzVOyNKfsysjA2ms5ZlnjSAW2eG3/L5G/CSujfjLJTJsEw1bGw8kCf04KodQWk1pxlGnZ56CRxiawmg==", "bin": { - "json2yaml": "bin/json2yaml", - "yaml2json": "bin/yaml2json" - } - }, - "node_modules/yamljs/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dependencies": { - "sprintf-js": "~1.0.2" + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" } }, - "node_modules/yamljs/node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" - }, "node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", diff --git a/package.json b/package.json index 9fd65f124b..88f72269b7 100644 --- a/package.json +++ b/package.json @@ -121,7 +121,7 @@ "uuid": "10.0.0", "ws": "8.17.1", "xml2js": "0.6.2", - "yamljs": "0.3.0", + "yaml": "2.4.5", "yauzl": "3.1.3", "yazl": "2.5.1" }, @@ -145,4 +145,4 @@ "sinon": "18.0.0", "wtfnode": "0.9.2" } -} \ No newline at end of file +} diff --git a/src/server/system_services/pool_controllers.js b/src/server/system_services/pool_controllers.js index 45b19cb2d7..5b8641edcd 100644 --- a/src/server/system_services/pool_controllers.js +++ b/src/server/system_services/pool_controllers.js @@ -6,7 +6,7 @@ const path = require('path'); const fs = require('fs'); const dbg = require('../../util/debug_module')(__filename); const { KubeStore } = require('../kube-store.js'); -const yaml = require('yamljs'); +const yaml = require('yaml'); const Agent = require('../../agent/agent'); const { v4: uuid } = require('uuid'); const js_utils = require('../../util/js_utils'); @@ -69,8 +69,8 @@ class ManagedStatefulSetPoolController extends PoolController { await KubeStore.instance.create_secret(secret_k8s_conf); await KubeStore.instance.create_backingstore(pool_k8s_conf); - const secret_yaml = yaml.stringify(secret_k8s_conf, 6, 2); - const backstore_yaml = yaml.stringify(pool_k8s_conf, 6, 2); + const secret_yaml = yaml.stringify(secret_k8s_conf, { indent: 2 }); + const backstore_yaml = yaml.stringify(pool_k8s_conf, { indent: 2 }); return `${secret_yaml}---\n${backstore_yaml}`; } @@ -130,8 +130,8 @@ class UnmanagedStatefulSetPoolController extends PoolController { agent_count, ...agent_profile }); - const secret_yaml = yaml.stringify(secret_k8s_conf, 6, 2); - const backstore_yaml = yaml.stringify(pool_k8s_conf, 6, 2); + const secret_yaml = yaml.stringify(secret_k8s_conf, { indent: 2 }); + const backstore_yaml = yaml.stringify(pool_k8s_conf, { indent: 2 }); return `${secret_yaml}---\n${backstore_yaml}`; } @@ -234,7 +234,7 @@ class InProcessAgentsPoolController extends PoolController { async function _get_k8s_conf(params) { const yaml_path = path.resolve(__dirname, '../../deploy/NVA_build/noobaa_pool.yaml'); const yaml_file = (await fs.promises.readFile(yaml_path)).toString(); - const backingstore = await yaml.parse(yaml_file); + const backingstore = yaml.parse(yaml_file); // Update the template the given configuration. backingstore.metadata.name = params.pool_name; @@ -258,7 +258,7 @@ async function _get_k8s_conf(params) { async function _get_k8s_secret(params) { const yaml_path = path.resolve(__dirname, '../../deploy/NVA_build/noobaa_pool_secret.yaml'); const yaml_file = (await fs.promises.readFile(yaml_path)).toString(); - const secret = await yaml.parse(yaml_file); + const secret = yaml.parse(yaml_file); // Update the template the given configuration. secret.metadata.name = `backing-store-pv-pool-${params.pool_name}`; diff --git a/src/util/yaml_utils.js b/src/util/yaml_utils.js index 0606e4b611..5de197244b 100644 --- a/src/util/yaml_utils.js +++ b/src/util/yaml_utils.js @@ -1,7 +1,7 @@ /* Copyright (C) 2016 NooBaa */ 'use strict'; -const yaml = require('yamljs'); +const yaml = require('yaml'); function parse(yaml_string, forceListResult = false) { const docs = yaml_string.split(/\n\s*---\s*\n/g)