68 Commits

Author SHA1 Message Date
Jenkins
eedb0d4ab5 Merge "Fix crash when downloading a pseudo-directory" 2014-08-17 19:08:15 +00:00
Pete Zaitcev
3d56b65c89 Fix crash when downloading a pseudo-directory
If a user creates an object with name ending with a slash, then
downloading such container ends in a traceback like this:

..............
test5g.file [auth 1.516s, headers 1.560s, total 244.565s, 22.089 MB/s]
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/swiftclient/multithreading.py", lin
    result = self.func(item, *self.args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/swiftclient/shell.py", line 403, in
    fp = open(path, 'wb')
IOError: [Errno 21] Is a directory: 'first-pseudo-folder/'

The proposed fix is not to save this object. Note that the contents of
the object are available with --output option, as before. Only the
crash is fixed.

Even though we do not use the contents, we download the object and
check its Etag, in case. We also create a corresponding directory,
in case the pseudo-directory contains no objects.

The format of printout is changed, so user realizes easier when
pseudo-directory convention is in effect. Note that this is not a
compatibility issue because previously there was crash in such case.

Change-Id: I3352f7a4eaf9970961af0cc84c4706fc1eab281d
2014-08-14 13:57:53 -06:00
anc
cae12940b1 Add keystone v3 auth support
Enables swiftclient to authenticate using
the keystone v3 API, allowing user id's, user
domains and tenant/project domains to be
specified.

Since swiftclient imports keystoneclient, the
main changes in swiftclient/client.py are to
selectively import the correct keystoneclient
library version and pass a number of new
options to it via the get_auth() function. In
addition the get_keystoneclient_2_0 method
has been renamed get_auth_keystone to better
reflect its purpose since it now deals with
both v2 and v3 use cases.

In swiftclient/shell.py the new options are
added to the parser. To make the default help
message shorter, help for all the --os-*
options (including the existing v2 options)
is only displayed when explicitly requested
usng a new --os-help option.

A new set of unit tests is added to
test_shell.py to verify the parser. A comment
in tests/sample.conf explains how to
configure the existing functional tests to
run using keystone v3 API.

Note that to use keystone v3
with swift you will need to set
auth_version = v3.0 in the auth_token
middleware config section of
proxy-server.conf.

Change-Id: Ifda0b3263eb919a8c6a1b204ba0a1215ed6f642f
2014-07-23 16:55:38 +01:00
Alistair Coles
394cb57f63 Fix context sensitive help for info and tempurl
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
2014-07-21 15:27:40 -07:00
Jenkins
f9ea672322 Merge "Allow to specify storage policy when uploading objects" 2014-07-21 21:43:59 +00:00
Jenkins
4cc2201e21 Merge "Adding Swift Temporary URL support" 2014-07-18 03:22:41 +00:00
Yuan Zhou
defdf1929c Allow to specify storage policy when uploading objects
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
2014-07-17 11:44:03 +08:00
Josh Gachnang
def0e0a643 Adding Swift Temporary URL support
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
2014-07-11 13:05:22 -07:00
Mark Seger
0e302d3d3a Add context sensitive help
Change-Id: I9aaadbaba2c43a12a83f8200eaaa96f48c52028e
2014-06-25 14:36:38 +00:00
Jenkins
09eb1843f1 Merge "fixed typos found by RETF rules" 2014-05-16 15:41:30 +00:00
Christian Berendt
2d30656f41 fixed typos found by RETF rules
rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos

Change-Id: I98b6e46cb84962ffdac02e9007b5ad3b30bc2817
2014-05-12 12:02:32 +02:00
Andreas Jaeger
9340122817 Add "." for help strings
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
2014-05-08 16:51:51 +02:00
Chmouel Boudjnah
8830c81db7 Use quote/unquote from six module for py3
Change-Id: I42cff32fbf3febd6dd6a7171b9214f93b4414f9a
2014-04-17 12:04:43 -04:00
Florent Flament
1eaf4c549f Update help message to specify unit of --segment-size option.
Change-Id: Ic3f9a733329c19c4e0bb85676da28a8d1d74232b
Closes-Bug: 1302566
2014-04-04 15:10:40 +00:00
Jenkins
132c643156 Merge "Removed usage of tuple unpacking in parameters." 2014-04-02 19:55:59 +00:00
Alex Gaynor
1d0c97fdb3 Replaced print statements with print function.
This is needed for Python3 compatibility.

Change-Id: Iadd21e4b3a936b601a69f1db2aba8e1597f13fc3
2014-03-30 12:56:43 -07:00
Alex Gaynor
97662952fd Removed usage of tuple unpacking in parameters.
Replaced it with traditional tuple unpacking. Needed for Python 3 support.

Change-Id: I714f32859f9b1ec7216eae777ea8968b5826af3b
2014-03-30 12:50:12 -07:00
Christian Schwede
100419c0b3 Make bin/swift testable part 1
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
2014-03-25 11:32:51 +00:00