Skip to content

Commit 8b10e2e

Browse files
authored
Merge pull request #8269 from shirady/nsfs-nc-update-fetch-fetch-existing-account-data
NC | NSFS | CLI | Update `fetch_existing_account_data`
2 parents ad73e9c + a7a5c89 commit 8b10e2e

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/cmd/manage_nsfs.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -351,17 +351,11 @@ async function fetch_existing_account_data(action, target, decrypt_secret_key) {
351351
const options = { show_secrets: true, decrypt_secret_key };
352352
let source;
353353
try {
354-
source = target.name ?
355-
await config_fs.get_account_by_name(target.name, options) :
356-
await config_fs.get_account_by_access_key(target.access_keys[0].access_key, options);
354+
source = await config_fs.get_account_by_name(target.name, options);
357355
} catch (err) {
358-
dbg.log1('NSFS Manage command: Could not find account', target, err);
356+
dbg.warn(`fetch_existing_account_data: account with name ${target.name} got an error:`, err);
359357
if (err.code === 'ENOENT') {
360-
if (target.name === undefined) {
361-
throw_cli_error(ManageCLIError.NoSuchAccountAccessKey, target.access_keys[0].access_key);
362-
} else {
363-
throw_cli_error(ManageCLIError.NoSuchAccountName, target.name);
364-
}
358+
throw_cli_error(ManageCLIError.NoSuchAccountName, target.name);
365359
}
366360
throw err;
367361
}

0 commit comments

Comments
 (0)