29 Commits

Author SHA1 Message Date
Moisés Guimarães de Medeiros
2c36df6bf3 fix python version in tox file: py35 -> py37
Change-Id: I74cdd7462cd5134b22d0c6b13aafd0e88ef60e1c
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
1.0.1
2020-02-14 16:06:54 +01:00
Hervé Beraud
602fbc83d4 adding missing releasenote for the drop of py27 support
Change-Id: I2b887873d30171bc979728d975b40b9dc6065735
2020-02-06 12:26:58 +01:00
Andreas Jaeger
dbf8dd6bcf [ussuri][goal] Drop python 2.7 support and testing
OpenStack is dropping the py2.7 support in ussuri cycle.

Complete discussion & schedule can be found in
- http://lists.openstack.org/pipermail/openstack-discuss/2019-October/010142.html
- https://etherpad.openstack.org/p/drop-python2-support

Ussuri Communtiy-wide goal:
https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html

Switch to modern sphinx-build and using openstackdocstheme
(note that repo is not building and publishing docs, docs building works
locally with these changes).

Change-Id: I9542c1dba3f339c2acece83d7d2b5726c1c3e2bc
1.0.0
2020-02-03 17:12:24 +01:00
OpenDev Sysadmins
e418e75089 OpenDev Migration Patch
This commit was bulk generated and pushed by the OpenDev sysadmins
as a part of the Git hosting and code review systems migration
detailed in these mailing list posts:

http://lists.openstack.org/pipermail/openstack-discuss/2019-March/003603.html
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004920.html

Attempts have been made to correct repository namespaces and
hostnames based on simple pattern matching, but it's possible some
were updated incorrectly or missed entirely. Please reach out to us
via the contact information listed at https://opendev.org/ with any
questions you may have.
2019-04-19 19:42:56 +00:00
Vieri
587cf0bb24 Change openstack-dev to openstack-discuss
Mailinglists have been updated. Openstack-discuss replaces openstack-dev.

Change-Id: I95f08e4cf53daafb1c7cd087597d43a54b92e2f1
2018-12-04 19:06:06 +00:00
Chris Dent
93d9bfa601 Add python36 jobs to microversion-parse
python35 is pretty old and often not available by default on some
operating systems, so we need to be testing python36.

Change-Id: I61a7b7f29add38f2164d9c6907af2a3f31105612
2018-09-04 10:16:46 +01:00
Chris Dent
ef25083678 Copy zuul job settings from project-config
Official projects are doing this as part of enabling python3
first, but it matters more here as a way to manage with local
control.

Change-Id: Ia93cd1a45519f5fe2ddd32a89f896f896f21491f
2018-09-04 09:17:45 +01:00
huang.zhiping
3f2247327a fix tox python3 overrides
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.

We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.

We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.

Change-Id: Ia908e642ad1a3f67710d48a71d097c13b7743a5a
2018-06-09 10:41:40 +08:00
Chris Dent
ae5e3ce521 Enable universal wheels for microversion-parse
The library is fully python 3 and 2 happy, so the wheel
should be too.

Change-Id: I62f437ed7ac7852f400fd4d8391577c8ea3ab6a9
0.2.1
2018-03-21 17:39:24 +00:00
Chris Dent
6a379d9783 Correct docstring on Version(0, 0) test
If no max or min is set, no Version should match, including
0.0. The test was already correct, but the associated
docstring was a pasto.

Change-Id: I925a9df3b044b1f581b2c62db1bda9ace0a5cc47
0.2.0
2018-03-21 15:18:23 +00:00
Chris Dent
e93d35f10d Do not use redundant attr check for keys in fold_headers
We only care about items, so use it, and pass if we get an
AttributeError

Change-Id: I7a09b63db390431be044ae3fc6aeece565606b40
Closes-Bug: #1756157
2018-03-20 17:24:56 +00:00
Chris Dent
4b87196837 Clean up package version and python version support
The __version__ in __init__.py is not used, and is out of date.

setup.cfg is adjusted to show that python 3.4 receives no attention.

Change-Id: Iaeff8dca06b7c4de2eff497dc2f1e49c4ee1f5e4
2018-03-20 17:24:56 +00:00
Chris Dent
f816e324b8 Allow passing a json_error_formatter to the middleware
This is so error responses can be formatted according to the rules
of the application.

Change-Id: Ie44399447a349ebc49251dc63c23f56c6423fca6
2018-03-20 17:24:56 +00:00
Chris Dent
b5359fcd80 Add MicroversionMiddleware
This change imports (with slight modification) the
MicroversionMiddleware created for the placement service.

For the time being the middleware relies on WebOb as that is
what it originally relied on. If there are requirements to do
otherwise, later, we can make adjustments then.

The README is updated with limited usage instructions.

Gabbi tests are added, requiring adjustments to the test configuration,
so the opportunity was taken to switch to using stestr instead of testr.

Though arguably "functional" tests because they are not strictly unit
tests, no distinction is made in the tests directory, for now, as it
is all nice and fast and we'd like to keep it that way.

Change-Id: I9d27b6fad35f7aea0085f08c0353f8e8acdb8b73
2018-03-20 17:24:56 +00:00
Chris Dent
e346558d5f Improve Version.matches() method
Use of Version within the placement service has made it clear
that the Version object knowing the min and max versions is
useful when making Version.matches comparisons.

Therefore the matches method has been updated to refer to
min_version and max_version attributes if they are not set
in the matches() request. The extract_version function now
sets those attributes based on the version_list that is
passed to it.

