150 Commits

Author SHA1 Message Date
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
Jenkins
02742e602d Merge "Changed the call to set_tunnel to work in python 2.6 or python 2.7 since its name changed between versions" 2013-06-11 21:25:26 +00:00
Monty Taylor
e885f87a3e Remove explicit distribute depend.
Causes issues with the recent re-merge with setuptools. Advice from
upstream is to stop doing explicit depends.

Change-Id: If1a97a574dbc0370a0a2de5d99a92610b048907d
2013-06-11 11:28:13 -07:00
Mark Seger
17bb3fa779 Add -l and --lh switches to swift 'list' command
Also updated man page and added an example in 'list'
command help message

Change-Id: Icf38de9bab6d387a9a1deed444a91f68b4389cfe
2013-06-10 16:49:44 +00:00
Greg Lange
f045f5bec2 Changed the call to set_tunnel to work in python 2.6 or python 2.7 since its name changed between versions
Change-Id: I5550049435002b42c4fea06d41549a1e7254ac02
2013-06-07 20:03:00 +00:00
Stuart McLaren
790f087a67 Add option to disable SSL compression
Allows optionally disabling SSL compression. This can significantly
improve HTTPS upload/download performance in some cases -- in particular
when the object is not compressible and you have very high network
bandwidth.

Implements blueprint ssl-compression.

Change-Id: I1260055f9c2e83cdabfeb51aed11b3899bed4d55
2013-06-04 16:33:18 +00:00
Chuck Short
e35b4fe34a python3: Introduce py33 to tox.ini
Introduce py33 to tox.ini to make testing with
python3 easier.

Change-Id: Ibffa28107fdf1d1ae88223d84de4a7282c7882e0
Signed-off-by: Chuck Short <chuck.short@canonical.com>
2013-06-01 19:27:54 -05:00
niu-zglinux
2d12f09c66 Rename requires files to standard names.
Rename tools/pip-requires to requirements.txt and tools/test-requires
to test-requirements.txt. These are standard files, and tools in the
general world are growing intelligence about them.

Change-Id: I9c1356f22f6527be44b4b3f6a77012156ff1637b
Fixes: bug #1179008
2013-05-30 22:14:28 +00:00
Tong Li
874e0e4427 remove busy-wait so that swift client won't use up all CPU cycles
The current implementation uses busy-wait and checking flags to
communicate between threads. It wastes a lot of CPU powers. With
python 2.6 is required for Swift, the communication between
threads should now be using queue and signal mechanisms. This
patch removed the busy-wait loops and use queue and queue join
for threads coordination which will not consume CPU cycles if
a thread is blocked.

Change-Id: I648cd637a92a159d5c13baa83f357cee2dfe7937
2013-05-29 19:09:49 +00:00
Leah Klearman
7e84b69291 log get_auth request url instead of x-storage-url
because if the request gets a 4xx error, then the url will be None, and that's just confusing.

Change-Id: I62729364b9bd279498909dc5cd0d2a1ec5fcd70d
2013-05-22 18:17:59 -07:00
Pete Zaitcev
07311a0639 Update the man page
- Add -V option
- Use uniform and correct capitalization for OpenStack Swift
- Make the example of output of stat command up-to-date
- Generally prettify the document
- Remove all trailing whitespace

Change-Id: Id3da2035851847c4bff8cec8f927d3654824bf5b
2013-05-21 15:34:21 -06:00
Jenkins
d5b6d29a30 Merge "Add end_marker and path query parameters" 2013-05-21 04:29:55 +00:00
Jenkins
feec0c83ac Merge "do not warn about etag for slo" 2013-05-21 04:17:52 +00:00
Jenkins
7391fcc45e Merge "Add .coveragerc file to show correct code coverage" 2013-05-16 15:30:29 +00:00
Vasyl Khomenko
541d805b66 Add .coveragerc file to show correct code coverage
Change-Id: I428d0c2587cc480a27796c5fa246b171606809e1
2013-05-16 01:24:33 -07:00
Jenkins
af4109dd56 Merge "Switch to pbr for setup." 2013-05-15 08:15:39 +00:00
David Goetz
adebab739d do not warn about etag for slo
Change-Id: I17fa1643f28aa1cd160c2d770243875a3c4a80ee
2013-05-13 07:37:15 -07:00
Pete Zaitcev
3196daf992 Eradicate eventlet and fix bug lp:959221
The bug is simple: whenever swift uploads to a Swift with SSL,
it uses 100% CPU. It happens because we use HTTPSConnection from
eventlet that loops like that, while holding the interpreter lock.

Now, it could be fixed in eventlet, but let's try something more
natural: drop the eventlet's HTTP client. We do not use green
threads in the client anymore, so it's not like we need it for that.

Note that in most cases clients do not use the BufferedHTTPConnection
either, because it's only installed on Swift server nodes, not on
workstations. Get rid of that too.

bug: 959221
Change-Id: I1eb932779d4171598b3efaa043f817b9c6c995c4
2013-05-10 21:33:17 -06:00
YUZAWA Takahiko
073cd56218 Add end_marker and path query parameters
Fix Bug 1175057

Change-Id: I1bf65fa7c4d99ddb03dd183fe3862df93455f501
2013-05-05 20:52:02 +09:00
Jenkins
fcb3100b7d Merge "Confirm we have auth creds before clearing preauth" 2013-05-02 18:36:24 +00:00
Monty Taylor
50f32bc803 Switch to pbr for setup.
Change-Id: Ifc2efa2bd7c2f030b51494ccb471f0c3e097c5ce
2013-05-01 12:23:12 -04:00
Monty Taylor
1eb2c29856 Switch to flake8.
Change-Id: Ib9ba1e7eed09c5a90c558a8365d0a87c3f4b5ee5
2013-05-01 12:23:01 -04:00
Dirk Mueller
000e33d021 Improve Python 3.x compatibility
Some mechancical replacement of the deprecated except x,y:
construct with except x as y, which works with any Python
version >= 2.6

