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

Marios Andreou commented on DTACLOUD-425:
-----------------------------------------

attache patch should resolve this - tracked at 
http://tracker.deltacloud.org/set/268

bug lives in deltacloud/server/lib/deltacloud/helpers/rabbit_helper.rb in the 
generate_url_helper_for(collection, operation) method e.g. when we do 
'bucket_url(id)'
 
78         path.slice!(root_url) if path.start_with?(root_url)$

e.g.:
path == "/buckets/apitestqk9mr8u7hf"$
root_url is "/api"$
path.slice!(root_url) ... path == "/bucketstestqk9mr8u7hf"$


    *i.e. we were doing path.slice!("/api") - which rendered the path to the 
bucket invalid, since the bucket name contained the string ("/api). 
    * my fix is to only remove root_url if the patch starts with this string. 
ran tests to make sure:

      + front-end (black box) tests:
        rake test:deltacloud 
        Finished tests in 8.810725s, 18.8407 tests/s, 144.1425 assertions/s.
        166 tests, 1270 assertions, 0 failures, 0 errors, 5 skips       

      + back-end (white box) tests:
        rake test:base
        182 tests, 182 passed, 0 failures, 0 errors, 0 skips, 672 assertions

        rake test:drivers:mock
        39 tests, 39 passed, 0 failures, 0 errors, 0 skips, 161 assertions





                
> Mock provider - some buckets hrefs in XML are missing "/" and returned garbled
> ------------------------------------------------------------------------------
>
>                 Key: DTACLOUD-425
>                 URL: https://issues.apache.org/jira/browse/DTACLOUD-425
>             Project: DeltaCloud
>          Issue Type: Bug
>         Environment: Mock provider
> Ruby 1.9.7
> Deltacloud 1.1.0
>            Reporter: Ronelle Landy
>            Assignee: Marios Andreou
>         Attachments: 0001-Fix-for-DTACLOUD-425-url_for-bug.patch
>
>
> Something is not working  here  ... and not really sure what it is ... but 
> here's the start:
> PUT ("/buckets/apitestqk9mr8u7hf/apitesthef5934ojh", ......)
> creates the bucket but the href of the bucket lands up being: 
> http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/bucketstestqk9mr8u7hf
> Notice the bucket hrefs returned below are missing  the "/" between "buckets" 
> and the bucket id - and the name is confused (maybe the 'api' in the name 
> causes an issue?)
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/bucketstestfycvot16ft'
>  should be 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/buckets/apitestfycvot16ft'
>  - I think?
> However,  
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/buckets/bucket2'  
> looks just fine. 
> >> curl -X GET --user "un:pw" 
> >> "ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/buckets?format=xml"
> <?xml version='1.0' encoding='utf-8' ?>
> <buckets>
>   <bucket 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/bucketstestfycvot16ft'
>  id='apitestfycvot16ft'>
>     <name>apitestfycvot16ft</name>
>     <size>0</size>
>     <blob 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/bucketstestfycvot16ft/apitest75ez307rjl'
>  id='apitest75ez307rjl'></blob>
>   </bucket>
>   <bucket 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/buckets/bucket1' 
> id='bucket1'>
>     <name>bucket1</name>
>     <size>3</size>
>     <blob 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/buckets/bucket1/blob2'
>  id='blob2'></blob>
>     <blob 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/buckets/bucket1/blob1'
>  id='blob1'></blob>
>     <blob 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/buckets/bucket1/blob3'
>  id='blob3'></blob>
>   </bucket>
>   <bucket 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/bucketstestb5gayfguld'
>  id='apitestb5gayfguld'>
>     <name>apitestb5gayfguld</name>
>     <size>0</size>
>     <blob 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/bucketstestb5gayfguld/apitestscbl8k7mt7'
>  id='apitestscbl8k7mt7'></blob>
>   </bucket>
>   <bucket 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/bucketstesty8nks2a5fv'
>  id='apitesty8nks2a5fv'>
>     <name>apitesty8nks2a5fv</name>
>     <size>0</size>
>     <blob 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/bucketstesty8nks2a5fv/apitestbffk1t4k7y'
>  id='apitestbffk1t4k7y'></blob>
>   </bucket>
>   <bucket 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/buckets/bucket2' 
> id='bucket2'>
>     <name>bucket2</name>
>     <size>2</size>
>     <blob 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/buckets/bucket2/blob5'
>  id='blob5'></blob>
>     <blob 
> href='http://ibm-x3550m3-07.lab.eng.brq.redhat.com:3003/api/buckets/bucket2/blob4'
>  id='blob4'></blob>
>   </bucket>
> </buckets>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to