ignore policy/group missing errors appropriately (#9559)

This commit is contained in:
Harshavardhana
2020-05-09 13:59:12 -07:00
committed by GitHub
parent d9e7cadacf
commit b5ed42c845
3 changed files with 5 additions and 7 deletions

View File

@@ -398,7 +398,7 @@ func (iamOS *IAMObjectStore) loadMappedPolicies(ctx context.Context, userType IA
policyFile := item.Item
userOrGroupName := strings.TrimSuffix(policyFile, ".json")
err := iamOS.loadMappedPolicy(userOrGroupName, userType, isGroup, m)
if err != nil {
if err != nil && err != errNoSuchPolicy {
return err
}
}

View File

@@ -260,11 +260,11 @@ func (sys *IAMSys) LoadGroup(objAPI ObjectLayer, group string) error {
defer sys.store.unlock()
err := sys.store.loadGroup(group, sys.iamGroupsMap)
if err != nil && err != errConfigNotFound {
if err != nil && err != errNoSuchGroup {
return err
}
if err == errConfigNotFound {
if err == errNoSuchGroup {
// group does not exist - so remove from memory.
sys.removeGroupFromMembershipsMap(group)
delete(sys.iamGroupsMap, group)
@@ -322,7 +322,7 @@ func (sys *IAMSys) LoadPolicyMapping(objAPI ObjectLayer, userOrGroup string, isG
}
// Ignore policy not mapped error
if err != nil && err != errConfigNotFound {
if err != nil && err != errNoSuchPolicy {
return err
}
}
@@ -346,7 +346,7 @@ func (sys *IAMSys) LoadUser(objAPI ObjectLayer, accessKey string, userType IAMUs
}
err = sys.store.loadMappedPolicy(accessKey, userType, false, sys.iamUserPolicyMap)
// Ignore policy not mapped error
if err != nil && err != errConfigNotFound {
if err != nil && err != errNoSuchPolicy {
return err
}
}