Org create returns unclear message when trying to assign a non-existent subnet
Description of problem:
When testing bug #1183196, I inadvertently tried creating org, associating it with a subnet that did not exist. When this occurs, user gets an error message that seems to have nothing to do with the subnet.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create capsules/smart proxiess; furthermore, create only one subnet. Or create zero, and modify hammer command below accordingly.
2. Attempt to create an org:
hammer organization create --description "eeee" --name "eeee" --smart-proxy-ids=2 --domain-ids 1 --subnet-ids 1,2
3. View results
[root@rhsm-qe-2 ~]# hammer organization create --description "eeee" --name "eeee" --smart-proxy-ids=2 --domain-ids 1 --subnet-ids 1,2
[Foreman] Username: admin
[Foreman] Password for admin:
Could not create the organization:
Resource organization not found by id ''
An error message that makes more sense -- "No subnet found for id '2'" or whatever
#4 Updated by Dominic Cleal almost 5 years ago
- Project changed from Hammer CLI to Foreman
- Subject changed from Hammer: org create - unclear message when trying to assign a non-existent subnet to Org create returns unclear message when trying to assign a non-existent subnet
- Category changed from Other commands to API
- Status changed from Duplicate to New
Thanks for confirming. #16813 probably only fixed the *_name belongs_to extension (HasManyCommon), while the reverse relation depends on the *_ids collection setter behaviour, which always raises an AR::NotFound. The error handler may need improving for that exception.
#8 Updated by Amit Karsale almost 5 years ago
here are we expecting a generic error message statement or error specific to a specific parameter wrongly passed,
as the current message is generic for any resource not found, maybe we can revise the error message from "no resource loaded" to something like "some of the attribute values are inappropriate." or should it be specific?