Skip to content

Commit

Permalink
Add an extra check for misc operators
Browse files Browse the repository at this point in the history
  • Loading branch information
battleoverflow committed Jun 20, 2023
1 parent 79cde1c commit c59af56
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripts/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def validate_config():
lint = getoutput(f"yamllint {config_file}")

if "error" in lint:
# If you get get a line-length error, add this line to the yaml config on the same line: '# yamllint disable-line'
print(f"\nYaml config errors:\n{lint}")
return False
elif "warning" in lint:
Expand Down Expand Up @@ -84,9 +85,13 @@ def main():
try:
_ = operator['filename']
except KeyError:
console.log(f"[[red]Validation Failed[/red]] {operator}")
console.log(f"Missing the 'filename' key for one or more of your operators")
continue

if operator['module'] not in ["threatkb", "sqs", "mysql"]:
console.log(f"[[red]Validation Failed[/red]] {operator}")
console.log(f"Missing the 'filename' key for one or more of your operators")
continue
else:
pass
except KeyError:
console.log(f"[red]Validation Failed[/red] 'operators' is required. Refer to the ThreatIngestor documentation here: https://inquest.readthedocs.io/projects/threatingestor/en/latest/operators.html")
sys.exit(1)
Expand Down

0 comments on commit c59af56

Please sign in to comment.