Bug 1023125

Summary: hammer-cli: trying to create duplicate org throws unhandled ISE
Product: Red Hat Satellite Reporter: Corey Welton <cwelton>
Component: APIAssignee: Daniel Lobato Garcia <dlobatog>
Status: CLOSED CURRENTRELEASE QA Contact: Og Maciel <omaciel>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.2CC: bkearney, dcleal, gkhachik, mbacovsk, ohadlevy, omaciel, tkolhar
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/3519
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-02 14:06:09 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 Corey Welton 2013-10-24 16:47:17 UTC
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

Version-Release number of selected component (if applicable):
Satellite-6.0.2-RHEL-6-20131023.1


How reproducible:


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"

Additional info:

Comment 1 Corey Welton 2013-10-24 16:48:56 UTC
Likewise, attempting to modify an org to have the same name as an existing one throws the same error.

Comment 4 Dominic Cleal 2013-10-25 13:46:48 UTC
Turns out to be a Foreman API error.  Please include production.log info when you get HTTP error codes like this.

Comment 7 Dominic Cleal 2014-02-06 16:57:37 UTC
*** Bug 1062306 has been marked as a duplicate of this bug. ***

Comment 9 Bryan Kearney 2014-02-18 14:40:35 UTC
checked into upstream.

Comment 11 Og Maciel 2014-03-11 16:28:52 UTC
DEBUG basecli:43: Running test TestOrg/test_bugzilla_1023125
DEBUG ssh:100: >>> LANG=en_US hammer -v -u admin -p changeme --output csv organization create --name='ucwoer'
DEBUG ssh:153: <<< ['Message,Id,Name', 'Organization created,171,ucwoer', '']
DEBUG ssh:100: >>> LANG=en_US hammer -v -u admin -p changeme --output csv organization info --id='171'
DEBUG ssh:153: <<< ['Id,Name,Created at,Updated at,Label,Description', '171,ucwoer,2014/03/11 16:27:16,2014/03/11 16:27:16,ucwoer,""', '']
DEBUG ssh:100: >>> LANG=en_US hammer -v -u admin -p changeme --output csv organization list --search='label="ucwoer"'
DEBUG ssh:153: <<< ['Id,Name,Label,Description', '171,ucwoer,ucwoer,""', '']
DEBUG ssh:100: >>> LANG=en_US hammer -v -u admin -p changeme --output csv organization create --name='ucwoer'
DEBUG ssh:156: <<< [ERROR 2014-03-11 12:27:26 Exception] Name has already been taken
Name has already been taken
Title has already been taken
Label already exists (including organizations being deleted)
Organization Names and labels must be unique across all organizations
Could not create the organization:
  Name has already been taken
  Name has already been taken
  Title has already been taken
  Label already exists (including organizations being deleted)
  Organization Names and labels must be unique across all organizations

DEBUG factory:78: [ERROR 2014-03-11 12:27:26 Exception] Name has already been taken
Name has already been taken
Title has already been taken
Label already exists (including organizations being deleted)
Organization Names and labels must be unique across all organizations
Could not create the organization:
  Name has already been taken
  Name has already been taken
  Title has already been taken
  Label already exists (including organizations being deleted)
  Organization Names and labels must be unique across all organizations

.
----------------------------------------------------------------------
Ran 1 test in 16.700s

OK

Comment 12 Bryan Kearney 2014-07-02 14:06:09 UTC
This was delivered with 6.0.3, which is the Satellite 6 Beta.