summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/yum_repository
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2021-06-24 21:19:24 +0200
committerGitHub <noreply@github.com>2021-06-24 21:19:24 +0200
commit03cb40e712897d411efed3b901773773370e25cd (patch)
treeeb49d560bc84970203648851a06d1994f22c7204 /test/integration/targets/yum_repository
parentAdd a resolved_action task attribute (#74709) (diff)
downloadansible-03cb40e712897d411efed3b901773773370e25cd.tar.xz
ansible-03cb40e712897d411efed3b901773773370e25cd.zip
Fix baseurl handling in yum_repository test (#75096)
Since we moved yum_repository_test_repo.baseurl to file:/// format, using urlsplit filter on it returned an empty string. Using an empty string as a left operand of `in` was then always evaluated to True. This was discovered with native jinja being on where urlsplit returns None which results in a hard fail as None cannot be a left operand of `in <string>`.
Diffstat (limited to 'test/integration/targets/yum_repository')
-rw-r--r--test/integration/targets/yum_repository/tasks/main.yml9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/integration/targets/yum_repository/tasks/main.yml b/test/integration/targets/yum_repository/tasks/main.yml
index 96f7d3f903..90866523e0 100644
--- a/test/integration/targets/yum_repository/tasks/main.yml
+++ b/test/integration/targets/yum_repository/tasks/main.yml
@@ -167,7 +167,7 @@
description: Testing list feature
baseurl:
- "{{ yum_repository_test_repo.baseurl }}"
- - "{{ yum_repository_test_repo.baseurl | replace('download[0-9]?\\.', 'download2\\.', 1) }}"
+ - "{{ yum_repository_test_repo.baseurl ~ 'another_baseurl' }}"
gpgkey:
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-{{ ansible_facts.distribution_major_version }}
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG2-KEY-EPEL-{{ ansible_facts.distribution_major_version }}
@@ -187,13 +187,12 @@
- name: Assert that lists were properly inserted
assert:
that:
- - url_hostname in repofile
- - url_hostname2 in repofile
+ - yum_repository_test_repo.baseurl in repofile
+ - another_baseurl in repofile
- "'RPM-GPG-KEY-EPEL' in repofile"
- "'RPM-GPG2-KEY-EPEL' in repofile"
- "'aaa bbb' in repofile"
- "'ccc ddd' in repofile"
vars:
repofile: "{{ slurp.content | b64decode }}"
- url_hostname: "{{ yum_repository_test_repo.baseurl | urlsplit('hostname') }}"
- url_hostname2: "{{ url_hostname | replace('download[0-9]?\\.', 'download2\\.', 1) }}"
+ another_baseurl: "{{ yum_repository_test_repo.baseurl ~ 'another_baseurl' }}"