Skip to content

Commit

Permalink
fix the name in the logs, move the comment
Browse files Browse the repository at this point in the history
Signed-off-by: shirady <[email protected]>
  • Loading branch information
shirady committed Jan 6, 2025
1 parent 4c9bd54 commit d38faac
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/sdk/config_fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,6 @@ class ConfigFS {

/**
* get_identity_by_id_and_stat_file returns the full account/user data and stat the file:
* 1. try by identity path
* 2. if not found - try by account name with new accounts path
* 3. if not found - try by account name with old accounts path
* silent_if_missing is used only on get identity (if stat fails, it will throw an error)
* @param {string} id
* @param {string} [type]
* @param {{show_secrets?: boolean, decrypt_secret_key?: boolean, silent_if_missing?: boolean}} [options]
Expand Down Expand Up @@ -497,6 +493,9 @@ class ConfigFS {

/**
* stat_account_config_file_by_identity will return the stat output on account config file by id or by account name
* 1. try by identity path
* 2. if not found - try by account name with new accounts path
* 3. if not found - try by account name with old accounts path
* @param {string} id
* @param {string} account_name
* @returns {Promise<nb.NativeFSStats>}
Expand All @@ -509,30 +508,30 @@ class ConfigFS {
return stat_by_identity_path;
} catch (err) {
if (err.code !== 'ENOENT') {
dbg.error('get_identity_by_id_and_stat_file: could not stat by identity ID, got an error', err);
dbg.error('stat_account_config_file_by_identity: could not stat by identity ID, got an error', err);
throw err;
}
}
// stat by account name (new path)
dbg.log2('get_identity_by_id_and_stat_file: will try to stat by account name (new accounts path)');
dbg.log2('stat_account_config_file_by_identity: will try to stat by account name (new accounts path)');
const account_name_new_path = this.get_account_path_by_name(account_name);
try {
const stat_by_account_name = await nb_native().fs.stat(this.fs_context, account_name_new_path);
return stat_by_account_name;
} catch (err) {
if (err.code !== 'ENOENT') {
dbg.error('get_identity_by_id_and_stat_file: could not stat by iby account name (new accounts path), got an error', err);
dbg.error('stat_account_config_file_by_identity: could not stat by iby account name (new accounts path), got an error', err);
throw err;
}
}
// stat by account name (old path)
dbg.log2('get_identity_by_id_and_stat_file: will try to stat by account name (old accounts path)');
dbg.log2('stat_account_config_file_by_identity: will try to stat by account name (old accounts path)');
const account_name_old_path = this._get_old_account_path_by_name(account_name);
try {
const stat_by_account_name_old = await nb_native().fs.stat(this.fs_context, account_name_old_path);
return stat_by_account_name_old;
} catch (err) {
dbg.error(`get_identity_by_id_and_stat_file: could not stat identity by id ${id} or by account name ${account_name} (new and old accounts path)`);
dbg.error(`stat_account_config_file_by_identity: could not stat identity by id ${id} or by account name ${account_name} (new and old accounts path)`);
throw err;
}
}
Expand Down

0 comments on commit d38faac

Please sign in to comment.