776 Commits

Author SHA1 Message Date
howardlee
12d42efad2 Replace 'assertEqual(None, ...)' with 'assertIsNone(...)'
[H203] Use assertIs(Not)None to check for None (off by default) Unit
test assertions tend to give better messages for more specific
assertions. As a result, assertIsNone(...) is preferred over
assertEqual(None, ...) and assertIs(None, ...), and assertIsNotNone(...)
is preferred over assertNotEqual(None, ...) and assertIsNot(None,
...). Off by default.

More details, see:
http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises

Trivial fix.

Change-Id: Icd268b96dea5e5bb9bd344f597dfcd9cc82253f0
2016-11-18 15:26:14 +08:00
John Dickinson
5a620f83e8 3.2.0 release notes
I have also reordered the AUTHORS file to be ordered by
the first character of the author's name.

Change-Id: I529988c809a2748bd6ce212a2216e692fbefe3ba
2016-11-09 11:25:15 -08:00
Jenkins
70c90b2243 Merge "Add additional headers for HEAD/GET/DELETE requests." 2016-11-08 19:30:40 +00:00
Jenkins
cb922f4dc6 Merge "Add v1password keystoneauth plugin" 2016-11-08 18:35:50 +00:00
Charles Hsu
6cf2bd6626 Add additional headers for HEAD/GET/DELETE requests.
Change-Id: I69276ba711057c122f97deac412e492e313c34dd
Closes-Bug: 1615830
2016-11-07 13:18:29 +08:00
Jenkins
41de8b7c0b Merge "Enable code coverage report in console output" 2016-11-04 22:51:17 +00:00
Matthew Oliver
5296daad83 Correct the example keystone session code imports
This is a follow up to patch Ia3fd947ff619c11ff0ce474897533dcf7b49d9b3.
One of the imports for the keystone session example was wrong. It was
trying to import v3 like:

  from keystoneauth1 import v3

Whereas in my testing v3 actually exists deeper under identity:

  from keystoneauth1.identity import v3

This patch fixes this import in the example documentation.

Change-Id: Ie31144fe65116d20a36b83a96079a3804bf55f29
2016-10-29 11:43:02 +02:00
Tim Burke
481f74caf1 Low-level API: Don't log just before raising an exception
The only logging we should do is when we've encountered a problem *and
we've dealt with it ourselves*. When we're raising an exception, it
should be up to the caller to decide whether to log anything about it.

Anything else is just rude.

Change-Id: I1c96b76d90a78b7a10ffe63e4a7440c8f579147c
Closes-Bug:  1213179
Related-Bug: 1202229
2016-10-28 17:37:37 +02:00
Jenkins
e9887703d0 Merge "Adding keystoneauth sessions support" 2016-10-26 11:41:21 +00:00
Tim Burke
a38efb6031 Add v1password keystoneauth plugin
This lets us use Keystone sessions against endpoints like swauth and
tempauth with code like:

    import keystoneauth1.loading
    import keystoneauth1.session
    import swiftclient

    loader = keystoneauth1.loading.get_plugin_loader('v1password')
    auth_plugin = loader.load_from_options(
        auth_url='http://saio:8080/auth/v1.0',
        username='test:tester',
        password='testing')
    keystone_session = keystoneauth1.session.Session(auth_plugin)

    conn = swiftclient.Connection(session=keystone_session)

The plugin includes an optional project_name option, which may be used
to override the swift account from the storage url that was returned.
Additionally, it includes enough infrastructure to support some commands
in python-openstackclient>=3.0:

    export OS_AUTH_TYPE=v1password
    export OS_AUTH_URL=http://saio:8080/auth/v1.0
    export OS_PROJECT_NAME=AUTH_test2
    export OS_USERNAME=test:tester
    export OS_PASSWORD=testing

    openstack token issue
    openstack catalog list
    openstack catalog show object-store
    openstack object store account show
    openstack container list
    openstack container create <container>
    openstack container save <container>
    openstack container show <container>
    openstack container delete <container>
    openstack object list <container>
    openstack object create <container> <file>
    openstack object save <container> <object>
    opsentack object show <container> <object>
    openstack object delete <container> <object>

Change-Id: Ia963dc44415f72a6518227e86d9528a987e07491
2016-10-24 01:52:37 +02:00
Jenkins
a0d1fe04bc Merge "add pypy to the bindep "test" profile" 2016-10-20 00:29:49 +00:00
shashi.kant
432df97c3a Enable code coverage report in console output
Modified swift-client tox.ini configuration to enable code coverage
report in console output.

Change-Id: I60276d6a87c62f4a112b01d97ab35a545d4e5462
2016-10-19 17:57:51 +05:30
Jenkins
d007ef7b2d Merge "Use ConfigParser instead of SafeConfigParser" 2016-10-17 10:48:56 +00:00
Pallavi
b6cf56deb9 Use ConfigParser instead of SafeConfigParser
The SafeConfigParser class has been renamed to ConfigParser in Python
3.2. This alias will be removed in future versions.So we can use
ConfigParser directly instead.

Change-Id: Ie0292271229ee77d1bc57dd897ebbbb3d3c059aa
Closes-Bug: #1618666
2016-10-17 08:56:44 +00:00
Anh Tran
a71c0d5a30 Replace assertTrue(a in b) with assertIn(a, b)
Change-Id: I9726c9c051eea9264200ab27b3e556c68d5c927f
2016-10-03 09:35:59 +07:00
Jenkins
30e0bf5a49 Merge "Require newer version of oslosphinx" 2016-09-29 22:25:50 +00:00
Jenkins
d8e50378ef Merge "Installs futures only for python 2.7 and 2.6" 2016-09-29 18:11:27 +00:00
Anh Tran
bb3160a42c Remove redundant space in docstring
TrivialFix

Change-Id: I7012fb7bbbedfba30b8e0450a449787e9076f4ef
2016-09-28 11:25:56 +07:00
Claudiu Belu
b3921b26e8 Installs futures only for python 2.7 and 2.6
The futures library is native to python 3 and it doesn't
have to be installed from pypi.

If the futures library is installed, it can cause issues when used.

Changes the futures' library requirement to match the one in
global requirements. [1]

[1] https://github.com/openstack/requirements/blob/master/global-requirements.txt

Change-Id: I8f13d63a303b71f7bdd8c3e67c15d0a0df5ea7a9
Closes-Bug: #1628107
2016-09-27 16:28:11 +00:00
Anh Tran
ab7a8b2453 TrivialFix: Removed redundant 'the'
Change-Id: I3b3c0e7e4d5c8a1934378e2083a64bb686754f18
2016-09-27 16:10:14 +07:00
Ondřej Nový
f1b9352883 Require newer version of oslosphinx
This newer version contains show_other_versions option, which is used in
conf.py

