ComplianceAsCode / content-test-filtering

System for Automatic Filtering of Tests for ComplianceAsCode project
8 stars 6 forks source link

Traceback when analysing OVAL from shared/checks/oval directory #27

Open ggbecker opened 2 years ago

ggbecker commented 2 years ago

python3 ./ctf/content_test_filtering.py pr --verbose --rule --output json 7635

DEBUG   OVALAnalysis           - Analyzing OVAL file /shared/checks/oval/var_firewall_package_is_nftables.xml
DEBUG   OVALAnalysis           - Rule name: var_firewall_package_is_nftables
DEBUG   DiffStruct             - rule.yml was not found for var_firewall_package_is_nftables
Traceback (most recent call last):
  File "/__w/content/content/./ctf/content_test_filtering.py", line 44, in <module>
    diff_structure = diff_analysis.analyse_file(file_record)
  File "/__w/content/content/ctf/ctf/diff_analysis.py", line 54, in analyse_file
    return file_analyzer.process_analysis()
  File "/__w/content/content/ctf/ctf/analysis/OVALAnalysis.py", line 235, in process_analysis
    self.diff_struct.add_changed_product_by_rule(self.rule_name, msg=msg)
  File "/__w/content/content/ctf/ctf/DiffStruct.py", line 122, in add_changed_product_by_rule
    product_name = self.get_rule_products(rule_name)
  File "/__w/content/content/ctf/ctf/DiffStruct.py", line 89, in get_rule_products
    with open(ruleyml_path) as f:
TypeError: expected str, bytes or os.PathLike object, not NoneType
matejak commented 2 years ago

+1, it looks like that the tool tries to find a matching rule to use it in testing, but as there is not any, it gets into a dead end.