mirror of
https://github.com/ansible/awx.git
synced 2026-08-04 20:10:01 -02:30
Common Inventory slicing method for job slices
- Extract how slicing is done from Inventory#get_script_data and pull it into a new method, Inventory#get_sliced_hosts - Make use of this method in Inventory#get_script_data - Make use of this method in Job#_get_inventory_hosts (used by Job#start_job_fact_cache and Job#finish_job_fact_cache). This fixes an issue (namely in Tower 4.1) where job slicing with fact caching enabled doesn't save facts for all hosts. Signed-off-by: Rick Elrod <rick@elrod.me>
This commit is contained in:
@@ -814,7 +814,8 @@ class Job(UnifiedJob, JobOptions, SurveyJobMixin, JobNotificationMixin, TaskMana
|
||||
def _get_inventory_hosts(self, only=['name', 'ansible_facts', 'ansible_facts_modified', 'modified', 'inventory_id']):
|
||||
if not self.inventory:
|
||||
return []
|
||||
return self.inventory.hosts.only(*only)
|
||||
host_queryset = self.inventory.hosts.only(*only)
|
||||
return self.inventory.get_sliced_hosts(host_queryset, self.job_slice_number, self.job_slice_count)
|
||||
|
||||
def start_job_fact_cache(self, destination, modification_times, timeout=None):
|
||||
self.log_lifecycle("start_job_fact_cache")
|
||||
|
||||
Reference in New Issue
Block a user