Project

General

Profile

Bug #3519

500 error when creating a duplicate organization

Added by Dominic Cleal over 5 years ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Category:
API
Target version:
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Description of problem:
When trying to create an org in foreman when an org with the same name already exists, an ISE is thrown. This is incongruent with such behavior for other subcommands

Steps to Reproduce:
1. 'hammer -u admin -p admin organization create --name foobar' ; note org is created
2. 'hammer -u admin -p admin organization create --name foobar'
3. View results

Actual results:
[root@cloud-qe-21 ~]# hammer -u admin -p admin organization create --name foobar
Could not create the organization:
Error: 500 Internal Server Error

Expected results:
Something like "Organization creation failed: An organization with this name already exists"

Foreman production.log:

Started POST "/api/organizations" for ::1 at 2013-10-25 13:42:55 +0000
Processing by Api::V2::OrganizationsController#create as JSON
  Parameters: {"organization"=>{"name"=>"test"}}
Authorized user admin(Admin User)
undefined method `permission_failed?' for #<Organization:0x000000080a6218> (NoMethodError)
/opt/rh/ruby193/root/usr/share/gems/gems/activemodel-3.2.8/lib/active_model/attribute_methods.rb:407:in `method_missing'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/attribute_methods.rb:149:in `method_missing'
/usr/share/foreman/app/controllers/api/base_controller.rb:54:in `process_resource_error'
/usr/share/foreman/app/controllers/api/base_controller.rb:71:in `process_response'
/usr/share/foreman/app/controllers/concerns/api/v2/taxonomies_controller.rb:47:in `create'

(https://bugzilla.redhat.com/show_bug.cgi?id=1023125)


Related issues

Has duplicate Foreman - Bug #4211: [RFE] Creating a duplicate org does not provide useful feedbackDuplicate2014-01-28

Associated revisions

Revision 14fdd904 (diff)
Added by Daniel Lobato Garcia about 5 years ago

fixes #3519 - taxonomies include authorization module

Revision 8fc41846 (diff)
Added by Daniel Lobato Garcia about 5 years ago

fixes #3519 - taxonomies include authorization module

(cherry picked from commit 14fdd9046dd3b85979bf95b4d0019e00051e35c2)

History

#1 Updated by Martin Bacovsky about 5 years ago

  • Assignee set to Daniel Lobato Garcia

#2 Updated by Dominic Cleal about 5 years ago

  • Has duplicate Bug #4211: [RFE] Creating a duplicate org does not provide useful feedback added

#3 Updated by Daniel Lobato Garcia about 5 years ago

  • Status changed from New to Assigned

#4 Updated by Dominic Cleal about 5 years ago

Taxonomies are missing Authorization, but in addition, the API error handler assumes all resources have it.

#5 Updated by Daniel Lobato Garcia about 5 years ago

  • Status changed from Assigned to Ready For Testing

#6 Updated by Dominic Cleal about 5 years ago

  • Target version set to 1.9.1

#7 Updated by Dominic Cleal about 5 years ago

  • Legacy Backlogs Release (now unused) set to 5

#8 Updated by Daniel Lobato Garcia about 5 years ago

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

Also available in: Atom PDF