Bug 851345 - Rest API returns different errors and messages depending on timing for domain create
Summary: Rest API returns different errors and messages depending on timing for domain...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Master
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: Clayton Coleman
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-08-23 21:27 UTC by Clayton Coleman
Modified: 2015-05-15 00:52 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-11-06 18:50:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Clayton Coleman 2012-08-23 21:27:32 UTC
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 21:20:26 UTC
lowering severity to non-blocker

Comment 2 Ravi Sankar 2012-08-28 01:09:02 UTC
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 18:21:46 UTC
We will do the right thing if the message is returned still, lowering severity.

Comment 4 Clayton Coleman 2012-10-17 18:47:58 UTC
https://github.com/openshift/origin-server/pull/700

Comment 5 Rony Gong 🔥 2012-10-18 10:28:21 UTC
Verified on devenv_2341
[qgong@localhost automation]$ curl -k -X POST -H 'Accept: application/xml' --user qgong: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.