deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michal Fojtik (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DTACLOUD-160) Creating instance with name longer than 50 chars throws: ClientError: The request could not be understood by the server due to malformed syntax
Date Tue, 13 Mar 2012 13:43:39 GMT

    [ https://issues.apache.org/jira/browse/DTACLOUD-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13228386#comment-13228386
] 

Michal Fojtik commented on DTACLOUD-160:
----------------------------------------

These patches should fix this issue:

commit 9951b329bc4489e4c88a0d1d08422df4770f52fc
Author: Michal Fojtik <mfojtik@redhat.com>
Date:   Tue Mar 13 14:42:04 2012 +0100

    Core: Added %backend tag to 400 HAML view

commit 2249318b32bd2753560b036fc01aaf81bce23220
Author: Michal Fojtik <mfojtik@redhat.com>
Date:   Tue Mar 13 14:39:57 2012 +0100

    Core: Removed Failure exception from validation
    
    Previously we had two exceptions defined to handle the 400
    errors (like params validation). This patch will remove
    the one defined in validation.rb and re-use the one from
    exception handling system.
    
    All validation errors (400) should be now treated with
    ValidationFailure exception from exceptions.rb.

commit 47e8230feaf956df2bd3588d16533a94fb73b352
Author: Michal Fojtik <mfojtik@redhat.com>
Date:   Tue Mar 13 14:34:10 2012 +0100

    Core: HTTP code 400 now captured by 'error' helper in Sinatra
    
    Currently the 40x error codes are not captured by 'error' helper
    we have in server.rb. To capture the 400 code we need to use
    this helper more expecitely, givin the exception class as param.
    
    With this patch, the 400 errors are reported correctly, using XML
    or HTML view.

commit 5817db5e7323c8c0457af81f937ae7654ca60583
Author: Michal Fojtik <mfojtik@redhat.com>
Date:   Tue Mar 13 14:31:53 2012 +0100

    Client: Re-use server message for 40x HTTP statuses (DTACLOUD-160)
    
    Previously the 40x HTTP response status was dropped
    and replaced by 'default' description from HTTP specification.
    This patch will allow to send user-defined messages from
    server. For example code 400 (Bad request) can now indicate
    invalid parameters to the client.

(All patches posted to list for the review)

CURL session:

