SophieTech88 commented on code in PR #916:
URL: https://github.com/apache/yunikorn-core/pull/916#discussion_r1678699118


##########
pkg/webservice/handlers.go:
##########
@@ -1100,6 +1101,10 @@ func getUserResourceUsage(w http.ResponseWriter, r 
*http.Request) {
                buildJSONErrorResponse(w, err.Error(), http.StatusBadRequest)
                return
        }
+       if !configs.UserRegExp.MatchString(unescapedUser) {
+               buildJSONErrorResponse(w, InvalidUserName, http.StatusNotFound)

Review Comment:
   When I convert to `400 Bad Request` code, the error message as below:
   ```
   === Deadlock detection enabled (timeout: 10 seconds, exit on deadlock: true, 
locking order disabled: false) ===
   2024-07-15T22:07:44.687-0500    ERROR   core.config     
configs/config.go:179   queue configuration validation failed   {"error": 
"undefined policy: invalid"}
   github.com/apache/yunikorn-core/pkg/common/configs.ParseAndValidateConfig
           
/Users/yunsun/Desktop/OpenSource/YUNIKORN/yunikorn-core/pkg/common/configs/config.go:179
   
github.com/apache/yunikorn-core/pkg/common/configs.LoadSchedulerConfigFromByteArray
           
/Users/yunsun/Desktop/OpenSource/YUNIKORN/yunikorn-core/pkg/common/configs/config.go:152
   github.com/apache/yunikorn-core/pkg/webservice.validateConf
           
/Users/yunsun/Desktop/OpenSource/YUNIKORN/yunikorn-core/pkg/webservice/handlers.go:152
   github.com/apache/yunikorn-core/pkg/webservice.TestValidateConf
           
/Users/yunsun/Desktop/OpenSource/YUNIKORN/yunikorn-core/pkg/webservice/handlers_test.go:346
   testing.tRunner
           /usr/local/go/src/testing/testing.go:1689
   2024-07-15T22:07:44.688-0500    ERROR   core.config     
configs/config.go:179   queue configuration validation failed   {"error": 
"MaxResources should be greater than zero in '' limit"}
   github.com/apache/yunikorn-core/pkg/common/configs.ParseAndValidateConfig
           
/Users/yunsun/Desktop/OpenSource/YUNIKORN/yunikorn-core/pkg/common/configs/config.go:179
   
github.com/apache/yunikorn-core/pkg/common/configs.LoadSchedulerConfigFromByteArray
           
/Users/yunsun/Desktop/OpenSource/YUNIKORN/yunikorn-core/pkg/common/configs/config.go:152
   github.com/apache/yunikorn-core/pkg/webservice.validateConf
           
/Users/yunsun/Desktop/OpenSource/YUNIKORN/yunikorn-core/pkg/webservice/handlers.go:152
   github.com/apache/yunikorn-core/pkg/webservice.TestUserGroupLimits
           
/Users/yunsun/Desktop/OpenSource/YUNIKORN/yunikorn-core/pkg/webservice/handlers_test.go:387
   testing.tRunner
           /usr/local/go/src/testing/testing.go:1689
   2024-07-15T22:07:44.688-0500    ERROR   core.config     
configs/config.go:179   queue configuration validation failed   {"error": 
"invalid resource combination for limit  all resource limits are null"}
   github.com/apache/yunikorn-core/pkg/common/configs.ParseAndValidateConfig
           
/Users/yunsun/Desktop/OpenSource/YUNIKORN/yunikorn-core/pkg/common/configs/config.go:179
   
github.com/apache/yunikorn-core/pkg/common/configs.LoadSchedulerConfigFromByteArray
           
/Users/yunsun/Desktop/OpenSource/YUNIKORN/yunikorn-core/pkg/common/configs/config.go:152
   github.com/apache/yunikorn-core/pkg/webservice.validateConf
           
/Users/yunsun/Desktop/OpenSource/YUNIKORN/yunikorn-core/pkg/webservice/handlers.go:152
   github.com/apache/yunikorn-core/pkg/webservice.TestUserGroupLimits
           
/Users/yunsun/Desktop/OpenSource/YUNIKORN/yunikorn-core/pkg/webservice/handlers_test.go:387
   testing.tRunner
           /usr/local/go/src/testing/testing.go:1689
     ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to