mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Return early from setup step when possible
The _list_available_hosts call can be lengthy, and in the case where gather_facts is disabled the call is pointless. So re-arrange the logic to return early from _do_setup_step when gather_facts is false.
This commit is contained in:
parent
191be7b951
commit
35328ed503
1 changed files with 3 additions and 3 deletions
|
@ -433,11 +433,11 @@ class PlayBook(object):
|
|||
def _do_setup_step(self, play):
|
||||
''' get facts from the remote system '''
|
||||
|
||||
host_list = self._list_available_hosts(play.hosts)
|
||||
|
||||
if play.gather_facts is False:
|
||||
return {}
|
||||
elif play.gather_facts is None:
|
||||
|
||||
host_list = self._list_available_hosts(play.hosts)
|
||||
if play.gather_facts is None:
|
||||
host_list = [h for h in host_list if h not in self.SETUP_CACHE or 'module_setup' not in self.SETUP_CACHE[h]]
|
||||
if len(host_list) == 0:
|
||||
return {}
|
||||
|
|
Loading…
Reference in a new issue