698 Commits

Author SHA1 Message Date
Jenkins
e05464fbfa Merge "Fixed a typo in SwiftService API doc" 2016-06-01 20:06:10 +00:00
Jenkins
5981a69b01 Merge "Migrated contributing file from .md to .rst" 2016-06-01 18:50:31 +00:00
Nandini Tata
2e78ca5e75 Fixed a typo in SwiftService API doc
Fixed misspelled word in the Service API description.

Change-Id: I0bb6b2aa319ba217dd0d09a2c7a0d8eff9a67aff
2016-06-01 15:12:10 +00:00
Jenkins
f9d0657e70 Merge "Support client certificate/key" 2016-05-19 22:20:17 +00:00
Jenkins
8ffc5c11ae Merge "Use application/directory content-type for dir markers" 2016-05-19 08:53:50 +00:00
Jenkins
8da9cbf161 Merge "Correct doc string for http_conn argument" 2016-05-18 14:45:46 +00:00
venkatamahesh
659470e7d9 Update the home-page with developer documentation
Change-Id: I51734d7f8cabe02527c4f24305707dddf470d5f9
2016-05-17 14:32:47 +05:30
venkatamahesh
bf5846f9fd Migrated contributing file from .md to .rst
Change-Id: I80cbbced26906ac6ba9ae3faaba3a400e365be0d
2016-05-16 11:55:14 +00:00
Kota Tsuyuzaki
0225950c2a Correct doc string for http_conn argument
Previous doc string describes "http_conn" for a bunch of functions as
"HTTPConnection object" but it is actually "a tuple of (parsed_url,
HTTPConnection object)" so now this patch correct the mis-consistency.

Change-Id: I6ff90a941e6df6a1b3b5dc74fd5f4262654c9f0a
2016-05-12 21:39:14 -07:00
Jenkins
3a6c14981d Merge "Check responses when retrying bodies" 2016-05-11 07:52:47 +00:00
Jenkins
3faa99bac1 Merge "Tighten up testing for sloppy auth version" 2016-05-08 22:21:10 +00:00
Alistair Coles
a0d65e4ccd Tighten up testing for sloppy auth version
The existing test that os-identity-api-version=2 would
result in the correct auth_version=2.0 (note 2 -> 2.0)
does not verify the sloppy version handling code path.
When auth, key and user options are all missing the
auth version is always set to 2.0 so the test will always
pass. Adding auth, key and user options to the test command
will cause the test to verify that the os-identity-api-version
option was used and mapped to 2.0.

Change-Id: Ifa10cd2b8bf81c082d5e3fa846f993871194fea0
2016-05-05 15:25:16 +01:00
Tim Burke
fd5579a154 Check responses when retrying bodies
Previously, if a Range request came back 200 OK (rather than 206 Partial
Content), we would mangle the response body. This could happen if there
was a middleware that would silently drop Range headers, for example.

Now, if the response does not include a Content-Range header, we will
log a warning and seek to our previous position in the stream. If the
Content-Range header has an unexpected value, we will raise an exception.

Change-Id: I94d4536cc1489968d45a2b6ba7edd70c85800275
2016-05-04 15:21:26 -07:00
Tim Burke
67f629cdeb Default to v3 auth if we find a (user|project)-domain-(name|id) option
Change-Id: I4616492752b620de0bf90672142f1071ec9bac83
2016-05-03 14:41:07 -07:00
Tim Burke
c3766319b9 Pull option processing out to service.py
...because it seems silly that we do nearly the same thing in two
different places

Change-Id: Iafafe3c553d00652adb91ceefd0de1479cbcb5da
2016-05-03 14:18:34 -07:00
Tim Burke
5b714f104d Parse options to dict
This is a first step toward unifying the options parsing magic between
shell.py and service.py

Change-Id: If001e07978c0bae729ac0cd9b2c2934092c98447
2016-05-03 14:03:15 -07:00
Jenkins
c26dec66f6 Merge "Add tests for thread option validation" 2016-05-02 21:11:57 +00:00
Jenkins
6b065dd4a6 Merge "Identify segments uploaded via swiftclient" 2016-05-02 10:35:20 +00:00
Jenkins
38af5b1733 Merge "Add new doc structure and contents for swiftclient" 2016-04-29 20:18:32 +00:00
Joel Wright
3a5a25fe98 Add new doc structure and contents for swiftclient
As a result of the Hackathon we have produced a new
documentation structure for the python-swiftclient.
This patch introduces the new structure and adds the
required content.

The intention is to document the CLI, the SwiftService
and Connection API. Importantly, we also provide
guidance on important considerations when using a swift
object store, such as which aspect of the python-swiftclient
to use for various use cases, common authentication patterns
and some useful examples.

