Some checks failed
Architecture Lint / Linter Tests (push) Successful in 10s
Validate Config / YAML Lint (push) Failing after 6s
Validate Config / JSON Validate (push) Successful in 8s
Architecture Lint / Lint Repository (push) Has been cancelled
Validate Config / Python Syntax & Import Check (push) Failing after 7s
Validate Config / Cron Syntax Check (push) Has been cancelled
Validate Config / Deploy Script Dry Run (push) Has been cancelled
Validate Config / Playbook Schema Validation (push) Has been cancelled
Validate Config / Shell Script Lint (push) Has been cancelled
23 lines
670 B
Python
23 lines
670 B
Python
#!/usr/bin/env python3
|
|
"""Validate playbook YAML files have required keys."""
|
|
import yaml
|
|
import sys
|
|
import glob
|
|
|
|
required_keys = {'name', 'description'}
|
|
|
|
for f in glob.glob('playbooks/*.yaml'):
|
|
with open(f) as fh:
|
|
try:
|
|
data = yaml.safe_load(fh)
|
|
if not isinstance(data, dict):
|
|
print(f'ERROR: {f} is not a YAML mapping')
|
|
sys.exit(1)
|
|
missing = required_keys - set(data.keys())
|
|
if missing:
|
|
print(f'WARNING: {f} missing keys: {missing}')
|
|
print(f'OK: {f}')
|
|
except yaml.YAMLError as e:
|
|
print(f'ERROR: {f}: {e}')
|
|
sys.exit(1)
|