Description of problem: Got a long time passing test that is trying to create a new organization/owner with a defaultServiceLevel but is getting blocked with the displayMessage above. Since I am attempting to create a new org, it will not have any service levels available yet, so... it makes sense that the service level is not yet available. Also notice the "null" in the message indicating that the owner does not exist yet either. Feels like a new chicken/egg problem where as the prior versions of candlepin allowed me to specify a defaultServiceLevel with the POSTing of a new owner that will eventually be created at a later time. Version-Release number of selected component (if applicable): [root@jsefler-rhel6 ~]# curl --stderr /dev/null --insecure --request GET https://jsefler-candlepin.usersys.redhat.com:8443/candlepin/status | python -m json/tool | grep version "version": "2.3.4" [root@jsefler-candlepin candlepin]# git show | head -1 commit abe976de0d9b1f422581ca5aa264e02297e196c2 [root@jsefler-candlepin candlepin]# git branch * master How reproducible: Steps to Reproduce: [root@jsefler-rhel6 ~]# curl --stderr /dev/null --insecure --user REDACTED:REDACTED --request POST --data '{"displayName":"The Jones Residence","defaultServiceLevel":"Merry Maid Service","key":"The_Joneses"}' --header 'accept: application/json' --header 'content-type: application/json' https://jsefler-candlepin.usersys.redhat.com:8443/candlepin/owners | python -m json/tool { "displayMessage": "Service level \"Merry Maid Service\" is not available to units of organization null.", "requestUuid": "6898c19b-30be-4040-a0e3-c7495999b1b0" } [root@jsefler-candlepin candlepin]# tail -f /var/log/candlepin/candlepin.log 2018-04-02 17:40:18,902 [thread=http-bio-8443-exec-1] [req=6898c19b-30be-4040-a0e3-c7495999b1b0, org=, csid=] INFO org.candlepin.common.filter.LoggingFilter - Request: verb=POST, uri=/candlepin/owners 2018-04-02 17:40:18,939 [thread=http-bio-8443-exec-1] [req=6898c19b-30be-4040-a0e3-c7495999b1b0, org=, csid=] WARN org.candlepin.audit.EventSinkImpl - Rolling back ActiveMQ transaction. 2018-04-02 17:40:18,940 [thread=http-bio-8443-exec-1] [req=6898c19b-30be-4040-a0e3-c7495999b1b0, org=, csid=] INFO org.candlepin.common.filter.LoggingFilter - Response: status=400, content-type="application/json", time=38 Actual results: above Expected results: successful org creation with any defaultServiceLevel Additional info:
Closing this PR as NOTABUG due to the following: After investigating the issue here, it was found that allowing the default service level to be set at owner creation time (before it could be properly validated) allowed it to be set to invalid values, which could have very negative and confusing effects for clients using the auto-attach functionality without specifying a service level. What we've done instead is fixed the broken error message noted in comment as well as added additional error output to clarify exactly what is expected during owner creation. Hopefully this will suffice going forward.