Skip to content

Commit 2e43f8a

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 e8e8769 commit 2e43f8a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

vars/main.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,14 @@ __firewall_firewalld_conf: "{{ __firewall_firewalld_dir }}/firewalld.conf"
44

55
# ansible_facts required by the role
66
__firewall_required_facts:
7-
- python_interpreter
87
- python_version
98
- service_mgr
109

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

2016
__firewall_packages_base: [firewalld]
2117

0 commit comments

Comments
 (0)