INNER CODE UNIT · Python
check_direction
floci-io/floci · .github/ci/compat-opentofu-drift-check.py:50
def check_direction(label, only_in, allowlist_path):
"""Report unexpected and stale entries for one direction. Returns True if clean."""
allowed = load_allowlist(allowlist_path)
unexpected = sorted(only_in - allowed)
stale = sorted(allowed - only_in)
ok = True
if unexpected:
ok = False
print(f'::error::resources in {label} not allowlisted in '
f'{allowlist_path.relative_to(REPO_ROOT)}:')
for a in unexpected:
print(f' {a}')
if stale:
ok = False
print(f'::error::stale entries in {allowlist_path.relative_to(REPO_ROOT)} '
f'(no longer one-sided in this direction, remove them):')
for a in stale:
print(f' {a}')