503 Commits

Author SHA1 Message Date
Zack M. Davis
3cd1faa7af make Connection.get_auth set url and token attributes on self
When a Connection is first __init__ialized (without providing a
preauthurl or preauthtoken), the url and token attributes are None; they
get set (to be reused on future requests) after one of the wrapper
methods internally using _retry (head_account, get_container,
put_object, and similar friends) is called. However, this had not been
the case for get_auth, much to the momentary confusion and
disappointment of programmers using swiftclient who expected to be able
to get the token or storage URL off the Connection object after calling
get_auth (perhaps in order to make an unusual kind of request that
swiftclient doesn't already have a function for). This commit makes
get_auth set the url and token attributes as one might expect.

Change-Id: I0d9593eb5b072c8e3fa84f7d5a4c948c0bc6037a
2015-07-24 10:57:29 -07:00
Jenkins
63998b481c Merge "Python 3: Replacing unicode with six.text_type for py3 compatibility" 2015-07-16 19:18:33 +00:00
Jenkins
a56eac13b1 Merge "Always decode command-line arguments as UTF-8" 2.5.0 2015-07-16 11:27:31 +00:00
Jenkins
c3b57f431c Merge "Properly test raw writes in Python 3" 2015-07-16 11:25:36 +00:00
Jenkins
dd45ae542b Merge "add tempurl command to swift.1 man page" 2015-07-13 23:47:35 +00:00
Zack M. Davis
ca70dd9e15 add tempurl command to swift.1 man page
Change-Id: Ifccc7f6dc049ca0ac2c53c00b1704cff4d1a770f
Closes-Bug: #1450606
2015-07-13 11:38:58 -07:00
Jenkins
de3fe02ba7 Merge "Correct the help message of swift tempurl" 2015-07-11 06:47:09 +00:00
Jenkins
605ec92507 Merge "Add some bash helpers for auth stuff" 2015-07-11 06:41:45 +00:00
Jenkins
0b592caabf Merge "Add ability to download objects to particular folder." 2015-07-11 06:21:40 +00:00
Tim Burke
87c0a83988 Update mock requirements
The last version supporting python 2.6 was 1.0.1.

Change-Id: Ib7d51157f9654d240cdd67a0a1e6fcb14a70c84a
2015-07-10 13:56:48 -07:00
Charles Hsu
d5d3127744 Add ability to download objects to particular folder.
This patch adds "--output-dir" and "--remove-prefix" options
to the "download" command and unit tests for it.

Example:

    $ swift list example --prefix swift2.2
    swift2.2/bin/swift-object-auditor
    swift2.2/bin/swift-object-expirer
    swift2.2/bin/swift-object-info
    swift2.2/bin/swift-object-replicator
    swift2.2/bin/swift-object-server
    swift2.2/bin/swift-object-updater

When given "--output-dir <directory>", client downloads objects to <directory>.

    $ swift download example --prefix swift2.2 \
                    --output-dir new/swift/dir

    The folder structure:
    .
    └── new
        └── swift
            └── dir
                └── swift2.2
                    └── bin
                        ├── swift-object-auditor
                        ├── swift-object-expirer
                        ├── swift-object-info
                        ├── swift-object-replicator
                        ├── swift-object-server
                        └── swift-object-updater

When given "--remove-prefix", client downloads objects without <prefix>.

    $ swift download example --prefix swift2.2 \
                    --remove-prefix \
                    --output-dir swift

    The folder structure:
    .
    └── swift
        └── bin
            ├── swift-object-auditor
            ├── swift-object-expirer
            ├── swift-object-info
            ├── swift-object-replicator
            ├── swift-object-server
            └── swift-object-updater

Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com>
Change-Id: I7463fe2941cc94f9a50a4756a97c2ccdf946294d
Implements: blueprint swiftclient-download-pseudo-folder-to-specific-target
2015-07-08 14:23:05 +08:00
Tim Burke
bb252130ac Always decode command-line arguments as UTF-8
There was always an implicit assumption that they were UTF-8 before, and
by converting them to unicode we close another hole allowing raw bytes
to appear in user-facing messages.

Closes-Bug: #1431866
Change-Id: If2e41d9a592c3ad02818e9c6f0959fd4b73cd0e0
2015-07-07 15:39:55 -07:00
Tim Burke
cf0b6c03df Properly test raw writes in Python 3
Previously we were trying to test writing bytes in Python 3 using only
native (unicode) string objects. That doesn't test what we thought we
were testing.

Change-Id: I10a0a38143d7f7d850ab9a7005ad87f5d314c375
2015-07-07 15:39:02 -07:00
Jenkins
92b8277752 Merge "SwiftClient object upload beginning with / or "./"" 2015-07-07 22:21:38 +00:00
Jenkins
249dd1a393 Merge "Added check for negative segment-size" 2015-07-07 01:36:50 +00:00
Jenkins
2a62dd88ff Merge "Document missing functional test config option" 2015-07-02 02:39:43 +00:00
Jenkins
795476e013 Merge "Run functional tests using keystone auth options" 2015-07-02 00:14:41 +00:00
Jenkins
f5fa154f6d Merge "Add passenv to tox.ini to make functests run with tempauth" 2015-07-02 00:14:38 +00:00
Jenkins
29e5c5656e Merge "Add connection release test" 2015-07-02 00:04:52 +00:00
Jenkins
0df888ea55 Merge "Remove all DLO segments on upload of replacement" 2015-07-02 00:04:50 +00:00
Tim Burke
70afe207cf Bump hacking in test-requirements
The gate-swiftclient-dsvm-functional job takes updates from
openstack/requirements and tries to run functional tests against them.
However, the global requirements recently added environment markers
(like "futures>=3.0;python_version=='2.7' or python_version=='2.6'")
which require pbr>=1.2. pbr was getting capped at 1.0 by hacking<0.9, so
bump it to get newer pbr.

Change-Id: I10af36602d23db78c2863d84c0012835b310bbdd
2015-07-01 11:11:53 -07:00
YangLei
91855bd912 Correct the help message of swift tempurl
correct the help message of swift tempurl
use <> instead of [] in Positional arguments.

Change-Id: Ib60ce97cef03e0423082c497604525eba2300fa9
2015-06-30 15:10:44 +08:00
janonymous
ef467ddee4 Python 3: Replacing unicode with six.text_type for py3 compatibility
The "unicode" type was renamed to "str" in Python 3.
Use six.text_type to make swiftclient compatible with Python 3.

For more information about changes needed for py3
compatibility, see:
https://wiki.openstack.org/wiki/Python3

Change-Id: Ic65607a69935652a1874340928f626fbcc35c014
2015-06-28 07:40:26 +05:30
Pradeep Kumar Singh
e596489020 Added check for negative segment-size
Closes-Bug: #1453135

Change-Id: Ia9c2b27d998e6ac1889cc74c12e456c06ecd84d9
2015-06-23 10:50:34 +09:00
Clint Byrum
7c716997a8 Fix docstring typo for SwiftService.upload
The option from argparse in shell is 'header' and that is what is used
in the code.

Change-Id: I5c889192ef7c46c299dc0ec7cbc7c4d027dae6d5
2015-06-18 09:04:33 -07:00
Pradeep Kumar Singh
794b125e76 SwiftClient object upload beginning with / or "./"
Currently SwiftClient populate response dictionary before
removing "./" or "/" at begining of object name. This patch
fixes that by changing that order.

Closes-bug: #1412425
Change-Id: I80222754caba5d42a468f4677ac539e46682dd31
2015-06-17 12:27:43 +05:30
Clay Gerrard
17feec709c Add some bash helpers for auth stuff
Change-Id: If61ac9a050e7a115f37dbf4e74b904ac5dfd2052
2015-06-15 12:38:21 -07:00
Andreas Jaeger
e48f487335 Fix inconsistent usage of "Positional argument"
All help texts uses "Positional argument" with the exception of tempurl.
Update tempurl to use this as well so that the formatting tools work
fine and can show this nicely on
http://docs.openstack.org/cli-reference/content/swiftclient_commands.html#swiftclient_subcommand_tempurl
like it's done for other options.

Change-Id: Ib5502c23b236986bea5a4d4a63a46fca411a8494
Closes-Bug: #1463081
2015-06-08 20:20:21 +02:00
Christian Schwede
7f2ee7322b Add connection release test
This patch adds a small test to ensure a connection
is released after all chunks have been consumed.

It's a follow up to commit 8756591b and added to ensure
there will be no regression in the future (this test
fails also with that patch not applied).

Change-Id: I6a6fcd26879eb2070f418c8770a395ff6c30aa51
2015-06-05 07:17:31 +00:00
Alistair Coles
f0aad4c364 Run functional tests using keystone auth options
Makes the existing functional tests run using three
auth modes: tempauth (v1), keystone v2 and keystone v3.
The latter uses an account in a non-default domain
(which exists in devstack setup).

This should help avoid regressions in handling different
auth options.

Change-Id: Ifee6a4fa418242892bf73eda5e2cad7b803b1bee
2015-06-04 12:54:43 +00:00
Jenkins
ec3e2ab3a0 Merge "Allow reading from object body on download" 2015-06-04 12:08:07 +00:00
Alistair Coles
259b434ae2 Add passenv to tox.ini to make functests run with tempauth
Since tox version 2.0.0 env vars are not passed to the test
env, which means that the SWIFT_TEST_CONFIG_FILE var is not
passed in to tox -e func env. That means that both times
tox -e func runs it is using keystone auth, and never using
tempauth.

Related-Bug: 1455102

Co-Authored-By: Christian Schwede <cschwede@redhat.com>

Change-Id: I23dcdbcde0bf8adc9429eb2d294a2c778005d136
2015-06-03 17:45:14 +01:00
Alistair Coles
f0cc3be2ac Make default get_auth timeout be None
Setting timeout to a default of False in get_auth()
results in a requests timeout of 0.0 in keystoneclient,
which causes a connection failure.

This bug will cause func tests to not run when using
keystoneauth.

Added unit tests to verify correct default timeout is set
in get_auth().

Drive-by: remove what seems like a stale TODO comment

Change-Id: I17c781ce160a682b1768d315422ade0cdd2df198
2015-06-03 12:03:30 +01:00
Alistair Coles
71a1835193 Document missing functional test config option
Adds doc for account_username option to sample test.conf.
This option was added in [1].

[1] change id Ic484e9a0c186c9283c4012c6a2fa77b96b8edf8a

Change-Id: Ic86b274e9d954822da521360981f796d61efaad9
2015-06-02 11:13:38 +01:00
Jenkins
49483a3b11 Merge "Compare each chunk of large objects when downloading" 2015-06-01 17:18:21 +00:00
Jenkins
bcca25a2c8 Merge "Stop decoding object content" 2015-05-29 08:13:16 +00:00
Tim Burke
ff0b3b02f0 Compare each chunk of large objects when downloading
This allows the use of --skip-identical when downloading SLOs and DLOs,
while still only requiring one request for normal objects.

Change-Id: I237ec5a8cc4d1119b6d3f166db81a977a50a4e4e
Related-Bug: #1379252
2015-05-27 17:40:24 -04:00
Jenkins
c15e81af9b Merge "be more explicit in the --version CLI option" 2015-05-26 20:09:04 +00:00
Tim Burke
7d5c85ad10 Stop decoding object content
Previously, we had urllib3 (via requests) automatically decode all
responses with a Content-Encoding of deflate or gzip. This included
object downloads, which would in turn cause etag or content-length
mismatch errors. (See bug 1338464)

This was apparently added in response to a third-party proxy sitting
between the client and server which, having observed that the client
would accept gzip-encoded content while the server sent an unencoded
response, would perform the compression. (See bug 1282861)

Now, we'll no longer let requests send any default headers, nor do any
decoding.

Change-Id: I6cc30a5c12e37de06d7322533a3c36ad15397cc8
Closes-Bug: 1338464
Related-Bug: 1282861
2015-05-22 13:24:46 -07:00
Tim Burke
317df7e527 Remove simplejson dependency
In addition to removing an unnecessary dependency, this closes another
hole that was allowing raw bytes to appear in user-facing messages.

Change-Id: Ia0b76426a38e5a5c368c4c7e7ba2aef286758aca
2015-05-20 18:14:53 -07:00
Jenkins
52b849217f Merge "Add tests for uploads deleting DLO segments" 2015-05-21 00:47:28 +00:00
Jenkins
53432b5739 Merge "Add test for timeout being passed to keystone client" 2015-05-21 00:44:51 +00:00
John Dickinson
888bf6f1a0 be more explicit in the --version CLI option
Change-Id: I14f33c7ea90ab1fe58aa67f1ff70e527c88cd141
2015-05-13 16:46:14 -07:00
Jenkins
1aebb7ccc5 Merge "Use a socket timeout in get_auth" 2015-05-04 19:28:15 +00:00
Jenkins
766cf73247 Merge "Compare each chunk of large objects when uploading" 2015-04-30 18:48:59 +00:00
Alistair Coles
a39e18ff5a Add test for timeout being passed to keystone client
Extends existing unit test for timeout being passed to get_auth
to cover v2.0 auth when keystone client should get the timeout
kwarg.

Related-Bug: 1447847
Change-Id: Ie9cfc86fa2156b94b45d290ac12e3f71b20d6c4f
2015-04-28 16:58:23 +01:00
Pete Zaitcev
e2f41a6635 Use a socket timeout in get_auth
A previous change added socket timeouts, but they weren't plumbed
through to the get_auth code path. Make sure we're passing them along
everywhere.

Original-Author: Monty Taylor <mordred@inaugust.com>
Change-Id: I398241898248e66d1f8c436c8ed2ec7a0e9387f6
Closes-bug: 1447847
2015-04-26 01:37:15 -06:00
Jenkins
ea6d2bf74d Merge "Add socket-level read timeout parameter" 2015-04-24 01:18:49 +00:00
Jenkins
3105cdc4f8 Merge "Include unsupported url scheme with ClientException" 2015-03-31 22:18:44 +00:00
Monty Taylor
f5a473edfc Add socket-level read timeout parameter
The underlying requests library supports a timeout input parameter. The
other python-*client libraries support passing it in, so while working
on shade, it seemed like a great idea to be able to pass in timeout to
swiftclient too. For reference, there's a change in shade:
I095c1240693abf024bda2315dd77f4400b24a45b that shows interaction with
the other libs, and a tentative patch that would consume this one.

Change-Id: I699ebb1e092aa010af678de7ba15712da6ed5315
2015-03-30 17:01:02 -04:00