Commit Graph

124 Commits

Author SHA1 Message Date
Andreas Jaeger aaad576c0b Retire repo
This repo was created by accident, use deb-python-oslo.context
instead.

Needed-By: I1ac1a06931c8b6dd7c2e73620a0302c29e605f03
Change-Id: I81894aea69b9d09b0977039623c26781093a397a
2017-04-17 19:35:38 +02:00
Wei Li 765eaa6a5d Delete H803 in flake8 ignore list
In hacking >=0.10.0,there is not H803.So we should drop it
in flake8 ignore list.

Change-Id: I27fc7c095e9cbbb29dddb06c3675038d595e1711
2016-08-02 19:44:31 +08:00
ChangBo Guo(gcb) 932b495077 Add Python 3.5 classifier and venv
Now that there is a passing gate job, we can claim support for
Python 3.5 in the classifier. This patch also adds the convenience
py35 venv.

Change-Id: I800ad84596d1ff25686516fcf84184ce185cc77a
2016-07-12 15:36:50 +08:00
Jenkins 6a9bc57a9b Merge "Allow deprecated X-Tenant-Name in from_environ" 2016-07-11 23:00:35 +00:00
Jenkins 9feb9db8d6 Merge "Add is_admin_project to context" 2016-07-11 15:16:53 +00:00
Jamie Lennox 5118040676 Allow deprecated X-Tenant-Name in from_environ
Support the old and deprecated X-Tenant-Name header in the
from_environ method.

Change-Id: I0d1784ee96e38a5be256370a3e6dbf7cd1b21b05
2016-07-11 11:10:46 +10:00
Jamie Lennox 740b81784b Handle openstack.request_id in from_environ
The oslo.middleware request_id middleware that is used by most services
sets the request_id into the environment at 'openstack.request_id'. Pick
this value up into the context object if it is present in the
environment.

Change-Id: Iae3799f4c5ad799961a4a6b01d2b77fd97e72be3
2016-07-08 12:33:22 +10:00
Jamie Lennox d3af1d06b4 Add is_admin_project to context
is_admin_project is provided by keystonemiddleware and used by
oslo.policy to enforce that a project scoped token exists in the admin
project.

To make this usable we add the ability to read the X-Is-Admin-Project
header from the environment, and add it to the outputted policy values.

Note the value is added to keystonemiddleware in the depend review
however it must work even with older auth_token middlewares so is fine
to merge prior to a middleware release.

Closes-Bug: #1577996
Depends-On: Ic680e6eaa683926914cf4b2152ec3bb67c6601ff
Change-Id: Ie48fedb8092e33e9645a37ea3fe44b88d34ad3b8
2016-07-08 12:30:25 +10:00
Jenkins ae6f152447 Merge "Add oslo.context name attributes matching ids" 2016-07-08 02:23:13 +00:00
OpenStack Proposal Bot 4db9262800 Updated from global requirements
Change-Id: I57bb582178a5cdb4a9ccc8c546129bdf3be44e07
2016-06-24 03:16:28 +00:00
Kirill Bespalov 061741287a Add reno for releasenotes management
An initial patch to add reno and create a base directory for
release notes

Change-Id: I8a18a2f2550ff82954d28a6e897a9ce9b1f8f1ba
2016-05-20 17:58:52 +03:00
Ronald Bradford f0de0c6291 Add oslo.context name attributes matching ids
Provide in the oslo.context base class _name attributes to match
the already defined id attributes (that are not yet called _id).

These attributes are made available for oslo.log to use in context
aware logging.

This will replace any projects that subclass RequestContext and
subsequently add these attributes to to_dict(). e.g.
http://git.openstack.org/cgit/openstack/nova/tree/nova/context.py#n176

See as discussed on ML at
http://lists.openstack.org/pipermail/openstack-dev/2016-April/091453.html

