diff options
author | Alex Shatov <alexs@att.com> | 2018-08-10 11:03:02 -0400 |
---|---|---|
committer | Alex Shatov <alexs@att.com> | 2018-08-10 11:03:02 -0400 |
commit | 1c4c6626f2abb24bcb35af581c6e57130f0ccae2 (patch) | |
tree | 50685aa2bbb965a6a281eef50e449b48c2e3e87c /policyhandler/onap | |
parent | d7f34d4b71ec4d86547628cda351d20bff4d017f (diff) |
4.0.1 fix for removing the non-matching policy
- fixed removing the policy that no longer match the filter
= sending an empty policy_filter_matches for the policy_id
- cleaner workaround on getting the updated policy
when policy-engine sent policy-update notification
before finishing the update on there side
= using the collection of expected_versions instead
of min_version_expected
- some minor refactoring on policy_matcher and audit
Change-Id: Ica3cb810378e61d6991c616f88265ff170d32a64
Signed-off-by: Alex Shatov <alexs@att.com>
Issue-ID: DCAEGEN2-492
Diffstat (limited to 'policyhandler/onap')
-rw-r--r-- | policyhandler/onap/audit.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/policyhandler/onap/audit.py b/policyhandler/onap/audit.py index 69ddb86..db85c18 100644 --- a/policyhandler/onap/audit.py +++ b/policyhandler/onap/audit.py @@ -135,6 +135,8 @@ class _Audit(object): _logger_error = None _logger_metrics = None _logger_audit = None + _hostname = os.environ.get(HOSTNAME) + _health = Health() _py_ver = sys.version.replace("\n", "") _packages = [] @@ -371,21 +373,17 @@ class Audit(_Audit): if headers: if not self.request_id: self.request_id = headers.get(REQUEST_X_ECOMP_REQUESTID) - if AUDIT_IPADDRESS not in self.kwargs: - self.kwargs[AUDIT_IPADDRESS] = headers.get(REQUEST_REMOTE_ADDR) - if AUDIT_SERVER not in self.kwargs: - self.kwargs[AUDIT_SERVER] = headers.get(REQUEST_HOST) + self.kwargs.setdefault(AUDIT_IPADDRESS, headers.get(REQUEST_REMOTE_ADDR)) + self.kwargs.setdefault(AUDIT_SERVER, headers.get(REQUEST_HOST)) created_req = "" if not self.request_id: created_req = " with new" self.request_id = str(uuid.uuid4()) - - if AUDIT_SERVER not in self.kwargs: - self.kwargs[AUDIT_SERVER] = os.environ.get(HOSTNAME) - self.kwargs[AUDIT_REQUESTID] = self.request_id + self.kwargs.setdefault(AUDIT_SERVER, _Audit._hostname) + _Audit._health.start(self.job_name, self.request_id) _Audit._health.start(AUDIT_TOTAL_STATS, self.request_id) |