From 974284426086b6b863c25e02b6cb5e832ec87173 Mon Sep 17 00:00:00 2001 From: Sergii Golovatiuk Date: Fri, 5 Dec 2025 13:10:13 +0100 Subject: [PATCH] [config_drive] Fix conditional to handle NoneType properly Replace explicit 'is not none' check with default filter for None safety. It sets minimal dict as default for cifmw_config_drive_network as stated in README.md. Ansible 2.16+ requires conditionals to return boolean values, not NoneType. Co-Authored-By: Claude Signed-off-by: Sergii Golovatiuk --- roles/config_drive/tasks/main.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/roles/config_drive/tasks/main.yml b/roles/config_drive/tasks/main.yml index e41c89ba16..a103959be5 100644 --- a/roles/config_drive/tasks/main.yml +++ b/roles/config_drive/tasks/main.yml @@ -51,8 +51,7 @@ - name: Generate user-data register: _user_data_change when: - - cifmw_config_drive_userdata is not none - - cifmw_config_drive_userdata | length > 0 + - cifmw_config_drive_userdata | default({}) | length > 0 ansible.builtin.template: backup: true src: "user-data.j2" @@ -61,9 +60,7 @@ - name: Generate network-data register: _net_data_change - when: - - cifmw_config_drive_networkconfig is not none - - cifmw_config_drive_networkconfig | length > 0 + when: cifmw_config_drive_networkconfig | default({}) | length > 0 ansible.builtin.template: backup: true src: "network-config.j2"