Change-Id: Ic245049dc7b408a5c89b9e27dfd2bd7c08acc5b5
2013-04-29 11:08:47 +02:00
David Shrewsbury
9aa52eecb5 Confirm we have auth creds before clearing preauth
If you use the API and supply only preauth values (preauthurl and
preauthtoken), and if either of these are incorrect, a non-descriptive
AttributeError will be thrown and uncaught:

 'NoneType' object has no attribute 'find'

The _retry() will fail on the first pass (getting 401), then try
to reauthenticate with non-preauth values. If those are not given,
particularly the auth url, then the urlparse() call will be supplied
None for the url in http_connection() causing the exception above.

This change makes sure that we have an auth url, user and key before
retrying authentication. Given the situation above, a '401 Unauthorized'
ClientException will now be thrown instead of the AttributeError.

Change-Id: Ie1b5bde1e8ff321aa18c0f23dbd2960d6e482236
2013-04-25 07:43:43 -04:00
Jenkins
2d97609a52 Merge "Static large object support." 2013-04-04 23:08:25 +00:00
Dean Troyer
fab61c8275 Improve auth option help
Add to the help strings to clarify the need for --os-auth-token to
also have --os-storage-url supplied.

Change-Id: I6a7259c38ce01813ae96f307efaf46e7863bd223
2013-04-04 15:41:22 -05:00
David Goetz
2b3d171907 Static large object support.
Also fixed bug with current large objects with segment listing prefixes.

Allow retry for object PUTs when possible.

Change-Id: I0edff127fd5d5c53da33aa7cb76a4f4dc85bf6e6
2013-04-03 09:51:15 -07:00
jola-mirecka
8ea9c4aae8 Fixed pep8 errors in test directory.
Files test_swiftclient.py and utils.py had all pep8 errors
fixed.

Also added tests directory to tox.ini file, so that
pep8 would monitor tests directory by default.

Change-Id: Id60a2cd88bd814d1dcbeca951764c9d236500837
Fixes: bug #1158819
2013-03-22 15:00:40 +00:00
Jenkins
4f57f815b3 Merge "Enhance put_object to inform when chunk is ignored" 2013-03-22 10:00:47 +00:00
Jenkins
42fa4568f1 Merge "Allow user to specify headers at the command line." 2013-03-21 11:11:50 +00:00
Jenkins
f31916051d Merge "Allow v2 to use storage_url/storage_token directly" 2013-03-19 18:36:04 +00:00
tong li
48f446a938 Allow user to specify headers at the command line.
Currently swift client does not allow content type to be specified
when upload an object. It does not allow a user to change content
type neither. This patch will allow a user to specify content
type by using upload command or modify the content type by using
post command.

For example:
1. To upload an object with specific content type:
swift upload -H content-type:applicaiton/xml con1 file1

2. To modify an object to a specific content type:
swift post -H content-type:application/josn con1 file1

This patch also allow a client to specify other request headers.

Change-Id: I12db83a1d465285e0906889cc67dfaa44e059568
Fixes: bug #1154621
2013-03-18 09:48:33 -04:00
jola-mirecka
d90b768e50 Enhance put_object to inform when chunk is ignored
Changed documentation for chunk_size parameter to indicate
that it can be used only with file like objects.

Also added a UserWarning when using a string contents to inform
that chunk_size will be ignored.

Added a unit test to check whether the warning is working
correctly.

Fixes: bug #1147232
Change-Id: I618ec45520ba81905ce2ead4d61f192d21ae3489
2013-03-06 15:38:50 +00:00
Jenkins
999e1c0f02 Merge "Added "/" check when list containers." 2013-02-28 02:58:28 +00:00
Jenkins
974f530bdb Merge "Allow to specify segment container" 2013-02-27 22:08:34 +00:00
Chmouel Boudjnah
45af829aa5 Allow v2 to use storage_url/storage_token directly
- Fixes bug 1134306.

Change-Id: Ie1737c57f57bcdad50b3096c921d46a1fe5293b8
2013-02-27 13:55:05 +01:00
Pete Zaitcev
d79c435bfe Add client man page swift.1
This is the byte-by-byte copy of swift.1 that was left behind
in the main Swift package when python-swiftclient was split away.
Apparently there is absolutely nothing to be changed in setup.py
and the distribution packagers are supposed to pick the page as-is
using their packaging systems.

Change-Id: I24f238501589db940574eac61b89a1422fe2fd77
2013-02-26 12:47:34 -07:00
yuan-zhou
9ac2c99fc6 Allow to specify segment container
Fix bug 1110924

Add segment container option as part of 'swift upload -S'. If this
option is omitted, the segments will go to <container>_segments.

Example:
$ swift upload c1 obj1 -S 1 -C user_segments

Please check swift upload --help for more details

Change-Id: Ib71aae322485d8d3ac89916d37ebcac053f49e3b
2013-02-26 11:09:34 +08:00
Jian Zhang
ec38637a35 Added "/" check when list containers.
If there is a "/" in container name, print usage.

Fixs bug 1121897.

Change-Id: I633b5b7ff3a8dbc249ddd3c65439dd46c7d93b4a
2013-02-24 19:10:53 -08:00