trove/tools
Amrith Kumar 577d43b02d insulate TroveContext from possible changes in oslo.context
Earlier code introduced in[1] aimed to handle the situation where a
context object serialized and sent over a message queue as a
dictionary is received by a version of code that doesn't necessarily
understand that context object.

That code relied on the fact that vars(TroveContext).keys() was a
dictionary that matched the full set of parameters that you can send
to the initializers for TroveContext() and RequestContext().

Recent changes in oslo.context [2] and [3] broke that
assumption. vars() on TroveContext provided a dictionary with the
internal representation(s) that are not the same as the kwargs in
RequestContext() and the params that TroveContext used to pop.

To get around this, new code introduced here uses
oslo_utils.reflection to determine all the possible kwargs that can be
sent to TroveContext, some of which are consumed by TroveContext and
the rest of which are sent along to RequestContext().

The construct in the earlier _remove_incompatible_context_args() also
modified kwargs.keys() by pop'ing values from it while iterating over
this. Python 3 takes a dim view of this and therefore some changes
have been made to accomodate this.

A unittest has been added to ensure that the from_dict() method
properly dumps stuff it doesn't know about. The test explicitly
verifies the warning generated when a bogus argument is eliminated.

[1] 24c5e8e244
[2] 2394cff0631944a9259bfe04925e444d9f817758
[3] f25543fcc792ebf155728a91fde06e8dc4e96cea

Change-Id: I477dd29e034295e770925091c4ac6268c22ae59b
Related-Bug:#1661790
2017-02-04 12:07:56 -05:00
..
install_venv.py Replace OpenStack LLC with OpenStack Foundation 2016-07-22 15:07:03 +05:30
start-fake-mode.sh Remove Python 2.6 classifier 2014-12-02 09:57:52 +01:00
stop-fake-mode.sh Migrating trove to entry points 2014-02-01 01:19:58 +00:00
trove-pylint.README improve pylint; generate errors and config in sorted order 2016-09-19 21:04:14 +00:00
trove-pylint.config insulate TroveContext from possible changes in oslo.context 2017-02-04 12:07:56 -05:00
trove-pylint.py trove pylint cleanup(s) 2016-12-18 08:18:47 -05:00
with_venv.sh Enclose command args in with_venv.sh 2013-09-09 15:02:40 +08:00