Change-Id: Iad82206cbed81d13e80e62b7faaca9dcc736ea15
2016-09-27 07:53:42 +00:00
John Dickinson
46937f8620 add pypy to the bindep "test" profile
According to the bindep docs
(http://docs.openstack.org/infra/bindep/readme.html#profiles),
we can specify profiles for each entry listed.

Also added a bindep env to tox.ini.

Change-Id: Ifb59d3ef2934c3d72ba84b337c38bb7eb14774bb
2016-09-23 13:21:58 -07:00
zheng yin
a9f21662df remove swiftclient/openstack/common/* in the .coveragerc
There is no swiftclient/openstack/common/* in python-swiftclient.
Therefore, I remove "omit=swiftclient/openstack/common/*"
in the .coveragerc.

Change-Id: Ibf4e4e499cb5538fcd8b1680285294c8a09ad401
2016-09-21 15:48:35 +08:00
Jenkins
27f9178ec8 Merge "Update help text around container ACL syntax" 2016-09-19 21:24:50 +00:00
Jenkins
0ec6b7b162 Merge "Make tempurl subcommand insist on whole number seconds" 2016-09-15 02:34:01 +00:00
Mohit Motiani
371f0e3482 Update help text around container ACL syntax
The patch add the information about the syntax of provding read and
write access to the users within a project.

The current status is:
account:* does not work with tempauth
account does not work with keystoneauth

Furthermore, the concept of "account" is fuzzy. It could be a
"project", but even that doesn't distinguish between a project
id and a project name.

Change-Id: I4462230fe05aa4a742e825f5b6312deb93bc1170
Closes-Bug: #1587677
2016-09-14 17:13:12 -07:00
Jenkins
714bf0cd4b Merge "Fix intermittent test failure" 2016-09-14 20:46:57 +00:00
Jenkins
b679959d35 Merge "Make object option dependent on container in usage strings" 2016-09-14 20:46:52 +00:00
Jenkins
cacb3a3a15 Merge "Make tempurl command check for valid object path" 2016-09-14 20:45:43 +00:00
Alistair Coles
e41158d79e Make tempurl subcommand insist on whole number seconds
Previously the tempurl subcommand would dump a traceback
due to a TypeError if the seconds option was not an int
value. With this patch it will now return the same
error message as if the seconds option were negative or not
a number.

Also changes the error message to state that the seconds
option should be a "whole number" rather than a "positive
integer", since 0 is a valid value.

Change-Id: Ie940d470f2be8006aa8eb7fe242f092457aeae21
Closes-Bug: #1621817
2016-09-14 18:17:40 +01:00
Alistair Coles
4c955751d3 Make tempurl command check for valid object path
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
2016-09-14 16:24:22 +01:00
Ji-Wei
5eb0f3debc Fix order of arguments in assertIs
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
2016-09-09 17:30:46 +08:00
Jenkins
2737fae96e Merge "Make options arguments truely optional" 2016-09-08 14:33:05 +00:00
Alistair Coles
cb0cdca7aa Make object option dependent on container in usage strings
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
2016-09-08 11:09:25 +01:00
Nandini Tata
aa88677018 Fixed inconsistent positional arguments naming
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
2016-09-07 21:09:41 +00:00
Christian Schwede
89ff29e788 Make options arguments truely optional
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
2016-09-06 07:38:08 +00:00
Jenkins
0feb83a00c Merge "Change Examples from headings to topics" 2016-09-05 18:55:01 +00:00
Tim Burke
209677e6a8 Fix intermittent test failure
The mock needs to be initialized before calling main, or we get a race
to create it between all the uu_threads

Change-Id: If7649da13ed9276d7f0e005e999770e09c022a3f
2016-09-01 11:18:16 -07:00
John Dickinson
cbd71a8b5a authors/changelog updates for 3.1.0 release
Change-Id: I75ba58d194ea99b17c862cefcd9943e38e3f1ff0
2016-09-01 08:53:24 -07:00
Jenkins
92544c58c5 Merge "Accept gzip-encoded API responses" 2016-09-01 03:18:18 +00:00
Jenkins
98085c961f Merge "Convert numeric and boolean header values to strings" 2016-08-31 00:58:02 +00:00
Jenkins
39b9db35a0 Merge "Add swift tempurl and swift auth command docstring" 2016-08-30 23:21:40 +00:00
Tim Burke
f728027bed Accept gzip-encoded API responses
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
2016-08-30 15:38:55 -07:00
zheng yin
8753c4dea3 Add swift tempurl and swift auth command docstring
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
2016-08-30 20:57:35 +00:00
Tim Burke
7cd7df410a Change Examples from headings to topics
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
2016-08-26 13:50:31 -07:00
Jenkins
20e0c515bf Merge "client: renew token on 401 even if retries is 0" 2016-08-26 17:37:41 +00:00
Jenkins
19cd127294 Merge "boolean logic cleanup in service.Swift[Copy|Post]Object" 2016-08-25 22:47:41 +00:00
Jenkins
9cdeedab7d Merge "Use mock patch to handle get_auth_keystone" 2016-08-25 22:26:54 +00:00
Jenkins
a2371cc6d8 Merge "Fix examples and missing code-block" 2016-08-25 20:29:54 +00:00
Clay Gerrard
96f0031e64 boolean logic cleanup in service.Swift[Copy|Post]Object
Change-Id: I07e74536502ec2479b22a825f684703d65924563
2016-08-25 13:15:44 -07:00