Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Commit

Permalink
Update the logic for checking if the policy library is setup correctl…
Browse files Browse the repository at this point in the history
…y to be controlled via the server config and default to false. Will add a PR to Terraform to be able to control this. (#3678)
  • Loading branch information
gkowalski-google committed Feb 28, 2020
1 parent 9de4392 commit 5bf3ee2
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ def __init__(self, global_configs, scanner_configs, service_config,
# Maps CAI resource name-> (full_name, resource_data).
self.resource_lookup_table = {}

# Verify Policy Library
cv_scanner_config = {}
for scanner in self.scanner_configs.get('scanners', []):
if scanner['name'] == 'config_validator':
cv_scanner_config = scanner
break
self.verify_policy_library_enabled = (
cv_scanner_config.get('verify_policy_library', False))

def _flatten_violations(self, violations):
"""Flatten Config Validator violations into a dict for each violation.
Expand Down Expand Up @@ -187,7 +196,8 @@ def run(self):
it will be hard for Forseti to retrieve the right resource_data for the
corresponding violation types.
"""
ConfigValidatorScanner.verify_policy_library()
if self.verify_policy_library_enabled:
ConfigValidatorScanner.verify_policy_library()

# Retrieving resource violations.
for flattened_violations in self._retrieve_flattened_violations():
Expand Down

0 comments on commit 5bf3ee2

Please sign in to comment.