summaryrefslogtreecommitdiff
path: root/swiftclient
Commit message (Collapse)AuthorAgeFilesLines
* Fix context sensitive help for info and tempurl2.2.0Alistair Coles2014-07-211-22/+9
| | | | | | | | | | 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
* Merge "Allow to specify storage policy when uploading objects"Jenkins2014-07-211-6/+42
|\
| * Allow to specify storage policy when uploading objectsYuan Zhou2014-07-171-6/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Adding Swift Temporary URL support"Jenkins2014-07-182-2/+95
|\ \ | |/ |/|
| * Adding Swift Temporary URL supportJosh Gachnang2014-07-112-2/+95
| | | | | | | | | | | | | | | | | | | | Temporary URLs allow a user to sign an object URL with a shared secret to so that the object can be downloaded without auth for a specified amount of time. http://docs.openstack.org/trunk/config-reference/content/object-storage-tempurl.html Change-Id: Ife0b6c98c975e074d4dad0a31145573b784747c5
* | Merge "replace string format arguments with function parameters"Jenkins2014-07-111-2/+2
|\ \
| * | replace string format arguments with function parametersChristian Berendt2014-06-031-2/+2
| |/ | | | | | | | | | | | | | | There are files containing string format arguments inside logging messages. Using logging function parameters should be preferred. Change-Id: I90270908d27f0a57c184d5a547bb1af9b1381c95
* | Merge "Add context sensitive help"Jenkins2014-07-091-1/+22
|\ \
| * | Add context sensitive helpMark Seger2014-06-251-1/+22
| |/ | | | | | | Change-Id: I9aaadbaba2c43a12a83f8200eaaa96f48c52028e
* | Relax requirement for tenant_name in get_auth()anc2014-06-051-1/+1
|/ | | | | | | | | | | 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
* Use Emacs-friendly coding line.Martin Geisler2014-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | 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
* Remove extra double quote from docstringMartin Geisler2014-05-261-1/+1
| | | | | | | | The extra " was visible on http://docs.openstack.org/developer/python-swiftclient/swiftclient.html Change-Id: I7d61c8259a4f13464c11ae7e3fa28eb3a58e4baa
* Merge "fixed several pep8 issues"Jenkins2014-05-241-3/+3
|\
| * fixed several pep8 issuesChristian Berendt2014-05-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | * 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
* | Fix Python3 bugs2.1.0Christian Schwede2014-05-211-7/+10
|/ | | | | | | | | | | | | | | | | | | | 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
* Merge "fixed typos found by RETF rules"Jenkins2014-05-162-5/+5
|\
| * fixed typos found by RETF rulesChristian Berendt2014-05-122-5/+5
| | | | | | | | | | | | rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos Change-Id: I98b6e46cb84962ffdac02e9007b5ad3b30bc2817
* | Add "." for help stringsAndreas Jaeger2014-05-081-8/+8
|/ | | | | | | | | 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
* Only encode metadata for user customed headersChmouel Boudjnah2014-05-071-2/+16
| | | | | | | | | | 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
* Add functional tests for python-swiftclientChristian Schwede2014-05-051-0/+4
| | | | | | | | | Coverage for swiftclient.client is 71% with these tests. Unit tests have been moved into another subdirectory to separate them from functional tests. Change-Id: Ib8c4d78f7169cee893f82906f6388a5b06c45602
* Removed a duplicate word in a dostringAlex Gaynor2014-04-251-1/+1
| | | | Change-Id: I38e41a7ce9f91b5b1785491c6cd10dbbba9562a2
* Don't utf8 encode urls.Chmouel Boudjnah2014-04-241-2/+2
| | | | | | | | This is not needed since already done by requests. (and it was buggy with py3). Change-Id: I9505c56be2f53eb8071aea3d5fb9d8caa9508e34
* Remove validate_headersChmouel Boudjnah2014-04-172-18/+1
| | | | | | It wasn't used anymore since moved up to requests (and it fails in py3). Change-Id: Ic8a80ae09ca6445696a9cf34ffb503c5ff51bc79
* Use quote/unquote from six module for py3Chmouel Boudjnah2014-04-171-1/+1
| | | | Change-Id: I42cff32fbf3febd6dd6a7171b9214f93b4414f9a
* Makes use of requests.SessionTristan Cacqueray2014-04-161-1/+2
| | | | | | This allows better connection pooling and may improve performances. Change-Id: I69e986b7387dd3ac281731b8355a3eec34a537f8
* Fix test_multithreading on Python 3Victor Stinner2014-04-151-4/+7
| | | | | | | | | | | * On Python 3, the printer doesn't encode Unicode to utf8 anymore, since print() expects a Unicode string. * Update unit tests for Python 3 since repr() doesn't escape non-ASCII characters in Unicode strings anymore: http://legacy.python.org/dev/peps/pep-3138/ Change-Id: I89471019d691a46651312d6a49964b719192148a
* Fix swiftclient.client.quote() for Python 3Victor Stinner2014-04-071-1/+4
| | | | | | | | | On Python 3, urllib.parse.quote() accepts bytes and str (unicode) types and always return str (unicode). Add also more tests with non-ASCII characters. Change-Id: I8e0f19da7240e874392327d0da074ed4abb7d213
* Update help message to specify unit of --segment-size option.Florent Flament2014-04-041-6/+7
| | | | | Change-Id: Ic3f9a733329c19c4e0bb85676da28a8d1d74232b Closes-Bug: 1302566
* Merge "Removed usage of tuple unpacking in parameters."Jenkins2014-04-021-2/+4
|\
| * Removed usage of tuple unpacking in parameters.Alex Gaynor2014-03-301-2/+4
| | | | | | | | | | | | Replaced it with traditional tuple unpacking. Needed for Python 3 support. Change-Id: I714f32859f9b1ec7216eae777ea8968b5826af3b
* | Merge "Replaced print statements with print function."Jenkins2014-04-012-12/+25
|\ \
| * | Replaced print statements with print function.Alex Gaynor2014-03-302-12/+25
| | | | | | | | | | | | | | | | | | This is needed for Python3 compatibility. Change-Id: Iadd21e4b3a936b601a69f1db2aba8e1597f13fc3
* | | Merge "don't use mutable defaults in kwargs"Jenkins2014-04-011-2/+4
|\ \ \
| * | | don't use mutable defaults in kwargsJohn Dickinson2014-03-301-2/+4
| | | | | | | | | | | | | | | | Change-Id: I3ae71259ccc49a5d8a852388784c3dfd577df50a
* | | | Merge "set user-agent header"Jenkins2014-04-011-2/+16
|\ \ \ \ | |/ / /
| * | | set user-agent headerJohn Dickinson2014-03-301-2/+16
| | | | | | | | | | | | | | | | Change-Id: Ia67807667b4b5177d83cce9fcf16d98dc5024fbc
* | | | Merge "Decode HTTP responses, fixes bug #1282861"Jenkins2014-04-011-1/+3
|\ \ \ \ | |_|_|/ |/| | |
| * | | Decode HTTP responses, fixes bug #1282861groqez2014-03-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, the HTTPConnection class expose the raw.read urllib3 function which doesn't do any decoding on the http response. We can fix this by passing decode_content=True to raw.read(). Change-Id: I7d42d31ae516705d1bde2769e642931308116c7a
* | | | Merge "Python 3: Get compatible types from six"Jenkins2014-03-302-3/+6
|\ \ \ \ | |_|_|/ |/| | |
| * | | Python 3: Get compatible types from sixVictor Stinner2014-03-282-3/+6
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Replace unicode with six.text_type * Replace basestring with six.string_types * The long type doesn't exist in Python 3 anymore: replace 1L with long(1) and only test this type with Python 2 * Fix quote(): quote the URL if the string is a byte string. Use "bytes" type instead of "str" to be Python 3 compatible. Change-Id: I1df5aa85e4e7d07191fb5c654d52fc4bd8b9f440
* | | Python 3: Fix module names in importVictor Stinner2014-03-282-3/+3
|/ / | | | | | | | | | | Use six.moves to fix imports on Python 3. Change-Id: I35b9405690e9f0607b24d79aa7c00830df954c41
* | Replace dict.iteritems() with dict.items()Victor Stinner2014-03-271-3/+3
| | | | | | | | | | | | | | | | | | | | dict.iteritems() has been removed in Python 3. In Python 2, dict.items() creates a temporary list, but Samuel Merritt wrote: "The size of the data is small enough that we don't need to worry about the memory consumption; it's all just HTTP headers." Change-Id: Iac427b8bbd032e4a1efb2bdc84a3968217eb6ddf
* | Make bin/swift testable part 1Christian Schwede2014-03-251-0/+1510
|/ | | | | | | | | | | | | | | | | | | | | | To make bin/swift importable for testing it needs to be renamed/moved. The final idea is to move it to swiftclient/shell.py and add only a stub in bin/swift to import swiftclient/shell.py. However, doing this in a single step makes reviewing very hard, because now there are > 1400 lines deleted from bin/swift and added to swiftclient/shell.py - Gerrit doesn't detect the moved file. For example: https://review.openstack.org/#/c/73710/2/ This patch first moves the code to swiftclient/shell.py and uses setup.py/cfg to create the stub file in bin/swift. A follow up (https://review.openstack.org/#/c/76489/) will then add the stub itself in bin/swift (and remove the entry in setup.py). The change to tox.ini is related to bug 1290562 and can be removed in the future. Change-Id: Id86392ccaf09e1d80a5d808fb49827d6d18c2588
* Merge "TCP port is appended two time in ClientException"Jenkins2014-03-121-37/+29
|\
| * TCP port is appended two time in ClientExceptionFabien Boucher2014-03-061-37/+29
| | | | | | | | | | | | | | | | urlparse netloc contains the TCP port if presents. There is no need to provide conn.port when building CLientException. Change-Id: Id3e4fa8c4f4ab2ad693b0e8702ab69ed7c291830
* | Add LengthWrapper in put_object to honor content_length paramClay Gerrard2014-02-252-5/+21
| | | | | | | | | | | | Closes-Bug:#1284360 Change-Id: Iec63a3fde77bb8195bfe46c764403b367999ff43
* | Merge "Remove useless statement"Jenkins2014-02-191-1/+0
|\ \ | |/
| * Remove useless statementFabien Boucher2014-02-191-1/+0
| | | | | | | | Change-Id: Ide74b417ede6a4976c33fc835d366ed472033fd0
* | Remove multipart/form-data file upload2.0.2Tristan Cacqueray2014-02-141-1/+6
|/ | | | | | | | | | | | | | | | The requests 'files' parameter adds this 'Content-Type: multipart/form-data' HTTP header and the whole multipart body data get stored with the object. This also create a memory hog issue because files are loaded in memory before being actually sent. This patch removes this behavior and restores what was done before, ie: direct uploading. This patches also fixes an issue in requests, when used with glance CooperativeReader it mis-calculates content-length leading to chunked encoding for raw upload. Change-Id: Ie5b0a1078bedd33f09c6157f48b5f88116c589fa Closes-Bug: #1280072 Closes-Bug: #1280275
* Fix --insecure option on auth2.0.1John Dickinson2014-02-131-7/+9
| | | | Change-Id: Ibe76d98d6075b84cbdb370b48f3498ab848142ad