If the supplied path is not of the form /v1/a/c/o then
swift tempurl subcommand will now return an error message.
Also removes redundant check for seconds parameter being an int
from shell.py because the same check is made when calling
utils.generate_temp_url.
Drive-by fix for missing param definition for generate_temp_url.
Change-Id: I41f4389948b01fadaa5fc4939ea12e0ed2167345
Related-Change: I0fb2ce125fe12d660e4deb778265016bdd5ff31b
Some tests used incorrect order assertIs(observed, expected).
The correct order expected by testtools is
assertIs(expected, observed, message='')
Assert that expected is observed.
Parameters:
expected The expected value.
observed The observed value.
message An optional message describing the error.
https://docs.python.org/2/library/unittest.html
Change-Id: I5f406336b7804c13ca042dd0c6b30645a711c5f2
In usage messages, it only makes sense to have an
object option if the container option has been specified.
Fixes the parentheses to indicate this.
Change-Id: I550ba99879ea6ce5489617a94cec36b66be270c8
Related-Change: Ie84a90eb0278dd2cdf5775948572bb140f8d2c4b
When printing the help menu for Swift commands, it is confusing to see
both positional arguments and options not distinguished. The
positional arguments are supposed to be enclosed in angular braces <>,
options in square braces [] and optional positional arguments in [<>].
Change-Id: Ie84a90eb0278dd2cdf5775948572bb140f8d2c4b
Currently the options help, info and debug must exist in the options
dictionary; however it might be that this is not the case if a method is
imported externally. This patch fixes this.
Also support using a storage URL or path as an argument for tempurl, and
adding a test to verify correct output in both cases.
Related-Bug: 1607519
Related-Bug: 1607523
Closes-Bug: 1607521
Change-Id: I0fb2ce125fe12d660e4deb778265016bdd5ff31b
Previously, we would accept gzip-encoded responses, but only because we
were letting requests decode *all* responses (even object data). This
restores the previous capability, but with tighter controls about which
requests will accept gzipped responses and where the decoding happens.
Change-Id: I4fd8b97207b9ab01b1bcf825cc16efd8ad46344a
Related-Bug: 1282861
Related-Bug: 1338464
Swift has commands including 'swift tempurl' and 'swift auth',
but it has no 'swift tempurl' and 'swift auth' in doc/source/cli.rst.
Therefore, I add them and their examples.
Change-Id: I9a935b648556e2718727d25ac553c860ebbadd82
Previously, they appeared in the table of contents, which seemed unnecessary.
Additionally, de-dent the bullet list for stat since it looked weird.
Change-Id: Ief5d480beb4a7daa2fd87c27019601332f087602
Recently, requests got a bit more picky about what types of data it will
accept as header values [1]. The reasons for this are generally sound;
str()ing arbitrary objects just before pushing them out a socket may not
do what the developer wanted/expected.
However, there are a few standard types that developers may be sending
that we should convert for them as a convenience. Now, we'll convert all
int, float, and bool values to strings before sending them on to
requests.
Change-Id: I6c2f451009cb03cb78812f54e4ed8566076de821
Closes-Bug: 1614932
This patch fixes a missing code-block section in the
capabilities section of service-api.rst, and fixes
the import of walk in the upload.py examples to support
both python2 and python3.
Change-Id: I572769f971f84e0029f2948e42c130e73517f434
Setting c.get_auth_keystone = fake_get_auth_keystone is setting a new
method on the module. This information is not reset between test runs
and therefore has the potential to corrupt other tests.
Use mock patch so that the mock is reset after the test is complete.
Change-Id: Ifb9ba72634cf477c72dda080b5aed8f8e3a7ac89
Implement copy object method in swiftclient Connection, Service and CLI.
Although COPY functionality can be accomplished with 'X-Copy-From'
header in PUT request, using copy is more convenient especially when
using copy for updating object metadata non-destructively.
Closes-Bug: 1474939
Change-Id: I1338ac411f418f4adb3d06753d044a484a7f32a4
New versions of requests will raise an InvalidHeader error otherwise.
Change-Id: Idf3bcd8ac359bdda9a847bf99a78988943374134
Closes-Bug: #1614280
Closes-Bug: #1613814
This lets us do things like:
$ swift info --json | jq '[.swift.policies[].name]'
[
"Standard-Replica",
"EC"
]
Also, escape more dashes in the man page, so they won't be
misinterpreted as hyphens.
Change-Id: Ic7690bdbcfc55f55e5dde9bc11bb0644085973ce
Previously, we weren't encoding paths and keys as UTF-8, which would
trigger a UnicodeEncodeError on py27.
Change-Id: I2fad428369406c2ae32343a5e943ffb2cd1ca6ef
The 'swift' command from v3.0.0 does not work in Python 2.6,
bacause some code is incompatible with Python 2.6
This patch is to add a constraint of python version
Change-Id: I5197cba0c2cd3135d08498df827a52f8bba98d4d
Closes-bug: #1590334
In Python 3 __ne__ by default delegates to __eq__ and inverts the
result, but in Python 2 they urge you to define __ne__ when you
define __eq__ for it to work properly [1].There are no implied
relationships among the comparison operators. The truth of x==y
does not imply that x!=y is false. Accordingly, when defining
__eq__(), one should also define __ne__() so that the operators
will behave as expected.
[1]https://docs.python.org/2/reference/datamodel.html#object.__ne__
Change-Id: I5485022f010cdcb88c0d4ebe5c44a39a1bf242b0
Added functionality for arbitrary query strings to be passed into container
functions. Additionally a minor typo correction in the README. Added unit
tests for query string functionality.
Closes-Bug: #1542459
Change-Id: Ica2cb3ea439632588388e748d8d2e944e9ed4fa4
Gnocchi uses a client with retries=0 to maximize throughtput and not retry N
times on e.g. 404 when checking existence of an object. However, this as the
side effect of never renewing the token since there' no retry on 401 either.
This patches change the behavior so that 401 errors are always retried,
whatever the retries value is.
Closes-Bug: #1589926
Change-Id: Ie06adf4cf17ea4592b5bbd7bbde9828e5e134e3e
The user already knows this is insecure, there's no point in bringing it
up again and again.
See also: https://github.com/kennethreitz/requests/issues/2214
Change-Id: I7991b2e568407269f84138bc03711147ed080c9c