summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAmrith Kumar <amrith@amrith.org>2017-02-03 23:53:43 -0500
committerAmrith Kumar <amrith@amrith.org>2017-02-04 12:07:56 -0500
commit577d43b02d200b5b60eefc875f1542faa09ebfd9 (patch)
treea1d0dcf4d2b3d8eef802f80df06b4d229b7325f5 /tools
parent55dbc74b303158249128cc2798429c76b52bccdf (diff)
downloadtrove-577d43b02d200b5b60eefc875f1542faa09ebfd9.tar.gz
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] 24c5e8e244380e3e7e309f0b4aaffde32dbf0789 [2] 2394cff0631944a9259bfe04925e444d9f817758 [3] f25543fcc792ebf155728a91fde06e8dc4e96cea Change-Id: I477dd29e034295e770925091c4ac6268c22ae59b Related-Bug:#1661790
Diffstat (limited to 'tools')
-rw-r--r--tools/trove-pylint.config12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/trove-pylint.config b/tools/trove-pylint.config
index fad15049..6a38a8be 100644
--- a/tools/trove-pylint.config
+++ b/tools/trove-pylint.config
@@ -250,6 +250,18 @@
"Commands.params_of"
],
[
+ "trove/common/context.py",
+ "E1101",
+ "Module 'inspect' has no 'getfullargspec' member",
+ "TroveContext._remove_incompatible_context_args"
+ ],
+ [
+ "trove/common/context.py",
+ "no-member",
+ "Module 'inspect' has no 'getfullargspec' member",
+ "TroveContext._remove_incompatible_context_args"
+ ],
+ [
"trove/common/extensions.py",
"E1003",
"Bad first argument 'ExtensionMiddleware' given to super()",