firefly ~/code/core/client $ curl -v -X POST -H 'Accept: application/xml' -F "image_id=123"
-F "name=rlandyLaunchClientWithNameLongerThanSixtyCharactersTotestJiraOut" --user 'test:test'
"http://localhost:3001/api/instances"
* About to connect() to localhost port 3001 (#0)
*   Trying ::1... Connection refused
*   Trying fe80::1... Connection refused
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 3001 (#0)
* Server auth using Basic with user 'test'
> POST /api/instances HTTP/1.1
> Authorization: Basic dGVzdDp0ZXN0
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: localhost:3001
> Accept: application/xml
> Content-Length: 303
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=----------------------------ecf35ad1ac37
> 
* Done waiting for 100-continue
< HTTP/1.1 400 Bad Request
< X-Frame-Options: sameorigin
< X-XSS-Protection: 1; mode=block
< Content-Type: application/xml
< Server: Apache-Deltacloud/0.5.0
< Content-Length: 193
< Date: Tue, 13 Mar 2012 13:30:52 GMT
< X-Runtime: 0.006778
< Connection: keep-alive
< 
<error status='400' url='/api/instances'>
  <message><![CDATA[Parameter name must be 50 characters or less]]></message>
  <backend driver='rhevm' provider='http://test;123'></backend>
</error>
* Connection #0 to host localhost left intact
* Closing connection #0

IRB session:

firefly ~/code/core/client $ irb
1.9.3-p125 :001 > require 'deltacloud'
 => true 
1.9.3-p125 :002 > c = DeltaCloud.new('v', 'p', 'http://localhost:3001/api')
 => #<DeltaCloud::API:0x007fa3bd162908 @api_provider=nil, @api_driver=nil, @password="p",
@username="v", @api_uri=#<URI::HTTP:0x007fa3bd161c88 URL:http://localhost:3001/api>,
@entry_points={:drivers=>"http://localhost:3001/api/drivers", :realms=>"http://localhost:3001/api/realms",
:images=>"http://localhost:3001/api/images", :instance_states=>"http://localhost:3001/api/instance_states",
:instances=>"http://localhost:3001/api/instances", :hardware_profiles=>"http://localhost:3001/api/hardware_profiles",
:storage_volumes=>"http://localhost:3001/api/storage_volumes"}, @features={:images=>[:user_name],
:instances=>[:user_name, :user_data, :hardware_profiles]}, @verbose=false, @driver_name="rhevm",
@api_version="0.5.0"> 
1.9.3-p125 :003 > c.create_instance('asdasd', :name => 'rlandyLaunchClientWithNameLongerThanSixtyCharactersTotestJiraOut')
DeltaCloud::HTTPError::BadRequest: 400

DeltaCloud::HTTPError::ClientError: Parameter name must be 50 characters or less


	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/deltacloud-client-0.5.0/lib/errors.rb:77:in
`on'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/deltacloud-client-0.5.0/lib/errors.rb:119:in
`block in server_error'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/deltacloud-client-0.5.0/lib/errors.rb:72:in
`instance_eval'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/deltacloud-client-0.5.0/lib/errors.rb:72:in
`initialize'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/deltacloud-client-0.5.0/lib/errors.rb:117:in
`new'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/deltacloud-client-0.5.0/lib/errors.rb:117:in
`server_error'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/deltacloud-client-0.5.0/lib/deltacloud.rb:368:in
`response_error'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/deltacloud-client-0.5.0/lib/deltacloud.rb:391:in
`block in request'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in
`call'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in
`process_result'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in
`block in transmit'
	from /Users/mfojtik/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:745:in `start'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in
`transmit'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in
`execute'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in
`execute'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/rest-client-1.6.7/lib/restclient/resource.rb:67:in
`post'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/deltacloud-client-0.5.0/lib/deltacloud.rb:390:in
`request'
	from /Users/mfojtik/.rvm/gems/ruby-1.9.3-p125/gems/deltacloud-client-0.5.0/lib/deltacloud.rb:316:in
`method_missing'
	from (irb):3
	from /Users/mfojtik/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `<main>'1.9.3-p125 :004
> 
                
> Creating instance with name longer than 50 chars throws: ClientError: The request could
not be understood by the server due to malformed syntax
> -----------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DTACLOUD-160
>                 URL: https://issues.apache.org/jira/browse/DTACLOUD-160
>             Project: DeltaCloud
>          Issue Type: Bug
>          Components: Client (Ruby)
>         Environment: Fedora 16
> Deltacloud git commit; 61ac9fef965dd7d1af7c213357ea7d66630d88d7 R	clone: from https://git-wip-us.apache.org/repos/asf/deltacloud.git
>            Reporter: Ronelle Landy
>            Assignee: David Lutterkort
>
> Using deltacloud ruby client, create an instance with a name longer than 50 chars:
>   DeltaCloud.new( API_NAME, API_PASSWORD, API_URL ) do |client|
>       instance = client.create_instance( '359123e1-d343-40be-ae1d-df180cdf65ef',
>                                          :hardware_profile=>'SERVER',
>                                          :name=>"rlandyLaunchClientWithNameLongerThanSixtyCharactersTotestJiraOut")
> Client throws:
>   1) launch test should allow creation of new instances
>      Failure/Error: instance = client.create_instance( '359123e1-d343-40be-ae1d-df180cdf65ef',
>      DeltaCloud::HTTPError::BadRequest:
>        400
>        
>        DeltaCloud::HTTPError::ClientError: The request could not be understood by the
server due to malformed syntax.
>      # ./lib/errors.rb:77:in `on'
>      # ./lib/errors.rb:105:in `client_error'
>      # ./lib/errors.rb:72:in `instance_eval'
>      # ./lib/errors.rb:72:in `initialize'
>      # ./lib/errors.rb:103:in `new'
>      # ./lib/errors.rb:103:in `client_error'
>      # ./lib/deltacloud.rb:359:in `response_error'
>      # ./lib/deltacloud.rb:391:in `request'
>      # ./lib/deltacloud.rb:390:in `send'
>      # ./lib/deltacloud.rb:390:in `request'
>      # ./lib/deltacloud.rb:316:in `method_missing'
>      # ./specs/launchclient_spec.rb:27
>      # ./lib/deltacloud.rb:82:in `initialize'
>      # ./lib/deltacloud.rb:41:in `new'
>      # ./lib/deltacloud.rb:41:in `new'
>      # ./specs/launchclient_spec.rb:26
> Finished in 0.07303 seconds
> 1 example, 1 failure
> Failed examples:
> rspec ./specs/launchclient_spec.rb:25 # launch test should allow creation of new instances
> rake aborted!
> Looking at the server logs, "RuntimeError:Parameter name must be 50 characters or less"
... however this message is not passed to the client

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message