jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maja Šeremet (Jira) <j...@apache.org>
Subject [jira] [Issue Comment Deleted] (JCLOUDS-1533) Using Azure SAS Token unable to upload the file specific folder in the container
Date Mon, 17 Feb 2020 12:45:00 GMT

     [ https://issues.apache.org/jira/browse/JCLOUDS-1533?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Maja Šeremet updated JCLOUDS-1533:
----------------------------------
    Comment: was deleted

(was: Hi, I opened a PR: [https://github.com/jclouds/jclouds/pull/1283])

> Using Azure SAS Token unable to upload the file specific folder in the container
> --------------------------------------------------------------------------------
>
>                 Key: JCLOUDS-1533
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1533
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-blobstore
>    Affects Versions: 2.2.0
>            Reporter: Manju
>            Priority: Major
>              Labels: azureblob
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
>  
> *Jcloud version - 2.2.0*
>  
> {code:java}
> Using Azure key and secret key - Working fine. (Able to upload the files, It will create test1 folder mycontainer and
uploads test-data.log file)
> ===============================================================
> it  should "Upload a file" in {    
>     val azureKey = AppConf.getStorageKey("azure")
>     val azureToken = AppConf.getStorageSecret("azure")    import org.jclouds.ContextBuilder
>     import org.jclouds.blobstore.BlobStoreContext
>     val context = ContextBuilder.newBuilder("azureblob").credentials(azureKey, azureToken).buildView(classOf[BlobStoreContext])
   var blobStore = context.getBlobStore()
>     blobStore.createContainerInLocation(null, "mycontainer")
>     val fileObj = new File("src/test/resources/test-data.log")
>     val payload = Files.asByteSource(fileObj)
>     val blob = blobStore.blobBuilder("test1/test-data.log").payload(payload).contentLength(payload.size()).build()
>     blobStore.putBlob("mycontainer", blob, new PutOptions().multipart())
>     context.close()
> }
> {code}
> {code:java}
> Using AZURE SAS Token - It Doesn't work - Unable to upload the file
> ====================================================================
> it  should "Upload a file" in {    val sasToken = AppConf.getSSAToken("azure")
>     val azureKey = AppConf.getStorageKey("azure")
>        import org.jclouds.ContextBuilder
>     import org.jclouds.blobstore.BlobStoreContext
>     val context = ContextBuilder.newBuilder("azureblob").credentials(azureKey, sasToken).buildView(classOf[BlobStoreContext])
   var blobStore = context.getBlobStore()
>     blobStore.createContainerInLocation(null, "mycontainer")
>     val fileObj = new File("src/test/resources/test-data.log")
>     val payload = Files.asByteSource(fileObj)
>     val blob = blobStore.blobBuilder("test1/test-data.log").payload(payload).contentLength(payload.size()).build()
>     blobStore.putBlob("mycontainer", blob, new PutOptions().multipart())
>     context.close()}
> {code}
> *Error: When We use SAS Token with the above code to upload the files into (mycontainer/test1/test-data.log)*
>  
> {code:java}
> org.jclouds.azure.storage.AzureStorageResponseException: command [method=org.jclouds.azureblob.AzureBlobClient.public
abstract void org.jclouds.azureblob.AzureBlobClient.putBlock(java.lang.String,java.lang.String,java.lang.String,org.jclouds.io.Payload)[mycontainer,
test1/test-data.log, AAAAAQ==, [content=true, contentMetadata=[cacheControl=null, contentDisposition=null,
contentEncoding=null, contentLanguage=null, contentLength=7986, contentMD5=null, contentType=application/unknown,
expires=null], written=false, isSensitive=false]], request=PUT https://test.blob.core.windows.net/mycontainer/test1/test-data.log?comp=block&blockid=AAAAAQ%3D%3D
HTTP/1.1] failed with code 400, error: AzureError{requestId='c13bc6b2-f01e-0020-5acd-b4114e000000',
code='InvalidQueryParameterValue', message='Value for one of the query parameters specified
in the request URI is invalid.
> RequestId:c13bc6b2-f01e-0020-5acd-b4114e000000
> Time:2019-12-17T11:31:17.8460459Z', context='{QueryParameterValue=block, QueryParameterName=comp,
Reason=}'}
> com.google.common.util.concurrent.UncheckedExecutionException: org.jclouds.azure.storage.AzureStorageResponseException:
command [method=org.jclouds.azureblob.AzureBlobClient.public abstract void org.jclouds.azureblob.AzureBlobClient.putBlock(java.lang.String,java.lang.String,java.lang.String,org.jclouds.io.Payload)[mycontainer,
test1/test-data.log, AAAAAQ==, [content=true, contentMetadata=[cacheControl=null, contentDisposition=null,
contentEncoding=null, contentLanguage=null, contentLength=7986, contentMD5=null, contentType=application/unknown,
expires=null], written=false, isSensitive=false]], request=PUT https://test.blob.core.windows.net/mycontainer/test1/test-data.log?comp=block&blockid=AAAAAQ%3D%3D
HTTP/1.1] failed with code 400, error: AzureError{requestId='c13bc6b2-f01e-0020-5acd-b4114e000000',
code='InvalidQueryParameterValue', message='Value for one of the query parameters specified
in the request URI is invalid.
> RequestId:c13bc6b2-f01e-0020-5acd-b4114e000000
> Time:2019-12-17T11:31:17.8460459Z', context='{QueryParameterValue=block, QueryParameterName=comp,
Reason=}'}
> {code}
>  
> *My Observation*
> I think with SAS token when we use *{{blobStore.blobBuilder("test1/test-data.log")}}* a
path like in this format *(test1/test-data.log)* then it's breaking.
> {{blobBuilder}} is not able to create a folder(test1) it seems.
> *But*
> When I use *{{blobStore.blobBuilder("test-data.log")}}* just *filename* without mentioning
folder name then it will work.  (Able to upload only {{test-data.log}} file without creating
any folder.)
>  
> *Expected:*  Should able to upload the *test-data.log* file into a container called
*mycontainer*  *having a folder called  test1*
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message