If min and max are not set on the Version object, they default
to negative versions, which are not possible in microversions
and mean matches() (without override args) will be false. The
use of explicit values (instead of None) is so python3 is happy
(and it is better anyway).

Change-Id: I71d091d037abcd068601b32722a09094ae74e658
2018-03-20 17:23:26 +00:00
Chris Dent
da0b4d66c9 Import functions from placement
This change imports two functions and a class from the microversion
handling implementation in the placement service. This code should be
generally useful for other implementations.

The added code provides functions for not just extracting the
microversion from HTTP headers, but for validating that the found
information is actually a properly formed microversion value.

'latest' is translated to whatever latest is in an ordered list of
versions and any found version is confirmed to be within the bounds of
and a member of that list of versions.

The README.rst has been updated to reflect the newly available methods.
This is a start at documentation, but we'll probably want more.

Change-Id: I267586c78308cc5520a88598c350a7e055783f3e
2018-03-15 18:15:25 +00:00
Chris Dent
bd003b52a5 Provide a helper method to get headers from environ
The get_version method accepts a dict or list of tuples that
represent HTTP request headers that will be processed to find a
microversion header. Sometimes, for example in some middlewares,
direct access to a headers dict will not be available and only the
WSGI environ will be present.

This change provides a utility method which creates a new dict of
headers: headers_from_wsgi_environ. This mode was chosen to make it
clear that a copy of the environ is being made, not the environ
itself as we really don't want to be passing that as some values in
it will not be simple objects (strings and numbers) and we do not
know what other middleware might have done or want to do with it.

Internal to get_version any attempt to get a header named 'FOO' will
fall back to looking for the WSGI equivalent of 'HTTP_FOO'.

README.rst has been updated to indicate the new style.

This change is backwards compatible, existing clients will not
notice.

Change-Id: I5262031d9cde0378eabe342c1913091658c3bf9b
Closes-Bug: #1579772
2018-03-15 18:15:20 +00:00
PollyZ
1f6eac7c3d Convert dict headers and Webob headers into lowercase.
In the fold_headers function, if the headers behaves like a dict,
they were being retured unchanged. This would cause issues in the
later processing to extract the microversion header, which matches
on lower case strings.

Convert these headers to lowercase also provide a test case to
validate the header is being parsed correctly.

Change-Id: I8501c813d668c0a32905906e4ef3f8c6c6b12de2
Close-Bug:# 1606351
0.1.4
2016-07-29 13:22:36 -05:00
Chris Dent
c031779d58 Fix summary information used in pypi display
Typo in summary information fixed.

Change-Id: I1cfbd2c020cac406944b5b380c9ce13d038ab343
2016-04-11 18:59:35 +01:00
Louis Taylor
4b04aaf3b2 Make service_type a positional argument
This removes the assert to ensure a value for service_type is set. The
keyword style of calling can still be used, so

    microversion_parse.get_version(headers, service_type='compute')

will remain working.

Using an assert for this is probably inadvisable, since it will be
stripped away if python is run with -O.

Change-Id: I9775c5d87890c8ff4a6072c600d54fa47264fa9f
0.1.3
2016-04-08 14:03:08 +01:00
Chris Dent
2f044aae4e Include README.rst content on doc index
This is so there is at least some bare bones documentation to
start from.

Change-Id: I839e574bb1b52d16bc235d0437c60cff017d4594
0.1.2
2016-03-31 18:07:23 +01:00
Chris Dent
b1f7162324 Fix folded header checks for WebOb
WebOb uses a Mapping class for headers which behaves like a dict
but does not inherit from dict, so the isinstance check in
fold_headers was not working as expected. This is now replaced
with a check for dict-like behaviors. It's a bit of a tossup
between doing a hasattr and simply trying to access a key. I chose
the former for readability and because we don't actually want to
do anything with the value we would retrieve were access by a key
legit.

Tests are added to specfically cover the use of a
webob.headers.EnvironHeaders object, which is what headers in
Nova and Nova derivations look like.

Change-Id: I31de49bcfd8822c53d3293b106de96138eaf4464
2016-03-31 14:03:13 +01:00
Chris Dent
33e0066354 Enable gerrit, gitreview and gate testing
Initial setup for git review.

Add basic docs handling so that docs tests will pass. No
actual docs in place yet.

Align with global requirements.

Change-Id: I8ae7c2c6ce410c04f4ce53ce5278b2b85c141c93
2016-03-31 12:31:20 +01:00
Chris Dent
45916f2af1 Cleanup README
Some formatting errors.
0.1.1
2016-03-24 13:35:42 +00:00
Chris Dent
1214334f43 allow tox to skip missing interpreters 2016-03-24 13:28:08 +00:00
Chris Dent
615383062c package for initial release 0.1.0 2016-03-24 13:25:59 +00:00
Chris Dent
d2c4bb7605 Change interface to explicitly pass legacy_headers
Based on suggestion from @sdague

TODO: more tests, positive and negative
2016-03-22 19:44:18 +00:00
Chris Dent
49b44934b9 Initial proof of concept of microversion_parse
See README.rst for details.

The basic gist is that a get_version method is provided. It takes a
dict or list of headers and returned a version for a service_type if
it can find it.
2016-03-22 17:48:42 +00:00
Chris Dent
db6fb70f72 Initial commit 2016-03-22 15:29:38 +00:00