Fix postgresql_lang integration test for CentOS 8 (#64872)

* Only search inside the role for files to include
When a role is called as a dependency, both roles are searched. This can cause the incorrect file to be included if it is picked up from the parent role.
This commit is contained in:
Sam Doran 2019-11-18 10:45:22 -05:00 committed by GitHub
parent 1df62f129a
commit fcd29406a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 16 deletions

View file

@ -1,7 +1,20 @@
# Initial CI tests of postgresql_lang module
- import_tasks: postgresql_lang_initial.yml
when: ansible_distribution == 'CentOS'
- name: Include distribution specific variables
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_major_version }}.yml"
- default.yml
paths:
- vars
# CI tests of owner param
- import_tasks: postgresql_lang_add_owner_param.yml
when: ansible_distribution == 'CentOS'
# Only run on CentOS 7 because there is a stack trace on CentOS 8 because the module
# is looking for the incorrect version of plpython.
# https://gist.github.com/samdoran/8fc1b4ae834d3e66d1895d087419b8d8
- name: Initial CI tests of postgresql_lang module
when:
- ansible_facts.distribution == 'CentOS'
- ansible_facts.distribution_major_version is version ('7', '==')
block:
- include_tasks: postgresql_lang_initial.yml
- include_tasks: postgresql_lang_add_owner_param.yml

View file

@ -2,14 +2,12 @@
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Preparation for tests:
- name: postgresql_lang - install lang plperl
- name: Install PostgreSQL support packages
become: yes
package:
name: "{{ item }}"
action: "{{ ansible_facts.pkg_mgr }}"
args:
name: "{{ postgresql_lang_packages }}"
state: present
with_items:
- postgresql-plperl
- postgresql-plpython
###############
# Do main tests

View file

@ -0,0 +1,3 @@
postgresql_lang_packages:
- postgresql-plperl
- postgresql-plpython

View file

@ -0,0 +1,3 @@
postgresql_lang_packages:
- postgresql-plperl
- postgresql-plpython3

View file

@ -8,14 +8,17 @@
python_suffix: "-py3"
when: ansible_python_version is version('3', '>=')
- include_vars: '{{ item }}'
with_first_found:
- files:
- name: Include distribution and Python version specific variables
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}{{ python_suffix }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}{{ python_suffix }}.yml'
- '{{ ansible_os_family }}{{ python_suffix }}.yml'
- 'default{{ python_suffix }}.yml'
paths: '../vars'
paths:
- "{{ role_path }}/vars"
- name: make sure the dbus service is started under systemd
systemd: