fix: handle None from lookup('file') when postfix-accounts.cf doesn't exist
Some checks failed
CI/CD / syntax-check (push) Successful in 1m12s
CI/CD / deploy (push) Failing after 16m1s

lookup(..., errors='ignore') returns None (not empty string) for missing files.
Use | default('', true) to also convert falsy None to empty string.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jack 2026-03-22 17:46:30 +07:00
parent 644b5b74c1
commit 836d554e7b

View file

@ -145,7 +145,7 @@
- { address: "jack@{{ domain_base }}", password: "{{ mailserver_jack_password }}" } - { address: "jack@{{ domain_base }}", password: "{{ mailserver_jack_password }}" }
when: > when: >
not postfix_accounts_file.stat.exists or not postfix_accounts_file.stat.exists or
item.address not in (lookup('file', tools_root + '/mailserver/config/postfix-accounts.cf', errors='ignore') | default('')) item.address not in (lookup('file', tools_root + '/mailserver/config/postfix-accounts.cf', errors='ignore') | default('', true))
# ── DKIM ───────────────────────────────────────────────────────────────────── # ── DKIM ─────────────────────────────────────────────────────────────────────
- name: Check if DKIM key exists - name: Check if DKIM key exists