prefix argument doesnt give error if used with object in swift download command

Bug #1544952 reported by Karan Soni
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-swiftclient
In Progress
Undecided
Bing Hu

Bug Description

Using 'prefix' optional argument with 'swift download container object' should give error as 'prefix' argument is only supported with 'swift download container'

In following example I have shown the usage of prefix then at the end command where error handling should have been there

# ls
#
# swift download Container1 --prefix t
test-file1 [auth 0.150s, headers 0.217s, total 0.218s, 0.000 MB/s]
test-file3 [auth 0.130s, headers 0.310s, total 0.310s, 0.000 MB/s]
test-file2 [auth 0.165s, headers 0.315s, total 0.315s, 0.000 MB/s]
test-file4 [auth 0.111s, headers 0.331s, total 0.331s, 0.000 MB/s]
# ls
test-file1 test-file2 test-file3 test-file4
#
# swift upload testContainer test-file*
test-file4
test-file3
test-file2
test-file1
# ls
test-file1 test-file2 test-file3 test-file4
# swift list testContainer
test-file1
test-file2
test-file3
test-file4
# rm -rf *
# ls
#
#
# swift download testContainer --prefix s
# swift download testContainer --prefix t
test-file1 [auth 0.110s, headers 0.195s, total 0.196s, 0.000 MB/s]
test-file4 [auth 0.162s, headers 0.228s, total 0.228s, 0.000 MB/s]
test-file3 [auth 0.183s, headers 0.250s, total 0.250s, 0.000 MB/s]
test-file2 [auth 0.149s, headers 0.257s, total 0.257s, 0.000 MB/s]
# rm -rf test-file*
# ls
#
----------------------------------------
Below is the issue, where error was expected
---------------------------------------
#
# swift download testContainer test-file1 --prefix s
test-file1 [auth 0.272s, headers 0.851s, total 0.852s, 0.000 MB/s]
# swift download testContainer test-file1 --prefix t
test-file1 [auth 0.314s, headers 0.386s, total 0.386s, 0.000 MB/s]
# swift download testContainer test-file1 --prefix t test-file2
test-file2 [auth 0.277s, headers 0.363s, total 0.364s, 0.000 MB/s]
test-file1 [auth 0.316s, headers 0.651s, total 0.651s, 0.000 MB/s]
#

I have tested this in below 2 version of swift
# swift --version
swift 2.4.0
# swift --version
python-swiftclient 2.6.0

Bing Hu (hubingsh)
Changed in swift:
assignee: nobody → Bing Hu (hubingsh)
status: New → In Progress
Revision history for this message
Bing Hu (hubingsh) wrote :

Maybe it's better to make --prefix work with objects specified.

in following case, --prefix can filter some objects from a list of objects

li@swift:~/workdir$ cat filelist.txt
file1 file2 xfile1
li@swift:~/workdir$ swift list cont1
file1
file2
xfile1
li@swift:~/workdir$ cat filelist.txt |xargs swift download cont1 --prefix fi
file2 [auth 0.065s, headers 0.097s, total 0.098s, 0.003 MB/s]
file1 [auth 0.084s, headers 0.110s, total 0.110s, 0.004 MB/s]
li@swift:~/workdir$

Tim Burke (1-tim-z)
affects: swift → python-swiftclient
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.