From 73be096cea324370c6a05a6d4b7f169c71bce5aa Mon Sep 17 00:00:00 2001 From: Dae Seong Kim Date: Wed, 21 Feb 2018 22:28:27 -0800 Subject: [PATCH] [Bug] Fix to setup policy setup_policy() method is not working because it is outside of decorator. So the api server always runs with default policy even policy.yaml file exists. Change-Id: I2c70b0444cf838a03fa4e3a0a79cd9e137f153c6 --- armada/common/policy.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/armada/common/policy.py b/armada/common/policy.py index 30a9efa0..4e095688 100644 --- a/armada/common/policy.py +++ b/armada/common/policy.py @@ -46,17 +46,14 @@ def _enforce_policy(action, target, credentials, do_raise=True): def enforce(rule): - - setup_policy() - def decorator(func): @functools.wraps(func) def handler(*args, **kwargs): + setup_policy() context = args[1].context _enforce_policy(rule, {}, context, do_raise=True) return func(*args, **kwargs) return handler - return decorator