If a user creates an object with name ending with a slash, then
downloading such container ends in a traceback like this:
..............
test5g.file [auth 1.516s, headers 1.560s, total 244.565s, 22.089 MB/s]
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/swiftclient/multithreading.py", lin
result = self.func(item, *self.args, **self.kwargs)
File "/usr/lib/python2.6/site-packages/swiftclient/shell.py", line 403, in
fp = open(path, 'wb')
IOError: [Errno 21] Is a directory: 'first-pseudo-folder/'
The proposed fix is not to save this object. Note that the contents of
the object are available with --output option, as before. Only the
crash is fixed.
Even though we do not use the contents, we download the object and
check its Etag, in case. We also create a corresponding directory,
in case the pseudo-directory contains no objects.
The format of printout is changed, so user realizes easier when
pseudo-directory convention is in effect. Note that this is not a
compatibility issue because previously there was crash in such case.
Change-Id: I3352f7a4eaf9970961af0cc84c4706fc1eab281d
Storage policy stats was not well parsed in account stat. This
patch parses the stats and print out the stats in a format like below:
$swift -A http://swift_cluster/auth/v1.0 -U test:tester -K testing stat
Account: AUTH_test
Containers: 5
Objects: 1
Bytes: 2097152
Objects in policy "golden": 1
Bytess in policy "golden": 2097152
Objects in policy "silver": 0
Bytes in policy "silver": 0
X-Timestamp: 1404697760.88809
X-Trans-Id: txec519e24b44a413abb705-0053da2dcb
Content-Type: text/plain; charset=utf-8
Accept-Ranges: bytes
Change-Id: I7ad0ee6d88f8393e3a93e90cd52b9b592da7072d
The current developer docs theme used is out of sync with the other
openstack projects. This patch will update the docs to provide a more
consistent look and feel when using developer docs
Change-Id: I2c66f60f6cfdd7b7b50a457c931f11851f668fa6
Add a tox job to make it easier for developers to generate their
own docs before submitting a patch.
Change-Id: I86dbfc64a9d174697048c254c6d3d042a62350b4
Enables swiftclient to authenticate using
the keystone v3 API, allowing user id's, user
domains and tenant/project domains to be
specified.
Since swiftclient imports keystoneclient, the
main changes in swiftclient/client.py are to
selectively import the correct keystoneclient
library version and pass a number of new
options to it via the get_auth() function. In
addition the get_keystoneclient_2_0 method
has been renamed get_auth_keystone to better
reflect its purpose since it now deals with
both v2 and v3 use cases.
In swiftclient/shell.py the new options are
added to the parser. To make the default help
message shorter, help for all the --os-*
options (including the existing v2 options)
is only displayed when explicitly requested
usng a new --os-help option.
A new set of unit tests is added to
test_shell.py to verify the parser. A comment
in tests/sample.conf explains how to
configure the existing functional tests to
run using keystone v3 API.
Note that to use keystone v3
with swift you will need to set
auth_version = v3.0 in the auth_token
middleware config section of
proxy-server.conf.
Change-Id: Ifda0b3263eb919a8c6a1b204ba0a1215ed6f642f
Make it so that swift <cmd> --help will print the info
subcommand help for info and tempurl just like all the
other subcommands.
Also add unit tests to verify subcommand help.
Change-Id: Id3666dcf72a9727fbfda2f74c23293ada1c53aa0
Client already supports -H/--header option when creating container
or uploading objects. This patch extends this option to support
Storage Policy.
e.g.,
swift post con -H 'X-Storage-Policy:p1'
This creates one container 'con' with storage policy 'p1'.
swift upload con obj -H 'X-Storage-Policy:p2'
This creates container 'con' with storage policy 'p2' and uploads
object 'obj' into it.
Also fixes segmented uploading to non-default storage policy container
When uploading large objects with segmentation to container with
non-default storage policy, there will be another 'xxx_segments'
container created, but with the default storage policy. This
results all the segments to be stored with the wrong policy.
This patch is for the Storage Policy feature, and also
compatible with old versions w/o Storage Policy support.
Change-Id: I5c19e90604a0bcf2c85e1732b8a0b97ae6801994
get_auth() in client.py raises an exception if
tenant_name is not included in the os_options
dict. This is overly constrained since tenant_id
is equally sufficient. This patch modifies
get_auth to require either tenant_name
or tenant_id.
Change-Id: Ibbcda1704637eb887efa5895579d260a1e072327
There are files containing string format arguments inside
logging messages. Using logging function parameters should
be preferred.
Change-Id: I90270908d27f0a57c184d5a547bb1af9b1381c95
To signal the file encoding to Emacs, one can add a line with
-*- coding: your-favority-encoding -*-
Python also understands such a line, infact it also understands the
line if it says "encoding" instead of "coding".
However, it is only "coding" that has an effect in Emacs. Furthermore,
since "encoding" is not recognized, Emacs will prompt the user with a
scary looking message when the file is opened:
The local variable list in __init__.py contains values that may not
be safe.
Using the correct variable name fixes this.
(The file contain only ASCII characters at the moment, so the line
could alternatively be removed completely.)
Change-Id: Ie6b4f41043bf97bb59e3de403e4794c302d81783
A couple of assertTrue in the test_swiftclient.py
unit tests should be assertEqual. Also, the expected
values now need to be bytes literals.
Change-Id: I7cc1bd60d9ba82d1a28fbae2e1243d3c799451bd
* E111 indentation is not a multiple of four
* E128 continuation line under-indented for visual indent
* E265 block comment should start with '# '
* E713 test for membership should be 'not in'
Tested with pep8 version 1.5.6 (2014-04-14).
Change-Id: I7f85c143d463c501a0df20724362ad5c0f2d4dde
This patch fixes three issues that were found running
functional tests with Python 3:
1. python-requests sets 'application/x-www-form-urlencoded' as
content-type if the input is not a string object and no
content-type is given.
2. Encoding of the headers is now only done if required. This
prevents comparisons between unencoded headers and encoded
prefixes and avoids unnecessary forloop-iterations.
One unittest was extended to ensure it works for unencoded
and encoded headers with or without the prefix.
3. Functional tests recently switched to using byte data for
testing, thus the comparison needs to be a byte object as well.
Change-Id: I035f8b4b9c9ccdc79820b907770a48f86d0343b4
There is no testtools.main() at all (this was a
unittest.main() before). Let's remove this unused
and non-working code.
The following code can be used if someone needs
to start tests manually:
python -m unittest <test_file.py>
Change-Id: Id5162ac73825584df6c23dbe68786ff3355fc6ae
Looks like test_shell.py got left behind when
the unit tests were relocated under tests/unit.
As a consequence they weren't included in tox
runs.
Change-Id: I93435e6141c5e3ad4a9403626f226d7c760cbd7c
Since we added the tests.functional the py3 tests wasn't running
properly fixing it with some voodoo testr magic.
Change-Id: Id301adb32ba739f05591c4c352e0cf7d87576755
The command descriptions did not include a "." at the end but the
argument description does. Add "." everywhere.
Also capitalize and add "." for parameter of capabilities.
Change-Id: I2355e0d0c38170d669c8e568361faf4b68203d16
Note that this should not land until we figure out why `tox -e py33` doesn't
actually run any tests.
Change-Id: Id4e080cfbfca45b3bf7ed81b03a31414495a1348
Don't encode standard headers keys but just the x-*-meta- ones. That
fixes py3 to not have them casted as bytes and not properly passed to
the requests kwargs.
Other trivial py3 fixes along the way.
Change-Id: I91b95f32fb2aec9b20892a5bb95fd1bc65d002f3