From e9c83b7a17f3974ee81d3a1c93482f182e782111 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Fri, 14 Jun 2019 18:55:23 +0200 Subject: [PATCH] gather_facts: clean up tmp files upon completion (#57845) Fixes #57248 --- changelogs/fragments/57248-gather_facts-cleanup-tmp.yaml | 2 ++ lib/ansible/plugins/action/gather_facts.py | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 changelogs/fragments/57248-gather_facts-cleanup-tmp.yaml diff --git a/changelogs/fragments/57248-gather_facts-cleanup-tmp.yaml b/changelogs/fragments/57248-gather_facts-cleanup-tmp.yaml new file mode 100644 index 00000000000..f47a495b329 --- /dev/null +++ b/changelogs/fragments/57248-gather_facts-cleanup-tmp.yaml @@ -0,0 +1,2 @@ +bugfixes: + - gather_facts - Clean up tmp files upon completion (https://github.com/ansible/ansible/issues/57248) diff --git a/lib/ansible/plugins/action/gather_facts.py b/lib/ansible/plugins/action/gather_facts.py index e461abe0069..4fa084e1d2d 100644 --- a/lib/ansible/plugins/action/gather_facts.py +++ b/lib/ansible/plugins/action/gather_facts.py @@ -74,6 +74,8 @@ class ActionModule(ActionBase): skipped[fact_module] = res.get('msg') else: result = combine_vars(result, {'ansible_facts': res.get('ansible_facts', {})}) + + self._remove_tmp_path(self._connection._shell.tmpdir) else: # do it async jobs = {}