diff --git a/pkg/vsphere/rbac/rbac.go b/pkg/vsphere/rbac/rbac.go index dc0bb69692..de192e6bce 100644 --- a/pkg/vsphere/rbac/rbac.go +++ b/pkg/vsphere/rbac/rbac.go @@ -146,11 +146,12 @@ func (am *AuthzManager) PrincipalBelongsToGroup(ctx context.Context, group strin } results, err := methods.RetrieveUserGroups(ctx, am.client, &req) + // This is to work around a bug in vSphere, when AD is added to // the identity source list, the API returns Object Not Found, // In this case, we ignore the error and return false (BUG: 2037706) - if err != nil && isNotFoundError(ctx, err) { - op.Debugf("Received Not Found Error from PrincipalBelongsToGroup(), could not verify user %s is not a member of the Administrators group", am.Principal) + if err != nil && (isNotSupportedError(ctx, err) || isNotFoundError(ctx, err)) { + op.Debugf("Received Error (%s) from PrincipalBelongsToGroup(), could not verify user %s is not a member of the Administrators group", err.Error(), am.Principal) op.Warnf("If ops-user (%s) belongs to the Administrators group, permissions on some resources might have been restricted", am.Principal) return false, nil } @@ -393,6 +394,20 @@ func (am *AuthzManager) getRoleName(resource *Resource) string { } } +func isNotSupportedError(ctx context.Context, err error) bool { + op := trace.FromContext(ctx, "isNotSupportedError") + + if soap.IsSoapFault(err) { + vimFault := soap.ToSoapFault(err).VimFault() + op.Debugf("Error type: %s", reflect.TypeOf(vimFault)) + + _, ok := soap.ToSoapFault(err).VimFault().(types.NotSupported) + return ok + } + + return false +} + func isNotFoundError(ctx context.Context, err error) bool { op := trace.FromContext(ctx, "isNotFoundError") diff --git a/tests/manual-test-cases/Group5-Functional-Tests/5-25-OPS-User-Grant.robot b/tests/manual-test-cases/Group5-Functional-Tests/5-25-OPS-User-Grant.robot index 0449d31e9d..15060a5e05 100644 --- a/tests/manual-test-cases/Group5-Functional-Tests/5-25-OPS-User-Grant.robot +++ b/tests/manual-test-cases/Group5-Functional-Tests/5-25-OPS-User-Grant.robot @@ -17,8 +17,15 @@ Documentation Test 5-25 - OPS-User-Grant Resource ../../resources/Util.robot Suite Setup Wait Until Keyword Succeeds 10x 10m Ops User Create Suite Teardown Run Keyword And Ignore Error Nimbus Cleanup ${list} +Test Teardown Run Keyword If Test Failed Gather VC Logs *** Keywords *** + +Gather VC Logs + Log To Console Collecting VC logs .. + Run Keyword And Ignore Error Gather Logs From ESX Server + Log To Console VC logs collected + Ops User Create [Timeout] 110 minutes Run Keyword And Ignore Error Nimbus Cleanup ${list} ${false} diff --git a/tests/nightly/upload-logs.sh b/tests/nightly/upload-logs.sh index 40083befa0..889fb032ca 100755 --- a/tests/nightly/upload-logs.sh +++ b/tests/nightly/upload-logs.sh @@ -24,9 +24,9 @@ outfile="vic_nightly_logs_"$1".zip" echo $outfile if [ -d "60" ]; then - /usr/bin/zip -9 -r $outfile 60 *.zip *.log *.debug + /usr/bin/zip -9 -r $outfile 60 *.zip *.log *.debug *.tgz elif [ -d "65" ]; then - /usr/bin/zip -9 -r $outfile 65 *.zip *.log *.debug + /usr/bin/zip -9 -r $outfile 65 *.zip *.log *.debug *.tgz else echo "No output directories to upload!" exit 1