From 3a3072d2e1c4a17375405a6e7e8fd9adeab0c434 Mon Sep 17 00:00:00 2001 From: Thomas Duval Date: Thu, 4 Jan 2018 16:52:34 +0100 Subject: wrapper: send pdp_id to interface instead of keystone_project_id Change-Id: I847cad7d096ae8af23334eb049d583d4ed06d8d4 --- python_moonutilities/python_moonutilities/cache.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'python_moonutilities') diff --git a/python_moonutilities/python_moonutilities/cache.py b/python_moonutilities/python_moonutilities/cache.py index 851c5489..1ea59d3a 100644 --- a/python_moonutilities/python_moonutilities/cache.py +++ b/python_moonutilities/python_moonutilities/cache.py @@ -503,10 +503,14 @@ class Cache(object): else: logger.warning(" 'security_pipeline','keystone_project_id' " "key not in pdp {}".format(pdp_value)) - # for policy_id in pdp_value["security_pipeline"]: - # model_id = self.policies[policy_id]["model_id"] - # if meta_rule_id in self.models[model_id]["meta_rules"]: - # return pdp_value["keystone_project_id"] + + def get_keystone_project_id_from_pdp_id(self, pdp_id): + if pdp_id in self.pdp: + pdp_value = self.pdp.get(pdp_id) + if "security_pipeline" in pdp_value and \ + "keystone_project_id" in pdp_value: + return pdp_value["keystone_project_id"] + logger.warning("Unknown PDP ID".format(pdp_id)) def get_containers_from_keystone_project_id(self, keystone_project_id, meta_rule_id=None): -- cgit 1.2.3-korg