Merge pull request #3692 from tima/action-init

Added support of an optional init method for action modules like rsync that need to alter the connection and other inject data before it's established.
pull/4420/head
Michael DeHaan 2013-08-03 12:00:04 -07:00
commit 1c6b81233c
1 changed files with 2 additions and 0 deletions

View File

@ -534,6 +534,8 @@ class Runner(object):
self.callbacks.on_skipped(host, inject.get('item',None)) self.callbacks.on_skipped(host, inject.get('item',None))
return ReturnData(host=host, result=result) return ReturnData(host=host, result=result)
if getattr(handler, 'setup', None) is not None:
handler.setup(module_name, inject)
conn = None conn = None
actual_host = inject.get('ansible_ssh_host', host) actual_host = inject.get('ansible_ssh_host', host)
# allow ansible_ssh_host to be templated # allow ansible_ssh_host to be templated