File tree Expand file tree Collapse file tree 3 files changed +34
-8
lines changed Expand file tree Collapse file tree 3 files changed +34
-8
lines changed Original file line number Diff line number Diff line change @@ -98,11 +98,16 @@ async function main(argv = minimist(process.argv.slice(2))) {
98
98
}
99
99
} catch ( err ) {
100
100
dbg . log1 ( 'NSFS Manage command: exit on error' , err . stack || err ) ;
101
- const manage_err = ( ( err instanceof ManageCLIError ) && err ) ||
102
- new ManageCLIError ( {
103
- ...( ManageCLIError . FS_ERRORS_TO_MANAGE [ err . code ] ||
104
- ManageCLIError . RPC_ERROR_TO_MANAGE [ err . rpc_code ] ||
105
- ManageCLIError . InternalError ) , cause : err } ) ;
101
+ const manage_err = ( ( err instanceof ManageCLIError ) && err ) || ( ( ) => {
102
+ try {
103
+ throw_cli_error ( {
104
+ ...( ManageCLIError . FS_ERRORS_TO_MANAGE [ err . code ] ||
105
+ ManageCLIError . RPC_ERROR_TO_MANAGE [ err . rpc_code ] ||
106
+ ManageCLIError . InternalError ) , // fallback to InternalError and record the event
107
+ cause : err
108
+ } ) ;
109
+ } catch ( e ) { return e ; }
110
+ } ) ( ) ;
106
111
process . stdout . write ( manage_err . to_string ( ) + '\n' , ( ) => {
107
112
process . exit ( 1 ) ;
108
113
} ) ;
Original file line number Diff line number Diff line change @@ -579,12 +579,13 @@ const NSFS_CLI_ERROR_EVENT_MAP = {
579
579
AccountNameAlreadyExists : NoobaaEvent . ACCOUNT_ALREADY_EXISTS ,
580
580
AccountDeleteForbiddenHasBuckets : NoobaaEvent . ACCOUNT_DELETE_FORBIDDEN ,
581
581
BucketAlreadyExists : NoobaaEvent . BUCKET_ALREADY_EXISTS ,
582
- BucketSetForbiddenBucketOwnerNotExists : NoobaaEvent . UNAUTHORIZED , // GAP - add event
583
- BucketSetForbiddenBucketOwnerIsIAMAccount : NoobaaEvent . UNAUTHORIZED , // // GAP - add event
582
+ BucketSetForbiddenBucketOwnerNotExists : NoobaaEvent . BUCKET_OWNER_NOT_EXISTS ,
583
+ BucketSetForbiddenBucketOwnerIsIAMAccount : NoobaaEvent . BUCKET_OWNER_IS_IAM_ACCOUNT ,
584
584
LoggingExportFailed : NoobaaEvent . LOGGING_FAILED ,
585
585
UpgradeFailed : NoobaaEvent . CONFIG_DIR_UPGRADE_FAILED ,
586
586
LifecycleFailed : NoobaaEvent . LIFECYCLE_FAILED ,
587
- LifecycleWorkerReachedTimeout : NoobaaEvent . LIFECYCLE_TIMEOUT
587
+ LifecycleWorkerReachedTimeout : NoobaaEvent . LIFECYCLE_TIMEOUT ,
588
+ InternalError : NoobaaEvent . INTERNAL_ERROR
588
589
} ;
589
590
590
591
exports . ManageCLIError = ManageCLIError ;
Original file line number Diff line number Diff line change @@ -292,6 +292,26 @@ NoobaaEvent.BUCKET_ALREADY_EXISTS = Object.freeze({
292
292
severity : 'ERROR' ,
293
293
state : 'HEALTHY' ,
294
294
} ) ;
295
+ NoobaaEvent . BUCKET_OWNER_NOT_EXISTS = Object . freeze ( {
296
+ event_code : 'bucket_owner_not_exists' ,
297
+ message : 'Bucket owner does not exist' ,
298
+ description : 'The specified bucket owner does not exist in the system' ,
299
+ entity_type : 'NODE' ,
300
+ event_type : 'ERROR' ,
301
+ scope : 'NODE' ,
302
+ severity : 'ERROR' ,
303
+ state : 'HEALTHY'
304
+ } ) ;
305
+ NoobaaEvent . BUCKET_OWNER_IS_IAM_ACCOUNT = Object . freeze ( {
306
+ event_code : 'bucket_owner_is_iam_account' ,
307
+ message : 'The bucket owner is an IAM account' ,
308
+ description : 'The specified bucket owner is an IAM account. Please set a root account as the bucket owner' ,
309
+ entity_type : 'NODE' ,
310
+ event_type : 'ERROR' ,
311
+ scope : 'NODE' ,
312
+ severity : 'ERROR' ,
313
+ state : 'HEALTHY'
314
+ } ) ;
295
315
NoobaaEvent . UNAUTHORIZED = Object . freeze ( {
296
316
event_code : 'noobaa_bucket_access_unauthorized' ,
297
317
message : 'Bucket is not accessible with current access rights ' ,
You can’t perform that action at this time.
0 commit comments