-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7638 from romayalon/romy-fix-system-json
NSFS | NC | Update system.json structure + small redirect fix
- Loading branch information
Showing
6 changed files
with
84 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,10 @@ dbg.original_console(); | |
|
||
const config = require('../../config'); | ||
|
||
const os = require('os'); | ||
const fs = require('fs'); | ||
const util = require('util'); | ||
const minimist = require('minimist'); | ||
const native_fs_utils = require('../util/native_fs_utils'); | ||
|
||
if (process.env.LOCAL_MD_SERVER === 'true') { | ||
require('../server/system_services/system_store').get_instance({ standalone: true }); | ||
|
@@ -205,17 +205,20 @@ async function init_nsfs_system(config_root) { | |
const system_data = new json_utils.JsonFileWrapper(system_data_path); | ||
|
||
const data = await system_data.read(); | ||
|
||
const hostname = os.hostname(); | ||
// If the system data already exists, we should not create it again | ||
if (data.current_version) return; | ||
if (data?.[hostname]?.current_version) return; | ||
|
||
try { | ||
await system_data.update({ | ||
current_version: pkg.version, | ||
upgrade_history: { | ||
successful_upgrades: [], | ||
last_failure: undefined | ||
}, | ||
...data, | ||
[hostname]: { | ||
current_version: pkg.version, | ||
upgrade_history: { | ||
successful_upgrades: [], | ||
last_failure: undefined | ||
} | ||
} | ||
}); | ||
console.log('created NSFS system data with version: ', pkg.version); | ||
} catch (err) { | ||
|
@@ -240,7 +243,16 @@ async function main(argv = minimist(process.argv.slice(2))) { | |
console.log(JSON.stringify(IAM_JSON_SCHEMA.schema, null, 2)); | ||
return; | ||
} | ||
|
||
const simple_mode = Boolean(argv.simple); | ||
if (!simple_mode) { | ||
nsfs_config_root = config.NSFS_NC_CONF_DIR; | ||
if (argv.config_root) { | ||
nsfs_config_root = String(argv.config_root); | ||
config.NSFS_NC_CONF_DIR = nsfs_config_root; | ||
require('../../config').load_nsfs_nc_config(); | ||
require('../../config').reload_nsfs_nc_config(); | ||
} | ||
} | ||
const http_port = Number(argv.http_port) || config.ENDPOINT_PORT; | ||
const https_port = Number(argv.https_port) || config.ENDPOINT_SSL_PORT; | ||
const https_port_sts = Number(argv.https_port_sts) || config.ENDPOINT_SSL_STS_PORT; | ||
|
@@ -250,7 +262,6 @@ async function main(argv = minimist(process.argv.slice(2))) { | |
const gid = Number(argv.gid) || process.getgid(); | ||
const access_key = argv.access_key && new SensitiveString(String(argv.access_key)); | ||
const secret_key = argv.secret_key && new SensitiveString(String(argv.secret_key)); | ||
const simple_mode = Boolean(argv.simple); | ||
const iam_ttl = Number(argv.iam_ttl ?? 60); | ||
const backend = argv.backend || (process.env.GPFS_DL_PATH ? 'GPFS' : ''); | ||
const versioning = argv.versioning || 'DISABLED'; | ||
|
@@ -263,11 +274,6 @@ async function main(argv = minimist(process.argv.slice(2))) { | |
warn_threshold_ms: config.NSFS_WARN_THRESHOLD_MS, | ||
}; | ||
verify_gpfslib(); | ||
|
||
if (!simple_mode) { | ||
nsfs_config_root = await native_fs_utils.get_config_root(argv, fs_config); | ||
config.NSFS_NC_CONF_DIR = nsfs_config_root; | ||
} | ||
const account = { | ||
email: new SensitiveString('[email protected]'), | ||
nsfs_account_config: fs_config, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters