Skip to content

Commit e59e176

Browse files
committed
Handle skipped certificate checks
1 parent 3ca158a commit e59e176

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎roles/https_proxy/tasks/main.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
megaproxy_certificate_needs_issue: >-
5454
{{
5555
not megaproxy_certificate.stat.exists or
56-
(megaproxy_certificate_hostname_checks.results | default([]) | selectattr('rc', 'ne', 0) | list | length > 0) or
57-
(megaproxy_certificate_hostname_checks.results | default([]) | selectattr('stdout', 'search', 'does NOT match certificate') | list | length > 0)
56+
(megaproxy_certificate_hostname_checks.results | default([]) | selectattr('rc', 'defined') | selectattr('rc', 'ne', 0) | list | length > 0) or
57+
(megaproxy_certificate_hostname_checks.results | default([]) | selectattr('stdout', 'defined') | selectattr('stdout', 'search', 'does NOT match certificate') | list | length > 0)
5858
}}
5959
6060
- name: Create self-signed certificate directory

‎tests/test_https_proxy_role.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ def test_domain_certificate_detects_openssl_textual_mismatch() -> None:
2525

2626
# OpenSSL 3.0 on the managed host prints a mismatch but exits with rc=0.
2727
assert "does NOT match certificate" in decision_task
28+
# Skipped checks (for example self-signed TLS) have neither rc nor stdout.
29+
assert "selectattr('rc', 'defined')" in decision_task
30+
assert "selectattr('stdout', 'defined')" in decision_task

0 commit comments

Comments
 (0)