Co-Authored-By: Alexandra Settle <alexandra.settle@rackspace.com>
Co-Authored-By: Mohit Motiani <mohit.motiani@intel.com>
Co-Authored-By: Hisashi Osanai <osanai.hisashi@jp.fujitsu.com>

Change-Id: I9eb41f8e9137efa66cead67dc264a76a3c03fbda
2016-04-29 19:21:36 +01:00
Jenkins
ab636c1ee3 Merge "Fix downloading from "marker" item" 2016-04-14 02:02:34 +00:00
Cedric Brandily
450f505c35 Support client certificate/key
This change enables to specify a client certificate/key with:
 * usual CLI options (--os-cert/--os-key)
 * usual environment variables ($OS_CERT/$OS_KEY)

Closes-Bug: #1565112
Change-Id: I12e151adcb6084d801c6dfed21d82232a3259aea
2016-04-10 23:20:49 +02:00
Sergey Gotliv
909bdf8954 Fix downloading from "marker" item
The documentation of "swift download" hints that "marker" option
is supported, but in reality we forgot to patch it through, so
all downloads were always done with the default, empty marker.

Closes-Bug: #1565393
Change-Id: I38bd29d2baa9188b61397dec75ce1d864041653c
2016-04-08 20:55:18 -06:00
Tim Burke
9fd537a082 Use application/directory content-type for dir markers
Previously, we were using a content-type of text/directory, but that is
already defined in RFC 2425 and doesn't reflect our usage:

   The text/directory Content-Type is defined for holding a variety
   of directory information, for example, name, or email address,
   or logo.

(From there it goes on to describe a superset of the vCard format
defined in RFC 2426.)

application/directory, on the other hand, is used by Static Web [1] and
is used by cloudfuse [2]. Seems like as sane a choice as any to
standardize on.

[1] https://github.com/openstack/swift/blob/2.5.0/swift/common/middleware/staticweb.py#L71-L75
[2] https://github.com/redbo/cloudfuse/blob/1.0/README#L105-L106

Change-Id: I19e30484270886292d83f50e7ee997b6e1623ec7
2016-04-08 16:57:51 -07:00
Tim Burke
4a6fa02c28 Identify segments uploaded via swiftclient
...using a new "application/swiftclient-segment" content-type.

Segments uploaded by swiftclient are expected to have a many-to-one
relationship to large objects, rather than the more-general many-to-many
relationship that SLO and DLO generally allow. Later, we may use this
information to make more intelligent decisions, such as when to
automatically clean up segments.

Change-Id: Ie56a3aa10065db754ac572cc37d93f2c901aac60
2016-04-08 13:41:29 -07:00
Jenkins
015903e383 Merge "Port from optparse to argparse" 2016-04-08 09:36:31 +00:00
Tim Burke
17aa6c789e Port from optparse to argparse
Why now?

* argparse was introduced in Python 3.2 and back-ported to Python 2.7.
  Until we dropped Python 2.6 support, we were stuck on optparse.

* keystoneauth.loading.cli provides register_argparse_arguments and
  load_from_argparse_arguments helper methods. Now that we're moving
  toward Keystone Session support, argparse seems required.

Closes-Bug: 1553030
Change-Id: I5139fb64a8631a3010680090fd04345f95c55c7b
2016-04-06 14:20:27 -07:00
Tim Burke
f86b2d8138 Clean up some unnecessary variables
Change-Id: Iac93ced6344d4a6fee7e6390e891fde765814c03
2016-03-24 13:06:42 -07:00
Marek Kaleta
51a8a5a7ae Fix SwiftPostObject options usage in SwiftService
SwiftService().post(cont, [SwiftPostObject(obj, options]) currently
ignores options['header'], raises exception when options['headers']
is set and make malformed metadata when options['meta'] is set.

Fix tipos in code, add unittest for SwiftService().post
Closes-Bug: #1560052

Change-Id: Ie460f753492e9b73836b4adfc7c9c0f2130a8a91
2016-03-23 15:38:10 +01:00
Jenkins
8db46ddce3 Merge "Move python-keystoneclient to "extras"" 2016-03-21 16:41:25 +00:00
Jenkins
a879e46cb7 Merge "Removes redundant "to"" 2016-03-18 11:40:40 +00:00
Jenkins
39e017d807 Merge "Initialize delete_object mock *before* creating all the threads" 2016-03-18 10:43:09 +00:00
Nguyen Hung Phuong
67db1646a3 Removes redundant "to"
This patch removes "to" in swift guide.

Change-Id: I4104bd3651947e341e1ed06c76b3f8f66f565c3f
2016-03-18 16:18:12 +07:00
Tim Burke
d2bd2f0859 Initialize delete_object mock *before* creating all the threads
Previously, we'd occasionally get spurious failures like

    FAIL: test_delete_account (tests.unit.test_shell.TestShell)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File ".../mock/mock.py", line 1721, in _inner
        return f(*args, **kw)
      File ".../mock/mock.py", line 1305, in patched
        return func(*args, **keywargs)
      File ".../tests/unit/test_shell.py", line 788, in test_delete_account
        response_dict={})], any_order=True)
      File ".../mock/mock.py", line 983, in assert_has_calls
        ), cause)
      File ".../six.py", line 718, in raise_from
        raise value
    AssertionError: (call(u'container', u'object', query_string=None,
                          response_dict={}),)
    not all found in call list

Related-Bug: #1539536
Related-Bug: #1480223
Change-Id: I810894545ca74d3b2f2dbde2d0388eb69c2ba710
2016-03-17 15:43:45 -07:00
Jenkins
c4ce65f2d2 Merge "Include response headers in ClientExceptions" 2016-03-17 22:20:35 +00:00
Jenkins
985c038209 Merge "Check threads number options validation" 2016-03-17 22:10:01 +00:00
Tim Burke
f5224a696e Add tests for thread option validation
Change-Id: If84714c7ea6be1c95c5898a82db2d4b6c9637242
2016-03-17 12:39:44 -07:00
Tim Burke
52eab61e7e Move python-keystoneclient to "extras"
This should make it more clear to users that they may want to install
it.

Change-Id: I8bb4f3eba1fc6d2b7b23c3bd51663678e755a69e
2016-03-07 11:21:33 -08:00
Min Min Ren
965fd4d3fc Initialise delete_object mock before it's called
Fix the linked bug. delete_object mock should be before it's
called by swiftclient.shell.main function.
Related: https://review.openstack.org/221219

Change-Id: I52143a93c129764c02bba05267f3563c824e82cb
Partial-Bug: #1480223
2016-03-05 03:05:23 +08:00
Jenkins
b65d994937 Merge "Drop *.dbm* before running tests" 2016-03-04 17:40:37 +00:00
Tim Burke
9b8ab67a78 Include response headers in ClientExceptions
Now, client applications can get to things like transaction IDs for
failures without needing to turn on all of logging.

While we're at it, add a from_response factory method for
ClientException.

Co-Authored-By: Alexander Corwin <ancorwin@gmail.com>
Change-Id: Ib46d5f8fc7f36f651f5908bb9d900316fdaebce3
2016-03-03 17:16:33 +00:00
Jenkins
343ecbcfa2 Merge "Drop py33 support" 2016-03-03 04:38:28 +00:00
Pete Zaitcev
f179c36aea Drop *.dbm* before running tests
See change I74fb5122e80a223aaa70afaeec7a7c585aa33577 for the
previous discussion. But basically, if you run tox -e py27
then tox -e py34, the latter fails with "db type could not
be determined", because of stuck .testrepository/times.dbm.

This patch fixes it by clearing the *.dbm*. Should be safe
as long as periods aren't used commonly in stable file names.

Change-Id: I617eca308261f291c510c8cbd432779f1c00b182
2016-03-02 08:59:59 -07:00
John Dickinson
e4d0cc7419 bumped version at request of release team
Change-Id: I81eb6575ef5de8ecc75e781f07ad090024589cec
2016-03-02 12:00:05 +00:00
Jenkins
c023893dd3 Merge "download method shouldn't download all object" 2016-03-02 11:15:11 +00:00
Jenkins
cd3a4dbf0a Merge "Drop testtools from test-requirements.txt" 2016-03-01 17:51:32 +00:00
Jenkins
d70b8266cb Merge "Minor edits to the api page" 2016-02-29 20:03:49 +00:00
Hu Bing
b7d20b8a18 download method shouldn't download all object
in python-swiftclient/swiftclient/service.py,
there is a method
def download(self, container=None, objects=None, options=None):

if container is specified but objects not, it download all
objects in specified container.
if both container and objects are specified, it download all
specified objects in the container.

when it comes to the case that, objects argument is specified,
but it turned out to be empty array [ ], the download method
download all the objects under specified container.
this may be not reasonable.

for example,
the objects was not empty when it came from command line,
but it's filtered, maybe by --prefix argument.
at last, it turned out to be empty array.

when calling download method with objects arguments
being empty array, we should download nothing instead of
all the objects under the specified container.

Change-Id: I81aab935533a50b40679c8b3575f298c285233a8
Closes-bug: #1549881
2016-03-01 03:10:34 +08:00
Jenkins
b040ce4e1a Merge "Fix wrong args for get_container with full listing" 2016-02-29 16:26:58 +00:00
Jenkins
9460a94624 Merge "Have tox manage LANG environmental var" 2016-02-29 13:58:25 +00:00