Bug 1784331

Summary: 422 returned instead of 404 on providing non-existing template-kind-name in POST request to provisioning_templates
Product: Red Hat Satellite Reporter: Roman Plevka <rplevka>
Component: Provisioning TemplatesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED NOTABUG QA Contact: Roman Plevka <rplevka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.7.0CC: apatel, mhulan, tbrisker
Target Milestone: 6.7.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-23 14:41:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Roman Plevka 2019-12-17 09:27:44 UTC
Description of problem:
This outcome seems reasonable, but it is a changed behaviour since 6.6 and I'm not sure it was intended (planned).

POST request:
https://my-sat-host/api/v2/provisioning_templates with data {"provisioning_template": {
    "snippet": false,
    "name": "GeKoakiIMv",
    "template": "fooooo", 
    "template_kind_name": "non-existing",
    "template_kind_id": null
    }
}

response:
Received HTTP 422 response: {
  "error": {"message":"Could not find template_kind with name: uFldTJsOqi"}
}

respons prior to 6.7:
Received HTTP 404 response: {"message":"Could not find template_kind with name: qafkXvkXKX"}

Version-Release number of selected component (if applicable):


Expected results:
not sure.

Additional info:

Comment 3 Tomer Brisker 2020-02-23 14:41:49 UTC
This behaviour change is expected. Previous response code was incorrect. 
See: https://theforeman.org/manuals/1.24/index.html#Upgradewarnings, https://bugzilla.redhat.com/show_bug.cgi?id=1692753. 
Closing as NOATBUG.