Bug 802690

Summary: got "ActiveResource::ServerError in DomainsController#update" error when changing namespace with invalid characters
Product: OKD Reporter: Meng Bo <bmeng>
Component: PodAssignee: Krishna Raman <kraman>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 2.xCC: abhgupta, mfisher, rmillner, yujzhang
Target Milestone: ---Keywords: Regression, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-13 18:32:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Meng Bo 2012-03-13 09:50:48 UTC
Description of problem:
<-------->
ActiveResource::ServerError in DomainsController#update

Failed.  Response code = 500.  Response message = Internal Server Error.

Rails.root: /var/www/stickshift/site
Application Trace | Framework Trace | Full Trace

app/models/rest_api/base.rb:146:in `save'
app/controllers/domains_controller.rb:24:in `update'

Request

Parameters:

{"authenticity_token"=>"e8yRtW8tRwq+P2orVDd/H56/uKqUud+tOP6kt+fqhAg=",
 "domain"=>{"name"=>"bmengdev###"},
 "utf8"=>"✓",
 "_method"=>"put"}

Show session dump

Show env dump
Response

Headers:

None
<--------->

Version-Release number of selected component (if applicable):
rhc-site-0.88.4-1.el6_2.noarch

How reproducible:
always

Steps to Reproduce:
1.rhc domain via web
2.change domain name contains invalid chars like '###'
3.
  
Actual results:
got "ActiveResource::ServerError in DomainsController#update" error

Expected results:
should get meaningful message about invalid characters with normal webpage

Additional info:

Comment 1 Clayton Coleman 2012-03-13 23:55:09 UTC
Rest API throws 500 and renders HTML

P7n56xLTCr2l", "version": "3.3.1"}, "job_id": 75649208, "msgs": [{"INFO
": "login: Login successful", "SOURCE": "BLL", "ERR_CD": null, "LVL": "
INFO"}]}
DEBUG: DYNECT Response data: version3.3.1tokenDljXeMIK5Mh5J/BVrZ6BMn10HXa5BCuLEAjHY40Eo5PjZHRrY2kty6LcQAKym2zfAy4GlHFBBcNueChMVPFSWnkCTFzp0jgIAWhCkjX1hXS/erMcdYNbrHuCavFSf7E0MQiueCrKxWx1DclwsM/jP7n56xLTCr2l
Completed 500 Internal Server Error in 505ms

URI::InvalidURIError (bad URI(is not URI?): https://api2.dynect.net/REST/TXTRecord/rhcloud.com/###.dev.rhcloud.com/):
  lib/express/broker/dns_service.rb:294:in `dyn_has?'
  lib/express/broker/dns_service.rb:231:in `dyn_has_txt_record?'
  lib/express/broker/dns_service.rb:45:in `namespace_available?'

Comment 2 Abhishek Gupta 2012-03-19 20:14:39 UTC
I just checked and the validations are performed with both the new and old REST APIs. The changes seem to have been made sometime last week.

Using the new REST APIs, the response returned is show below

$ curl -k -u 'agupta6:pp' -d 'namespace=dfg###df' https://localhost/broker/rest/domains

{"data":null,"version":"1.0","type":null,"messages":[{"text":"Invalid namespace: dfg###df. Namespace must only contain alphanumeric characters.","exit_code":106,"field":"namespace","severity":"error"}],"status":"unprocessable_entity"}



Using the old REST APIs, the response returned is show below

$ curl -k -d 'json_data={"rhlogin": "agupta6", "namespace": "dsflgn###sdgs"}' https://localhost/broker/domain

{"exit_code":106,"debug":"","broker_c":["namespace","rhlogin","ssh","app_uuid","debug","alter","cartridge","cart_type","action","app_name","api"],"data":"","api_c":["placeholder"],"messages":"","result":"Invalid namespace: dsflgn###sdgs","api":"1.1.3"}

Comment 3 Yujie Zhang 2012-03-20 06:12:18 UTC
Verify this bug on stage, it has been fixed now, thanks.