120 Commits

Author SHA1 Message Date
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
Jenkins
fcb3100b7d Merge "Confirm we have auth creds before clearing preauth" 2013-05-02 18:36:24 +00: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
Flaper Fesp
4ac431a9a2 Print useful message when keystoneclient is not installed
client.py now prints a useful message when trying to use Auth version
2.0 and keystoneclient is not installed.

Fixes bug 1102322

Change-Id: I6ed83610fd6e8c79c2dc5cf05db377a843cab1d5
2013-02-05 10:13:56 +01:00
Jenkins
b5f222b5d6 Merge "Use testr instead of nose." 2013-01-30 21:56:29 +00:00
Jenkins
8298803091 Merge "Fix reporting version." 2013-01-30 20:53:33 +00:00
Chmouel Boudjnah
9a484dfd63 Fix reporting version.
- Fixes bug 1102691.

Change-Id: I72749a1c87a1f337b45d193e923b437d12270b05
2013-01-22 16:32:50 +01:00
Jenkins
bf09dd9573 Merge "Update to latest oslo version/setup." 2013-01-21 21:50:21 +00:00
Jenkins
c194266096 Merge "Add generated files to .gitignore." 2013-01-21 21:19:12 +00:00
Monty Taylor
bfeffb6366 Use testr instead of nose.
nose is invasive and can sometimes alter the outcome of a test run. testr,
on the other hand, keeps a distinction between running tests and displaying
results of the test runs. Additionally, it supports the stock python unittest
protocol.

Even better, testr supports parallel test running, which makes things faster,
and a command "testr run --failing" which will just re-run the latest failing
tests (often something one wants to do in iterative dev)

Part of blueprint grizzly-testtools

Change-Id: I0b3f1bcb5d4ff59c65eb3219b30a9e64f54d70bd
2013-01-18 16:13:27 -05:00
Monty Taylor
8b80285da6 Update to latest oslo version/setup.
Change-Id: I7bd38b950ef9fea8b6eaa1df599085a1c64d8b61
2013-01-14 03:29:22 -08:00
Jenkins
3d04363ba4 Merge "Add env[SWIFTCLIENT_INSECURE]" 2013-01-10 20:10:30 +00:00
Monty Taylor
1aa712eaf2 Add generated files to .gitignore.
Change-Id: I609b98d3ffe576313d3206925a03b1657d3fbce9
2013-01-10 08:45:26 +00:00
You Yamagata
5edb40b442 Add env[SWIFTCLIENT_INSECURE]
Add env[SWIFTCLIENT_INSECURE] as default of --insecure option.
If set to 'true', allow to access insecure keystone server.
The name follows 'NOVACLIENT_INSECURE' in novaclient.

Change-Id: I322674eba9c07e6def97bce339815fa15191a92d
2013-01-10 13:26:53 +09:00
Chmouel Boudjnah
ab4282ebb4 Fix debug feature and add --debug to swift.
- Remove PYTHON_SWIFTCLIENT and use --debug making it more consistents
  with other openstack clients libraries.
- Fix printing the curl command.
- Don't show the body of the GET objects it could get bad on large
  objects and it's an iterator anyway.
- Use -I for showing HEADs (and not -X HEAD).

Change-Id: I954e7d3d795401fc3679725440dec36cdc80af87
2013-01-07 17:59:12 +01:00
Monty Taylor
e93d47a930 Use testtools as base class for test cases.
Part of blueprint grizzly-testtools

Change-Id: Iff9aac184a115df9b396e218209962e6897a32d9
2012-12-26 09:36:07 -06:00
Dean Troyer
f65f96bc59 Add --os-cacert
Add support to specify a ca certificate bundle to verify
keystone TLS (https) certificates.  This only verifies
certificates on the keystone connection, swift https
connections are unchanged.

Change-Id: I14351b405af4fd3d1970ba6656c1282a5d0a1082
2012-12-20 14:03:19 -06:00
Jenkins
7df9cadbf0 Merge "Add --insecure option to fix bug #1077869" 2012-12-09 09:19:33 +00:00
Jenkins
1662cbd0a3 Merge "Don't add trailing slash to auth URL." 2012-12-06 01:45:16 +00:00
You Yamagata
6a4dc039ff Add --insecure option to fix bug #1077869
If enable this option , swift CLI is allowed to access a keystone
server with self signed certificate.

Change-Id: I5e219fe875b246b68ac51a077e7ff15e95463adf
2012-12-05 13:26:37 +09:00
yuan-zhou
d702d00ab4 Don't segment objects smaller than --segment-size
Fix bug 1075184

Change-Id: I369e742ca802744ac20e3575828cfa881018de6d
2012-12-04 10:27:13 +08:00
Jenkins
4efe3bfa7e Merge "Adding segment size as another x-object-manifest component" 2012-12-03 19:41:46 +00:00
Juan J. Martinez
994c691d66 Don't add trailing slash to auth URL.
Adding a trailing slash to the authentication URL may interfere with
auth service implementations not using /FOO/ but /FOO as authentication
URL.

OpenStack Object Storage API 1.0 doesn't specify that the auth URL must
end in a slash and swiftclient.client doesn't force it either.

Change-Id: I4e6b6d758d5ccc884e253880513e3d8763ffc2ff
Fixes: bug #1085827
2012-12-03 10:20:33 +00:00
yuan-zhou
94511a0624 Adding segment size as another x-object-manifest component
Fix bug 1082930

Change-Id: I2cee91a8f74a3f58379b1b4aefae9401ba5b02c1
2012-11-27 15:33:50 +08:00
Nick Craig-Wood
402d87c757 Stop loss of precision when writing 'x-object-meta-mtime'
str(float) isn't a good way of converting a float to a string with all the precision

Eg

    >>> f = os.path.getmtime("z")
    >>> f
    1347717491.343554
    >>> str(f)
    '1347717491.34'
    >>> "%f" % f
    '1347717491.343554'

Change-Id: I6eb02f7f6730eff814c348d1039eae4606642b52
2012-11-18 11:42:18 +00:00
Jenkins
0053b4cf0e Merge "Remove unused json_request." 2012-11-16 23:19:59 +00:00
Jenkins
4cd4093bd6 Merge "Force utf-8 encode of HTTPConnection params" 2012-11-16 23:13:09 +00:00
Chmouel Boudjnah
8e63b53a9b Remove unused json_request.
- This has been long delegated to python-keystoneclient for auth 2.0.

Change-Id: I92b1fc2db68192cfeefd623c59882f65a4e4405c
2012-11-16 14:47:27 +10:00
Jenkins
015dc502a9 Merge "tell nose to explicity test the 'tests' directory" 2012-11-16 01:41:30 +00:00
Jenkins
5427f7f501 Merge "Fixes setup compatibility issue on Windows" 2012-11-15 22:01:46 +00:00
Christian Berendt
1bbee8189c fixed inconsistencies in parameter descriptions
Change-Id: I208c7fe97c8ec543b5e1cd230527d3eceb52570f
2012-11-13 08:41:42 +01:00
John Dickinson
b4272711ed tell nose to explicity test the 'tests' directory
Change-Id: Ib6afa775defc521794da627952edbf69721b0874
2012-11-08 16:55:15 +01:00
Alessandro Pilotti
7253133837 Fixes setup compatibility issue on Windows
Fixes Bug #1052161

"python setup.py build" fails on Windows due to a hardcoded shell path:
/bin/sh

setup.py updated using openstack-common/update.py

Change-Id: I763dd5613d91a2523087173b196500648c477fa6
2012-11-06 20:08:11 +02:00