1

I want to upload many files with a single operation in OpenStack Swift. I find the middleware -- Bulk Operations which can auto extract files from tar compressed file. However, I failed to extract the files from the tar.

I PUT the tar file use the bulk operation like this:

curl -X PUT http://127.0.0.1:8080/v1/AUTH_test/ContainerName/$?extract-archive=tar  \
-T theTarName.tar  \
-H "Content-Type: text/plain"  \
-H "X-Auth-Token: token"

I am sure that the storageURL, tar file path, and token is accurate. But, I didn't get any responses(successes or errors). When I show the objects in the container, I find just one object named 0extract-archive=tar was uploaded, but the files in the tar were not extracted.

I want to know how to extract the tar automatically in OpenStack Swift and all of the files in the tar can be displayed in the container.

Thanks in advance.

Jacky Liu
  • 63
  • 2
  • 6

1 Answers1

3

The issue is the $? part. $? refers to the exit code of the last command in bash (http://tldp.org/LDP/abs/html/exit-status.html), which I suspect you're using.

If you'd like to use $ as the archive prefix, consider escaping it with \:

$ curl -X PUT \
"http://127.0.0.1:8080/v1/AUTH_test/container/\$?extract-archive=tar" \
-T test.tar \
-H "X-Auth-Token: <token>"

You should get the following output:

Number Files Created: 3
Response Body: 
Response Status: 201 Created
Errors:
timuralp
  • 31
  • 2
  • It works! Really appreciate your help. It looks like the number 0 is the exit status. – Jacky Liu Jan 27 '18 at 06:20
  • Right -- that's the successful exit status. If the prior command failed (for example a file didn't exist or there was some other error), $? would reflect that, as well. – timuralp Jan 28 '18 at 01:37