Update developing_api.rst (#37108) (#37178)

Fix for #17716 and #36110
(cherry picked from commit 19f92005b9)
pull/37181/head
John R Barker 7 years ago committed by GitHub
parent 193687851b
commit e6effb32b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -42,6 +42,7 @@ In 2.0 things get a bit more complicated to start, but you end up with much more
#!/usr/bin/env python #!/usr/bin/env python
import json import json
import shutil
from collections import namedtuple from collections import namedtuple
from ansible.parsing.dataloader import DataLoader from ansible.parsing.dataloader import DataLoader
from ansible.vars.manager import VariableManager from ansible.vars.manager import VariableManager
@ -49,6 +50,7 @@ In 2.0 things get a bit more complicated to start, but you end up with much more
from ansible.playbook.play import Play from ansible.playbook.play import Play
from ansible.executor.task_queue_manager import TaskQueueManager from ansible.executor.task_queue_manager import TaskQueueManager
from ansible.plugins.callback import CallbackBase from ansible.plugins.callback import CallbackBase
import ansible.constants as C
class ResultCallback(CallbackBase): class ResultCallback(CallbackBase):
"""A sample callback plugin used for performing an action as results come in """A sample callback plugin used for performing an action as results come in
@ -107,6 +109,9 @@ In 2.0 things get a bit more complicated to start, but you end up with much more
finally: finally:
if tqm is not None: if tqm is not None:
tqm.cleanup() tqm.cleanup()
# Remove ansible tmpdir
shutil.rmtree(C.DEFAULT_LOCAL_TMP, True)
.. _python_api_old: .. _python_api_old:

Loading…
Cancel
Save