Actions
Bug #3519
closed500 error when creating a duplicate organization
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'
Actions