mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 03:31:10 -03:30
Merge pull request #11833 from AlanCoding/facts_update_fields
Use update_fields for Ansible facts update
This commit is contained in:
@@ -859,7 +859,7 @@ class Job(UnifiedJob, JobOptions, SurveyJobMixin, JobNotificationMixin, TaskMana
|
|||||||
continue
|
continue
|
||||||
host.ansible_facts = ansible_facts
|
host.ansible_facts = ansible_facts
|
||||||
host.ansible_facts_modified = now()
|
host.ansible_facts_modified = now()
|
||||||
host.save()
|
host.save(update_fields=['ansible_facts', 'ansible_facts_modified'])
|
||||||
system_tracking_logger.info(
|
system_tracking_logger.info(
|
||||||
'New fact for inventory {} host {}'.format(smart_str(host.inventory.name), smart_str(host.name)),
|
'New fact for inventory {} host {}'.format(smart_str(host.inventory.name), smart_str(host.name)),
|
||||||
extra=dict(
|
extra=dict(
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ def test_finish_job_fact_cache_with_existing_data(job, hosts, inventory, mocker,
|
|||||||
assert host.ansible_facts == {"a": 1, "b": 2}
|
assert host.ansible_facts == {"a": 1, "b": 2}
|
||||||
assert host.ansible_facts_modified is None
|
assert host.ansible_facts_modified is None
|
||||||
assert hosts[1].ansible_facts == ansible_facts_new
|
assert hosts[1].ansible_facts == ansible_facts_new
|
||||||
hosts[1].save.assert_called_once_with()
|
hosts[1].save.assert_called_once_with(update_fields=['ansible_facts', 'ansible_facts_modified'])
|
||||||
|
|
||||||
|
|
||||||
def test_finish_job_fact_cache_with_bad_data(job, hosts, inventory, mocker, tmpdir):
|
def test_finish_job_fact_cache_with_bad_data(job, hosts, inventory, mocker, tmpdir):
|
||||||
|
|||||||
Reference in New Issue
Block a user