188 Commits

Author SHA1 Message Date
Alex Gaynor
ff6ba367fa Replaced two references to Cloud Files with Swift
Change-Id: I721f2b25a255a829c625b34928b066df3cd3e632
2013-11-01 11:40:44 -07:00
Romain Hardouin
4b78b4d136 Fix a typo in help text: "downlad"
Change-Id: Icd6cf75f3c5758c13118060c19c9c000e28ef3ae
Closes-Bug: #1245082
2013-10-27 01:41:04 +02:00
Jenkins
775a24b1bc Merge "enhance swiftclient logging" 2013-10-18 21:43:05 +00:00
Leah Klearman
b682935055 enhance swiftclient logging
* log to debug for successes and info for errors
* remove dead code, neither body or raw_body are sent in kwargs
* include resp.reason and response headers in logging
* remove trailing \n in logging. users who want them can set logging.basicConfig(format=FORMAT)
* add --info option to swift cli

Change-Id: If07af46cb377f3f3d70f6c4284037241d360a8b7
2013-10-17 16:05:36 -07:00
Jenkins
1f2717e334 Merge "Extend usage message for swift download" 2013-10-17 17:42:42 +00:00
Jenkins
efde2378c2 Merge "user defined headers added to swift post queries" 2013-10-17 16:59:03 +00:00
Pete Zaitcev
e08ec3ab8a Clarify main help for post subcommand
Fixes bug 1231321

Change-Id: I7014aa160ebe5ba0bc5a91de05e6858fc58f69e0
2013-10-14 15:04:40 -06:00
Jenkins
1aa85960fd Merge "Make pbr only a build-time dependency." 2013-10-10 22:51:47 +00:00
Samuel Merritt
7d61c54399 Make pbr only a build-time dependency.
This lets you build python-swiftclient packages that don't require pbr
to be installed at all. You would need pbr on the machine running
rpmbuild / debuild, but not on the machines that install the packages.

Unfortunately, this does not make python-swiftclient able to be
installed via pip 0.3.1 on Lucid; you'll need to uninstall the system
python-pip package and install a new pip some other way. Given that
pip < 1.3 doesn't perform SSL certificate validation for pypi (trivial
MITM attack, anyone?), you'd probably want to get a new pip anyway.

Change-Id: I85d4d77aacf094e48d39e48e750594b95dbc7af0
2013-10-10 11:57:47 -07:00
Dirk Mueller
0cded7cfed assertEquals is deprecated, use assertEqual (H602)
Change-Id: I75dac8693c079a153004f77dc1cda48f3ac6f51d
2013-09-30 22:24:31 +02:00
Matthieu Huin
afa1f9f76d user defined headers added to swift post queries
This commit fixes a problem where headers passed through the option
--header were not taken into account when doing "post" queries.

Change-Id: Ia34808c53a1816d9956a98e0803d8c4d20d2ad44
Closes-Bug: #1226256
2013-09-27 11:40:34 +02:00
Jenkins
68dde8dd51 Merge "fix bug with replace old *LOs" 2013-09-22 22:54:11 +00:00
Monty Taylor
66e8c5a384 Sync with global requirements
Specifically, removing d2to1 is the important part. While we're at it
though, use hacking to get the pyflakes/pep8 pins.

Change-Id: Ic4a43955526fcde313ad2f2afec8fafeb87f37a6
2013-09-13 11:02:05 -05:00
David Goetz
266217e32c fix bug with replace old *LOs
Change-Id: I9e6278b62608cf36fa7e5e228f234cc8199c17fc
2013-09-10 13:12:29 -07:00
Alexis Lee
47c33cc4a3 Extend usage message for swift download
Make it clear that you do not have to provide either the container or
object positional parameters, and what swiftclient will do if you omit
them.

Change-Id: I3766fc1eabd51f197e2175771af579577a96c192
2013-09-06 14:57:34 +01:00
Jenkins
0278998398 Merge "Added support for running the tests under PyPy with tox" 2013-08-29 22:23:27 +00:00
Alex Gaynor
d352d831a5 Added support for running the tests under PyPy with tox
This is a precursor to having them run under check and gate.

Change-Id: Ia512b68b5b47a88d5f7c1015cdf7151c322d293d
2013-08-28 09:44:51 -07:00
Stanislaw Pitucha
a47d3d6468 Remove redundant unit suffix
Transfer speed already has a "MB/s" unit. The "s" suffix was probably a
copy/paste mistake.

Change-Id: Iccd7894d5ca11aac8a9f98365834c5d3deef0720
2013-08-28 16:26:28 +01:00
Jenkins
6c041058da Merge "Reformat help outputs" 2013-08-26 23:42:48 +00:00
Jakub Krajcovic
b0eb857b69 Reformat help outputs
Reformatted the help outputs in the swift client to bring them more
in line with the rest of the openstack clients. Changes were added to
all of the st_command_help variables and a new variable
st_command_options was added to help with correct formatting of
help outputs.

Change-Id: I0c549cf96292384ddb36b43ecec41a883d8b2e13
Implements: changes to help outputs
2013-08-19 20:45:00 +10:00
Clay Gerrard
ec14619ef0 Add a NullHandler when setting up library logging
I was gunna write a test, but mocking ImportErrors is a PITA, so I decided to
just get my tox py26 working instead.  Tests seem to fail/pass as expected
without/with the inline NullHanlder.

Closes-Bug: 1212861

Change-Id: I20207374a77ee9969ab201c3a57e4caf40c02a61
2013-08-17 00:27:24 -07:00
Jenkins
c626c2a87e Merge "Added headers argument support to get_object()" 2013-08-02 19:23:23 +00:00
Wu Wenxiang
256978a0ee Assignment to reserved built-in symbol "file"
In file: tests/test_swiftclient.py, test_unicode_ok() &
test_chunk_warning()

Fixes bug #1207736

Change-Id: I0a822802ec8910e9aec36ae5af775f8abb384d34
2013-08-02 20:57:02 +08:00
Stanislav Vitkovskiy
d34f126148 Added headers argument support to get_object()
With this change conditional and range GETs are possible, as
documented in official API guide:
http://docs.openstack.org/api/openstack-object-storage/1.0/content/retrieve-object.html

Change-Id: Ib2ed1c21e8d3f1ed79c0b7e542ee022ee535835c
2013-07-29 22:53:13 +10:00
Darrell Bishop
9198e95468 Move multi-threading code to a library.
This patch extracts the multi-threading code from bin/swift into
swiftclient/multithreading and adds tests.  In particular, this new way
of doing it (with context managers) will prevent non-daemonic threads
from wedging the process when unexpected exceptions happen.

I enabled reporting of which lines, specifically, are not covered by
unit tests (added -m option to "coverage report" in .unittests).

This patch includes a drive-by fix for uploading a segmented file with
--use-slo when that object already exists.  A key of "name" was used
instead of "path", raising KeyError.

There's also another drive-by fix for uploading segmented objects with
--use-slo.  Commit 874e0e4427b80e1b15b74a1557b73ba9d61443ca regressed
this by removing the capturing of thread-worker results in
QueueFunctionThread.run().  This patch restores that functionality and
the feature (uploading SLO objects).

Change-Id: I0b4f677e4a734e83d1a25088d9a74f7d46384e53
2013-07-28 22:08:17 -07:00
TheSriram
5d9c6f845c fix(gitignore) : Ignore *.egg files
Change-Id: If52f9570a17230af9636f5337973e506c142b0bc
2013-07-24 16:31:13 -04:00
Jenkins
43a838eabf Merge "python3: Start of adding basic python3 support." 2013-07-23 17:41:16 +00:00
Jenkins
8ffaa0a4ce Merge "Refuse carriage return in header value" 2013-07-23 00:09:47 +00:00
Chuck Short
69281a580f python3: Start of adding basic python3 support.
Fix imports so its python3 compliant.

Change-Id: Ie08fe63b87e75bb099105ca1de860f9ab6c3340b
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-07-18 14:00:07 -04:00
Hemanth Makkapati
2f84a4e76b Added log statements in swift client
Added log statements in swiftclient/client.py:_retry where exceptions
are being raised.

Fixes bug# 1202229

Change-Id: I727537177849d08bb9603aa884152bdebc62fb85
2013-07-17 15:11:15 +00:00
Samuel Merritt
07d13b5262 Update docstring for swiftclient.Connection.__init__
There were two undocumented parameters in there, one introduced
recently in 6411fd3, and the other some time before.

Change-Id: I3a7d59e1c272b382b035b88ba5495bc1c57a3154
2013-07-12 17:26:45 -07:00
Jenkins
cc2fbf0c74 Merge "Adds max-backoff for retries in Connection." 2013-07-12 22:57:24 +00:00
Kun Huang
7d88d14def Refuse carriage return in header value
See bug #1188896.
Comparing with Curl and Django, they both refuse carriage returns in
header values, so the request() method on the HTTP(S)Connection instance
returned by swiftclient.client.http_connection() will raise an
InvalidHeadersException if any of the headers to be sent contain a
newline.

Drive-by fix for a couple of header values which were integers instead
of strings (Content-Length getting set to zero).

Fixes bug #1188896

