From 81581a2b640f0e043e0f845275843613aff7be44 Mon Sep 17 00:00:00 2001 From: sphilipp Date: Sat, 25 Oct 2025 19:01:02 +0200 Subject: [PATCH] fix(cvmfs): make conditional expressions compatible with ansible-core 2.18+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recent versions of ansible-core (≥2.16, included in ansible 11.x) enforce strict boolean evaluation for 'when' statements. The previous condition: when: cvmfs_config_repo and cvmfs_config_repo_supported was no longer valid because: - cvmfs_config_repo is a dict (not directly evaluable as boolean) - cvmfs_config_repo_supported is a string ('true'/'false') This caused runtime failures: > Conditional result (False) was derived from value of type 'dict' The condition has been rewritten to use explicit boolean conversions: when: (cvmfs_config_repo | length > 0) and (cvmfs_config_repo_supported | bool) This restores compatibility with ansible-core 2.18+ (ansible 11.x) and preserves behavior with older releases. Signed-off-by: sphilipp --- defaults/main.yml | 7 +++---- tasks/client.yml | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index b9f17b0..f21cd19 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -106,10 +106,9 @@ cvmfs_config_repo: {} # CVMFS_CONFIG_REPOSITORY is not supported on Debian < 9, Ubuntu LTS < 18.04 cvmfs_config_repo_supported: >- {{ - 'true' if ansible_os_family != 'Debian' else ( - 'true' if (ansible_distribution == 'Debian' and ansible_distribution_version is version('9', '>=')) else ( - 'true' if (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('18.04', '>=')) else - 'false')) + ansible_os_family != 'Debian' or + (ansible_distribution == 'Debian' and ansible_distribution_version is version('9', '>=')) or + (ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('18.04', '>=')) }} # When to update the GeoIP database, if cvmfs_geo_license_key is defined diff --git a/tasks/client.yml b/tasks/client.yml index c12a601..3b2c290 100644 --- a/tasks/client.yml +++ b/tasks/client.yml @@ -27,7 +27,7 @@ when: not ansible_check_mode and "CernVM-FS map is not referenced" in cvmfs_config_chksetup_out.stdout - name: Configure CernVM-FS config repository - when: cvmfs_config_repo and cvmfs_config_repo_supported + when: (cvmfs_config_repo | length > 0) and (cvmfs_config_repo_supported | bool) block: - name: Create config repo config ansible.builtin.copy: