You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Andrew Gaul (JIRA)" <ji...@apache.org> on 2019/01/09 20:47:00 UTC

[jira] [Comment Edited] (JCLOUDS-1483) Removing a blob from a Swift container using BlobStore.removeBlob fails.

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

Andrew Gaul edited comment on JCLOUDS-1483 at 1/9/19 8:46 PM:
--------------------------------------------------------------

I suspect that your Swift server is not configured to send JSON by default.  We have encountered this in a few other instances, see JCLOUDS-1080.  Could you try modifying {{StaticLargeObjectApi.delete}} to explicitly request JSON?  This has a weird syntax, look at {{StaticLargeObjectApi.getManifest}} which specifies the keys in one array and the values in anoter:

{code:java}
@QueryParams(keys = {"format", "multipart-manifest"}, values = {"json", "get"})
{code}

Note that you will not need the {{multipart-manifest}} parameter.  If this works, please send a pull request.


was (Author: gaul):
I suspect that your Swift server is not configured to send JSON by default.  We have encountered this in a few other instances, see JCLOUDS-1080.  Could you try modifying {{StaticLargeObjectApi.delete}} to explicitly request JSON?  This has a weird syntax, look at {{StaticLargeObjectApi.getManifest}} which specifies the keys in one array and the values in anoter:

{code:java}
@QueryParams(keys = {"format", "multipart-manifest"}, values = {"json", "get"})
{code}

If this works, please send a pull request.

> Removing a blob from a Swift container using BlobStore.removeBlob fails.
> ------------------------------------------------------------------------
>
>                 Key: JCLOUDS-1483
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1483
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-blobstore
>    Affects Versions: 2.1.1
>            Reporter: Biswa Ranjan Ray
>            Priority: Major
>              Labels: openstack-swift
>         Attachments: stacktrace.txt
>
>
>  
> *Usecase*: Try to delete a blob (size ~ 107kb) from a swift container using BlobStore.removBlob() api of jclouds.
> *Issue*: Following exception is found in console: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: *Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $*.
> *Code*: Sharing the code snippet that I've used to delete a blob from a swift container.
> BlobStore blobStore = getBlobStoreContext();              blobStore.removeBlob(containerName, fileName);
> {code:java}
> //To get the BlobStoreContext for OpenStack Swift
> private BlobStoreContext getBlobStoreContext() {
>  final Properties override = new Properties();
>  override.put(KeystoneProperties.KEYSTONE_VERSION, "3");
>  override.put(KeystoneProperties.SCOPE, "project:" + swiftConfig.getProject());
>  
>  final String credential = swiftConfig.getPassword();
>  final String identity = swiftConfig.getUserDomain() + ":" + swiftConfig.getUsername();
>  final String authUrl = swiftConfig.getAuthUrl();
>  
>  return ContextBuilder.newBuilder("openstack-swift")
>  .endpoint(authUrl+"/v3")
>  .credentials(identity,credential)
>  .overrides(override)
>  .buildApi(BlobStoreContext.class);
>  }
> {code}
>  *Debug:* Following are my observations after debugging the code.
>  # The type of the blobstore is found to be RegionScopedSwiftBlobStore.
>  # stepinto blobStore.*removeBlob*(containerName, fileName);                                        at line 396 in *RegionScopedSwiftBlobStore* class, I found it expects a response from *StaticLargeObjectApi* as shown in the below code and this is where the exception occurs:                                                     **                                                  DeleteStaticLargeObjectResponse response = api.getStaticLargeObjectApi(regionId, container).delete(name); 
> *Analysis*: While the api BlobStore.removeBlob fails to delete a blob in a Swift container, it works fine in AWS S3 and GCS container. I also observed that if I use *ObjectApi.delete(objectName)* instead of *BlobStore.removeBlob* then the blob gets deleted from the swift container without any issue. As per the java doc of StaticLargeObjectApi, it is in beta and still under evaluation. Is this api stable?
> Any help is highly appreciated.
> Thank you.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)