Address type warnings during bootstrap process

from_yaml filter accepts only string text as an input, defining default
to empty dict/list is incorrect and results in deprecation warning.

We also address string convertion to bool using the bool filter, as
truthy should be used instead.

Change-Id: If5bb21aae9c3c0ffd9376268af72cfccd8311ac0
Signed-off-by: Dmitriy Rabotyagov <dmitriy.rabotyagov@cleura.com>
This commit is contained in:
Dmitriy Rabotyagov
2026-03-27 11:02:54 +01:00
parent 8eb7d2620e
commit c06fe5a541
2 changed files with 3 additions and 3 deletions
@@ -68,5 +68,5 @@
required_collections: "{{ lookup('file', collection_file) | from_yaml }}"
collection_path_default: '/etc/ansible/'
user_collection_file: 'user-collection-requirements.yml'
user_collections: "{{ lookup('file', user_collections_path, errors='ignore') | default({}, true) | from_yaml }}"
user_collections: "{{ lookup('file', user_collections_path, errors='ignore') | default('', true) | from_yaml }}"
user_collections_path: "{{ lookup('env', 'OSA_CONFIG_DIR') | default('/etc/openstack_deploy', true) ~ '/' ~ user_collection_file }}"
+2 -2
View File
@@ -51,7 +51,7 @@
state: absent
when:
- ((item.path | default(role_path_default) ~ '/' ~ item.name | default(item.src | basename) ~ '/.git') is not directory) or
(lookup('env', 'DROP_ROLE_DIRS') | bool is true)
(lookup('env', 'DROP_ROLE_DIRS') is truthy)
with_items: "{{ clone_roles }}"
- name: Ensure the default roles directory exists
@@ -94,7 +94,7 @@
required_roles: "{{ lookup('file', role_file) | from_yaml }}"
role_file: "{{ playbook_dir }}/../ansible-role-requirements.yml"
role_path_default: '/etc/ansible/roles'
user_roles: "{{ lookup('file', user_role_path, errors='ignore') | default([], true) | from_yaml }}"
user_roles: "{{ lookup('file', user_role_path, errors='ignore') | default('', true) | from_yaml }}"
user_role_path: "{{ config_dir ~ '/' ~ (user_role_file | default('')) }}"
git_clone_retries: 2
git_clone_retry_delay: 5