Bug 851345 - Rest API returns different errors and messages depending on timing for domain create
Rest API returns different errors and messages depending on timing for domain...
Product: OpenShift Origin
Classification: Red Hat
Component: Master (Show other bugs)
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Clayton Coleman
libra bugs
Depends On:
  Show dependency treegraph
Reported: 2012-08-23 17:27 EDT by Clayton Coleman
Modified: 2015-05-14 20:52 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-11-06 13:50:17 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Clayton Coleman 2012-08-23 17:27:32 EDT
These two errors are identical, and only differ in timing.  We should only return one of these (preferably 102 because that matches the old behavior).  The message should also be identical.

  raise StickShift::UserException.new("Domain already exists for #{user_id}", 158) if hash == nil

      @reply.messages.push(Message.new(:error, "User already has a domain associated. Update the domain to modify.", 102))

This effects tests running in parallel in the devenv and causes spurious failures (we handle 102, but not 158).  We will work around it for now but this should be fixed and any other duplicates resolved.
Comment 1 Lili Nader 2012-08-24 17:20:26 EDT
lowering severity to non-blocker
Comment 2 Ravi Sankar 2012-08-27 21:09:02 EDT
Error Codes:
 102: A user with login already exists
 158: Domain already exists for user

Error codes are incorrectly assigned in some places in broker code.
Fixed these incorrect assignments and duplicates in git revision 171375e359417.

In <site-repo>/app/models/domain.rb, we need to remove 
 L10   on_exit_code(102, :on_invalid => (Domain::UserAlreadyHasDomain = Class.new(ActiveResource::ResourceInvalid)))
There may be more similar changes in site. Assigning to Clayton for site related changes.
Comment 3 Clayton Coleman 2012-08-29 14:21:46 EDT
We will do the right thing if the message is returned still, lowering severity.
Comment 4 Clayton Coleman 2012-10-17 14:47:58 EDT
Comment 5 Rony Gong 2012-10-18 06:28:21 EDT
Verified on devenv_2341
[qgong@localhost automation]$ curl -k -X POST -H 'Accept: application/xml' --user qgong@redhat.com:111111 https://ec2-184-73-124-141.compute-1.amazonaws.com/broker/rest/domains -d id=qgong9
<?xml version="1.0" encoding="UTF-8"?>
      <field nil="true"></field>
      <text>Domain already exists for user. Update the domain to modify.</text>
    <datum nil="true"></datum>
  <type nil="true"></type>

Note You need to log in before you can comment on or make changes to this bug.