Skip to content

Commit e8e8769

Browse files
committed
fix: facts being gathered unnecessarily
Cause: The comparison of the present facts with the required facts is being done on unsorted lists. Consequence: The comparison may fail if the only difference is the order. Facts are gathered unnecessarily. Fix: Use `difference` which works no matter what the order is. Ensure that the fact gathering subsets used are the absolute minimum required. Result: The role gathers only the facts it requires, and does not unnecessarily gather facts. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
1 parent c969ff4 commit e8e8769

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

vars/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ __firewall_required_facts:
88
- python_version
99
- service_mgr
1010

11+
# these facts cannot be used as a gather_subset
12+
__firewall_no_subset_facts: [python_interpreter]
13+
1114
# the subsets of ansible_facts that need to be gathered in case any of the
1215
# facts in required_facts is missing; see the documentation of
1316
# the 'gather_subset' parameter of the 'setup' module
1417
__firewall_required_facts_subsets: "{{ ['!all', '!min'] +
15-
__firewall_required_facts }}"
18+
__firewall_required_facts | difference(__firewall_no_subset_facts) }}"
1619

1720
__firewall_packages_base: [firewalld]
1821

0 commit comments

Comments
 (0)