Change-Id: Ic6afdb92882284f843aacb06d20f682ddcb47151
2013-07-12 15:18:49 -07:00
Mike Widman
6411fd3846 Adds max-backoff for retries in Connection.
The max-backoff concept prevents the backoff used in _retry to double infinitely (which in turn causes wait times of an hour or more between retries).

As per review, changed code to use min instead.

Fixes: bug #1183542

Change-Id: Ic084f54069b7fa7a33604741487045c5e697ff06
2013-07-12 14:53:30 -07:00
Jenkins
65e5ef7b81 Merge "Allow setting # of retries in the binary" 2013-07-12 15:17:03 +00:00
Jenkins
c460ebff0a Merge "Allow storage url override for both auth vers." 2013-07-10 07:06:08 +00:00
Ben McCann
188e835ead Allow setting # of retries in the binary
Change-Id: I7ef4f1f86cc6ea4937043ea7bf7d9526e23bd2c7
2013-07-08 17:09:44 -07:00
Kun Huang
94d7c23181 Note '-V 2' is necessary for auth 2.0
Here are some questions in Launchpad, just because they miss '-V 2' for
auth 2.0.
https://answers.launchpad.net/swift/+question/231938
https://answers.launchpad.net/swift/+question/231279
So I add somethins for noteing people add the '-V 2'

Change-Id: I2e0fef969be4eca316975de03fdbc516a1069acf
2013-07-07 16:22:01 +08:00
Darrell Bishop
1d4d51b218 Allow storage url override for both auth vers.
When --os-storage-url is specified on the command-line to bin/swift, it
will override the used storage URL regardless of authentication for both
authentication version 1 and version 2.  This can be used to bypass a
load-balancer to hit a specific proxy server for testing/debugging
purposes.

Within the client library, this feature is accessed by passing the
desired storage URL into swiftclient.client.Conection.__init__() via the
os_options keyword argument.  For example:

  conn = Connection(auth_url, user, key, os_options={
    'object_storage_url': 'http://overridden.storage.url/AUTH_foo'})

This patch also adds a dependency on mock>=0.8.0, which is the same as
openstack/swift.

Change-Id: Id2a36ed6abffd65e7762b6beea5bbfc6c036e848
2013-07-05 14:12:59 -05:00
Jenkins
6f7458a290 Merge "Add -p option to download command." 2013-07-05 17:16:34 +00:00
Jenkins
b03843f3ac Merge "Add *.swp into .gitignore" 2013-06-28 18:42:23 +00:00
Kun Huang
100f95281a Add *.swp into .gitignore
Change-Id: I76c92d82647ac9d042f6c117918feb5820a47678
2013-06-27 22:28:33 +08:00
Darrell Bishop
f022aac0cf Add -p option to download command.
Allow the ability to download a subset of containers (--all with -p) or
a subset of objects within a container (container name with -p).

This patch also includes a drive-by fix for "download --all" which would
not actually download any objects (for me, at least) because the object
queue got filled with "stop" messages before the container workers had
run long enough to put work in the object queue.  Doh!

I also closed up a few holes where an (unexpected, obviously) Exception
could cause the process to hang because non-daemon threads still
existed.

Change-Id: I71c6935c60282b5353badc2dfce8a935d47e3bb7
2013-06-26 23:00:46 -07:00
Mark Seger
9f5b334f7a add -t for totals to list command and --lh to stat
Change-Id: Ieaba5e7762032bf9a2652ead39870d55e85b4672
2013-06-26 15:48:21 +00:00
Jenkins
1c86d62fde Merge "Remove explicit distribute depend." 2013-06-26 14:58:11 +00:00
Mark Seger
3f66a8ae6b add optional 'response_dict' parameters to many calls into which they'll
return a dictionary of the response status, reason and headers

Change-Id: I35f8824537f0484362dd6646c91789fac02fa075
2013-06-20 11:51:08 +00:00
Jenkins
5d84ff8d9b Merge "Fixes re-auth flow with expired tokens." 2013-06-19 18:31:15 +00:00
EdLeafe
7b9f304485 Fixes re-auth flow with expired tokens.
The re-authentication of expired tokens assumed that the 401 would
always occur on the first HTTP at tempt. This fix changes that so that
re-auth is still only attempted once, but no longer has to be on the
first attempt.

Change-Id: I93a1187da3637287a803a59c146256d4f543c9d5
Fixes: bug #1131142
2013-06-13 11:14:28 -05:00
Jenkins
08e1f09e58 Merge "python3: Introduce py33 to tox.ini" 2013-06-13 08:00:32 +00:00
Jenkins
473167ff31 Merge "Add -l and --lh switches to swift 'list' command" 2013-06-11 22:03:34 +00:00