Skip to content

Commit

Permalink
Replace yamljs with yaml
Browse files Browse the repository at this point in the history
Replace yamljs with yaml

Signed-off-by: liranmauda <liran.mauda@gmail.com>
  • Loading branch information
liranmauda committed Jul 1, 2024
1 parent ec7a200 commit 69e7537
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 34 deletions.
33 changes: 9 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -145,4 +145,4 @@
"sinon": "18.0.0",
"wtfnode": "0.9.2"
}
}
}
14 changes: 7 additions & 7 deletions src/server/system_services/pool_controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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}`;
}
Expand Down Expand Up @@ -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}`;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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}`;
Expand Down
2 changes: 1 addition & 1 deletion src/util/yaml_utils.js
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 69e7537

Please sign in to comment.