From d80a61f81089338e5dc9a2cfd98ee3d322014c3a Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Wed, 28 Feb 2024 08:51:29 +0000 Subject: [PATCH] Workaround ansible unsafe text templating bug See https://github.com/ansible/ansible/issues/82598 Setting the 'use' parameter to something other than 'auto' should cause a different code path to be use in the package action plugin which could avoid the templating unsafe text inside the plugin. Change-Id: I0c14510eb625d74a654a6398387ab74c4355a4e8 --- tasks/python_venv_install.yml | 2 ++ tasks/python_venv_wheel_build.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tasks/python_venv_install.yml b/tasks/python_venv_install.yml index 80d35f1..f9052c9 100644 --- a/tasks/python_venv_install.yml +++ b/tasks/python_venv_install.yml @@ -25,6 +25,7 @@ # Perhaps do this if the distro/architecture of the target host differs # from the build host. +# NOTE(jrosser) remove the use: parameter when https://github.com/ansible/ansible/issues/82598 is fixed - name: Install distro packages for venv build package: name: >- @@ -42,6 +43,7 @@ state: "{{ venv_distro_package_state }}" update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}" cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(venv_distro_cache_valid_time, omit) }}" + use: "{{ ansible_facts['pkg_mgr'] }}" when: - ((venv_build_base_distro_package_list | union(venv_build_distro_package_list)) | length > 0) or ((venv_install_base_distro_package_list | union(venv_install_distro_package_list)) | length > 0) diff --git a/tasks/python_venv_wheel_build.yml b/tasks/python_venv_wheel_build.yml index 73d7122..b217e87 100644 --- a/tasks/python_venv_wheel_build.yml +++ b/tasks/python_venv_wheel_build.yml @@ -16,6 +16,7 @@ - name: Build the wheels on the build host delegate_to: "{{ venv_build_host }}" block: + # NOTE(jrosser) remove the use: parameter when https://github.com/ansible/ansible/issues/82598 is fixed - name: Install distro packages for wheel build vars: _python_wheel_build_package_list: "{{ venv_build_base_distro_package_list | union(venv_build_distro_package_list) }}" @@ -24,6 +25,7 @@ state: "{{ venv_distro_package_state }}" update_cache: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary('yes', omit) }}" cache_valid_time: "{{ (ansible_facts['pkg_mgr'] == 'apt') | ternary(venv_distro_cache_valid_time, omit) }}" + use: "{{ ansible_facts['pkg_mgr'] }}" when: - _python_wheel_build_package_list | length > 0 register: _install_build_distro_packages