Bug #16846

Org create returns unclear message when trying to assign a non-existent subnet

Added by Adam Ruzicka almost 2 years ago. Updated 7 days ago.

Status:Closed
Priority:Normal
Assignee:Amit Karsale
Category:API
Target version:1.15.0
Difficulty: Team Backlog:
Triaged: Fixed in Releases:
Bugzilla link:1199604 Found in Releases:
Pull request:https://github.com/theforeman/foreman/pull/4189

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1199604

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):
Satellite-6.1.0-RHEL-7-20150303.0

How reproducible:

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

Actual 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 ''

Expected results:

An error message that makes more sense -- "No subnet found for id '2'" or whatever

Additional info:


Related issues

Related to Foreman - Bug #16813: Confusing error message on association not found error Closed 10/06/2016
Related to Katello - Bug #18063: Org create returns unclear message when trying to assign ... Closed 01/13/2017
Related to OpenSCAP - Bug #18501: Tests broken after recent change in core Closed 02/14/2017

Associated revisions

Revision 37be416c
Added by Amit Karsale over 1 year ago

Fixes #16846 - Org create failure with specific msg

History

#1 Updated by Dominic Cleal almost 2 years ago

  • Duplicates Bug #16813: Confusing error message on association not found error added

#2 Updated by Dominic Cleal almost 2 years ago

  • Status changed from New to Duplicate

Those error messages are likely to be generated by the API, not Hammer. I think it's been fixed in #16813, please retest on develop.

#3 Updated by Adam Ruzicka almost 2 years ago

On latest foreman, hammer-cli and hammer-cli-foreman I'm still getting the same error:

$ hammer organization create --name foobar --subnet-ids=9999
Could not create the organization:
  Resource organization not found by id ''

#4 Updated by Dominic Cleal almost 2 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.

#5 Updated by Dominic Cleal almost 2 years ago

  • Duplicates deleted (Bug #16813: Confusing error message on association not found error)

#6 Updated by Dominic Cleal almost 2 years ago

  • Related to Bug #16813: Confusing error message on association not found error added

#7 Updated by Marek Hulán almost 2 years ago

  • Target version set to 115

#8 Updated by Amit Karsale almost 2 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?

#9 Updated by Marek Hulán over 1 year ago

I think we should be specific and say what attribute is wrong.

#10 Updated by Amit Karsale over 1 year ago

  • Related to Bug #18063: Org create returns unclear message when trying to assign a non-existent subnet added

#11 Updated by The Foreman Bot over 1 year ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4189 added

#12 Updated by Amit Karsale over 1 year ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#13 Updated by Amit Karsale over 1 year ago

  • Assignee set to Amit Karsale
  • Target version changed from 115 to 158

#14 Updated by Dominic Cleal over 1 year ago

  • Legacy Backlogs Release (now unused) set to 209

#15 Updated by Ondřej Pražák over 1 year ago

  • Related to Bug #18501: Tests broken after recent change in core added

Also available in: Atom PDF