@@ -335,6 +335,7 @@ async function check_new_name_exists(type, config_fs, action, data) {
335
335
async function check_new_access_key_exists ( config_fs , action , data ) {
336
336
const new_access_key = action === ACTIONS . ADD ? data . access_keys ?. [ 0 ] ?. access_key : data . new_access_key ;
337
337
if ( action === ACTIONS . UPDATE && ! is_access_key_update ( data ) ) return ;
338
+ if ( ! new_access_key ) return ; // for anonymous account and users without access keys
338
339
const exists = await config_fs . is_account_exists_by_access_key ( new_access_key ) ;
339
340
if ( exists ) throw_cli_error ( ManageCLIError . AccountAccessKeyAlreadyExists , new_access_key , { account : new_access_key } ) ;
340
341
}
@@ -457,11 +458,12 @@ async function validate_account_args(config_fs, data, action, is_flag_iam_operat
457
458
if ( ! exists ) {
458
459
throw_cli_error ( ManageCLIError . InvalidAccountNewBucketsPath , data . nsfs_account_config . new_buckets_path ) ;
459
460
}
460
- if ( config . NC_DISABLE_ACCESS_CHECK ) return ;
461
- const account_fs_context = await native_fs_utils . get_fs_context ( data . nsfs_account_config , data . fs_backend ) ;
462
- const accessible = await native_fs_utils . is_dir_rw_accessible ( account_fs_context , data . nsfs_account_config . new_buckets_path ) ;
463
- if ( ! accessible ) {
464
- throw_cli_error ( ManageCLIError . InaccessibleAccountNewBucketsPath , data . nsfs_account_config . new_buckets_path ) ;
461
+ if ( ! config . NC_DISABLE_ACCESS_CHECK ) {
462
+ const account_fs_context = await native_fs_utils . get_fs_context ( data . nsfs_account_config , data . fs_backend ) ;
463
+ const accessible = await native_fs_utils . is_dir_rw_accessible ( account_fs_context , data . nsfs_account_config . new_buckets_path ) ;
464
+ if ( ! accessible ) {
465
+ throw_cli_error ( ManageCLIError . InaccessibleAccountNewBucketsPath , data . nsfs_account_config . new_buckets_path ) ;
466
+ }
465
467
}
466
468
if ( action === ACTIONS . UPDATE && is_flag_iam_operate_on_root_account_update_action ) {
467
469
await validate_root_accounts_manager_update ( config_fs , data ) ;
0 commit comments