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...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Master (Show other bugs)
2.x
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Clayton Coleman
libra bugs
:
Depends On:
Blocks:
  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:
Environment:
Last Closed: 2012-11-06 13:50:17 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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.

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

domains_controller.rb:85
      @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
https://github.com/openshift/origin-server/pull/700
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"?>
<response>
  <version>1.2</version>
  <messages>
    <message>
      <field nil="true"></field>
      <text>Domain already exists for user. Update the domain to modify.</text>
      <exit-code>158</exit-code>
      <severity>error</severity>
    </message>
  </messages>
  <status>conflict</status>
  <supported-api-versions>
    <supported-api-version>1.0</supported-api-version>
    <supported-api-version>1.1</supported-api-version>
    <supported-api-version>1.2</supported-api-version>
  </supported-api-versions>
  <data>
    <datum nil="true"></datum>
  </data>
  <type nil="true"></type>
</response>

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