ci: password check: fix: don't break on ScannerError (#1017)
This commit is contained in:
parent
5807507f29
commit
a347f61973
@ -1,6 +1,7 @@
|
||||
"A small dirty script to check that none of the password config options have been set to real passwords"
|
||||
from collections.abc import Generator
|
||||
import yaml
|
||||
from yaml.scanner import ScannerError
|
||||
import sys
|
||||
|
||||
|
||||
@ -33,6 +34,7 @@ WE_DUN_GOOFED: bool = False
|
||||
changed_files = sys.argv[1:] # Ignore filename of this script
|
||||
for file in changed_files:
|
||||
with open(file, 'r') as f:
|
||||
try:
|
||||
yml = yaml.safe_load(f)
|
||||
gen = key_finder(yml)
|
||||
for password_keys in gen:
|
||||
@ -42,6 +44,9 @@ for file in changed_files:
|
||||
else:
|
||||
print(f"top level key '{password_keys[0]}' with subkey '{password_keys[1]}' in {file} contains a real password!")
|
||||
WE_DUN_GOOFED = True
|
||||
except ScannerError:
|
||||
print(f"Couldn't parse yaml file for: {file}")
|
||||
pass
|
||||
|
||||
if WE_DUN_GOOFED:
|
||||
exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user