Skip to content

Commit fa59170

Browse files
authored
Merge pull request #100 from dev-sec/deprec_warn
fix deprecation warning for undefined error. #99
2 parents ca0bd54 + 11c8197 commit fa59170

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tasks/yum.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616
stat: path='/etc/yum/pluginconf.d/rhnplugin.conf'
1717
register: rhnplugin_file
1818

19+
# for the "default([])" see here:
20+
# https://github.com/dev-sec/ansible-os-hardening/issues/99 and
21+
# https://stackoverflow.com/questions/37067827/ansible-deprecation-warning-for-undefined-variable-despite-when-clause
1922
- name: activate gpg-check for yum-repos
2023
replace: dest='{{item}}' regexp='^\s*gpgcheck=0' replace='gpgcheck=1'
2124
with_items:
22-
- '{{ yum_repos.stdout_lines }}'
2325
- '/etc/yum.conf'
26+
- '{{ yum_repos.stdout_lines| default([]) }}'
2427

2528
- name: activate gpg-check for yum rhn if it exists
2629
replace: dest='/etc/yum/pluginconf.d/rhnplugin.conf' regexp='^\s*gpgcheck=0' replace='gpgcheck=1'

0 commit comments

Comments
 (0)