Change-Id: I1fbb613ded8dbcb99b2f43a4bc43f9046097c0ce
2016-05-19 17:07:53 -04:00
Jenkins 6e61493b54 Merge "Strip roles in from_environ" 2016-05-14 13:36:16 +00:00
Jenkins 390ff18d26 Merge "Allow deprecated headers in from_environ" 2016-05-14 13:35:38 +00:00
ChangBo Guo(gcb) cf33c028e9 Trivial: ignore openstack/common in flake8 exclude list
The directory openstack/common doesn't exist any more.
So remove it from flake8 exclude list.

Change-Id: I3de6bac0c10f194108e0e77db1bb21a7421c6cf6
2016-05-11 19:26:50 +08:00
Jamie Lennox 0511e11287 Strip roles in from_environ
If somehow whitespace gets into the roles coming from headers we should
remove it and only save the actual role name. This is not possible
coming from auth_token middleware but is tested by some services and is
simple to support here.

Change-Id: I11ac3959d8f8b233c8785671d7a59263a4dc36df
2016-05-09 11:23:23 +10:00
Jamie Lennox e1925637b4 Allow deprecated headers in from_environ
from_environ only supported the current environ variables from
auth_token middleware as these have been in use for a long time. It
turns out particularly in testing that services may still use the
deprecated headers so we should still support those in oslo.context.

Change-Id: Ia7faf7b657525c11f728ac753422efe87f6ac34f
2016-05-09 11:23:23 +10:00
Joshua Harlow 82ffe9ee05 Drop babel as requirement since its not used
See the following thread for more details.

http://lists.openstack.org/pipermail/openstack-dev/2016-April/thread.html#92510

Change-Id: I462bef76089cf8c725eb39b499b9b17c2729b491
2016-04-20 18:53:27 -07:00
OpenStack Proposal Bot d6585a8d62 Updated from global requirements
Change-Id: I45240dbd3543728af60ecc121d4ab28fa6b98f13
2016-04-13 12:47:24 +00:00
ChangBo Guo(gcb) c63a359094 Ensure to_dict() supports unicode
When we compose a string for user_identity, we should
ensure that we don't break for non-ascii strings in
user name or tenant name or domain names.

Change-Id: Id457ebe415f78c435fc8ece810f0a1b20964dabf
Closes-Bug: #1507937
2016-02-27 22:28:48 +08:00
Jamie Lennox 187d574063 Standardize an oslo.policy credentials dictionary
Currently all the services pass there own dictionary to the oslo.policy
enforcement engine. This means that there is no standard policy language
between services.

Create a dictionary with the standard credential items that may be
required in policy enforcement. This method will need to be overriden
from individual services for backwards compatibility for some time.

Change-Id: I7bc31764e79eb61f602c7b8601149ac75bee9f9f
Closes-Bug: #1537653
2016-02-24 17:01:33 +00:00
Jenkins 410d14ff05 Merge "Revert "Add common oslo.log format parameters"" 2016-02-24 02:24:32 +00:00
Ronald Bradford 217a4edc2e Revert "Add common oslo.log format parameters"
This reverts commit 01aaeae060.
This causes test failures with oslo.log change
Ica445ad5dfe9bd27dfcf1b1bcb6401a0bc9496a5 when passing these attributes
to a log message and a context object. The result of setting these in
context causes log.record values to be overridden with blank values.
Catering for this condition causes subsequent mismatches for test
conditions mixing context and optional passing additional attributes
to log.

Change-Id: I5450e105dc914f822a2b4c03b759a682d8b4a3e7
2016-02-23 18:53:54 +00:00
Jamie Lennox f383bd2973 Add roles to context
Roles are an important part of the user context. They typically don't
need to be serialized for RPC but they are needed for policy. Include
roles onto the context object and make sure it is loaded from the
auth_token middleware environment.

Related-Bug: #1537653
Change-Id: Ia575ba803a0fb70f39146bd75d381ed19414bd23
2016-02-19 21:17:36 +00:00
Jenkins ce60425d58 Merge "Agnostic approach to construct context from_dict" 2016-02-18 18:33:34 +00:00
Jenkins 9e9a892e3a Merge "Add common oslo.log format parameters" 2016-02-18 11:35:41 +00:00
Ronald Bradford 0327388695 Agnostic approach to construct context from_dict
Replace the existing argument specified values in from_dict() method
to be argument agnostic for any future arguments. Based from version
found in Solum.

All current boolean values match instantiation defaults.

Change-Id: I17c76881aa662de7ff245b3f6bfca309896ddf24
2016-02-17 21:55:52 +00:00
Ronald Bradford 01aaeae060 Add common oslo.log format parameters
Add to get_logging_values() attributes that used in format string parameters
and that can cause an exception when the are not defined.
This is being refactored from the oslo.log formatter functionality.

Change-Id: I7108a51bea01db6ccd9b6b24afc7b8d92b8eeda7
Implements: blueprint app-agnostic-logging-parameters
2016-02-09 22:07:57 +00:00
Jenkins a04ab9b173 Merge "Define method for oslo.log context parameters" 2016-02-01 12:55:07 +00:00
Jenkins ed9ddccd0d Merge "Improve Context docs with example syntax" 2016-01-30 09:47:20 +00:00
Ronald Bradford b621d4eecc Improve Context docs with example syntax
Added examples to explain how use Oslo Context with Oslo Log.

Change-Id: I5b5d2ee152b305316b68c5b34d00f480c7daf5ba
2016-01-29 20:45:46 +00:00
Ronald Bradford 22ad2c2c59 Define method for oslo.log context parameters
This initial review defines a new method that will be used to define
and extend context attributes specifically useful in logging.
This enables other uses of the RequestContext to use the existing to_dict()
method.
This placholder is also needed for cross project dependencies with oslo.log.

Change-Id: I963a6db4aef74f7348e75a642e2e195cedacecaa
Implements: blueprint app-agnostic-logging-parameters
2016-01-29 17:56:53 +00:00
Jenkins 5e3f0c5cb5 Merge "Add additional unit tests" 2016-01-25 22:34:36 +00:00
Ronald Bradford 800208d9d3 Add additional unit tests
These tests are to cover existing class functionality before
modifications of app agnostic parameters and changes in Oslo Log.

Change-Id: I0b041746865e4da5d2c73ce6093f96bd48760e24
2016-01-25 18:02:32 +00:00
Victor Stinner 4a8a1dfbbb Fix request_id type on Python 3: use text (Unicode)
generate_request_id() was previously modified by the change
I389cf20e4c999c9bb576a42388497852f8ba27ec to return a bytes string
instead of a text string. According to the author of the change, it
was a mistake (the right fix is to update the unit test, not modify
the tested function).

Having a request_id as a byte string is not convenient on Python 3.
For example, it's a bug to write '"id:%s" % request_id', a
BytesWarning exception is raised when python3 is run with -bb command
line option. It not possible to write str+bytes neither.

Right now, oslo_log emits logs with b'...' which is unexpected. I
prefer to fix the issue in oslo_context rather than working around
the issue in oslo_log. Example of log emitted on Python 3:

"WARNING glance.api.v2.tasks [b'req-83a6...' 54492... - - -] ..."

This change depends on changes in Glance, Neutron and oslo.middleware
which prepares unit tests to support bytes and str request_id. So
their unit tests will work on the old and new versions of
oslo.context. Changes on unit tests are required for the master
branch but also Liberty because their python34 check job is voting on
Liberty and master.

This change depends on the following changes:

* change Ia8578ecab1b1f1bf21020c91290458efad646cd9
* change Ia5203581db120bb4f8e24fd752d6ae14e6558505
* change I872c268ef5f17dc2c1fe0ce8aa7e8af4ebc1d757
* change Ia4df8f05d5746887eb99bbf368d29e8d30a3a90a

Closes-Bug: #1526662
Change-Id: If48ee7f4d1c113f1f26b3b1698c6b055807b950f
2016-01-25 13:06:18 +01:00
Jenkins e6dfe63641 Merge "Provide a helper to load a context from environment" 2016-01-19 10:24:09 +00:00
OpenStack Proposal Bot ebf47d1a3d Updated from global requirements
Change-Id: Ibdd5af8eb5f29661a76cd5628381ec108e2e9c92
2016-01-16 03:31:07 +00:00
Jamie Lennox 1f3719dfcf Provide a helper to load a context from environment
The intention here is to provide better integration between what
oslo.context expects and what keystonemiddleware provides. As auth_token
middleware changes each service has to react independently to the new
options and the way they build contexts.

By providing a helper here we can improve the consistency across
services to standardize the options and provide a common way to react to
auth_token middleware improvements.

Change-Id: Ic590b3ee359e9a9c27eef3d11c0738066f475881
2016-01-11 10:59:19 +11:00
Davanum Srinivas (dims) 04e40fa8d4 Revert "Add properties for id attributes"
This reverts commit 78644789ce.

Change-Id: I92257b7bade0e2e5c4e1b387b437d929afc1a4db
Related-Bug: #1532427
2016-01-09 12:04:52 +00:00
Jamie Lennox 78644789ce Add properties for id attributes
The user, tenant and similar values are ambiguous. Most contexts that
subclass oslo.context already provide some version of this and use the
_id attributes anyway.

Ideally we would deprecate these values in future but for now just
provide the alias.

Change-Id: Ia59bf69eaa83be1904abe835bfee68b785c92c54
2016-01-07 08:20:14 +11:00
ChangBo Guo(gcb) 2faf1f7d68 Trival: Remove 'MANIFEST.in'
Everything in this file is automatically generated by pbr. There
appears to be no good reason to keep it around.

Change-Id: I7cbc66a5c4fc472ffbb7b11fbf94dd9fe3c1639c
2015-12-05 12:11:01 +08:00
OpenStack Proposal Bot 73f2810749 Updated from global requirements
Change-Id: Ia351582a1a12fbf1268ad96f947d55f5551b81f5
2015-11-19 15:51:33 +00:00
ChangBo Guo(gcb) ea648c536a Remove python 2.6 classifier
Change-Id: I9957bb9f98c07cf8b1f99063b474fc2b00a54251
2015-11-17 14:12:34 +08:00
Davanum Srinivas 2530b7f847 Remove python 2.6 and cleanup tox.ini
* Remove support for python 2.6
* Remove skipsdist : Needs to be set only if 
  sdist is expensive
* Remove usedevelop : only needed when skipsdist 
  is set to True
* Remove install_command : We can just use the 
  default, we don't need to override
* Remove setenv : We can just use the default as
  we don't need any extra environment variables
* Remove requirements.txt from deps, as this is
  already added automatically

Change-Id: Ibceadc1d9f315044121e904f97e53aafec3b7cfa
2015-11-16 00:46:18 +00:00
Ronald Bradford 41598d7188 Remove reference to undefined attributes
is_user_context refers to a user_id and project_id attribute in
the context object which are not defined in this base class.

Change-Id: I2ac6d4a7d31d026e6fedcba80c4a760dcac747e8
Closes-Bug: 1508217
2015-10-20 17:59:34 -04:00
Ronald Bradford 5e677dc232 Fix coverage configuration and execution
A number of configuration errors prevent the successful creation of code
coverage. This corrects the .coveragerc source/omit setup and the tox
package name generation.

http://lists.openstack.org/pipermail/openstack-dev/2015-October/076193.html

Change-Id: I74d2af73a57ba72631e5eea3ace3275c0b349352
2015-10-09 16:11:45 -04:00
Jenkins a90dacb9a8 Merge "Change ignore-errors to ignore_errors" 2015-10-08 21:32:01 +00:00
Joshua Harlow f8285a1f34 Add shields.io version/downloads links/badges into README.rst
Change-Id: I45dcc8c9f7e510b3c84e450508bf7022def4a48e
2015-09-24 12:38:28 -07:00
Monty Taylor ee2148cad5 Change ignore-errors to ignore_errors
Needed for coverage 4.0

Change-Id: Ic5cf87dcea8bf9694c958eb283844cc082577af6
2015-09-21 14:42:41 +00:00
OpenStack Proposal Bot 18170eb5f9 Updated from global requirements
Change-Id: I87e29294d7bca111816017c05cc94f368d3879ed
2015-09-17 12:15:57 +00:00