mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Regression tests for playbooks, logging the events they call via callbacks.
This commit is contained in:
@@ -83,7 +83,6 @@ class PlayBook(object):
|
||||
# playbook file can be passed in as a path or
|
||||
# as file contents (to support API usage)
|
||||
|
||||
print "DEBUG: playbook=%s" % playbook
|
||||
self.basedir = os.path.dirname(playbook)
|
||||
self.playbook = self._parse_playbook(playbook)
|
||||
|
||||
@@ -384,7 +383,7 @@ class PlayBook(object):
|
||||
else:
|
||||
self.failures[host] = self.failures[host] + 1
|
||||
else:
|
||||
self.callbacks.on_ok(host)
|
||||
self.callbacks.on_ok(host, results)
|
||||
if not host in self.invocations:
|
||||
self.invocations[host] = 1
|
||||
else:
|
||||
@@ -418,7 +417,9 @@ class PlayBook(object):
|
||||
# for this particular pattern group
|
||||
|
||||
for x in handlers:
|
||||
name = x['name']
|
||||
name = x.get('name', None)
|
||||
if name is None:
|
||||
raise errors.AnsibleError('handler is missing a name')
|
||||
if match_name == name:
|
||||
# flag the handler with the list of hosts
|
||||
# it needs to be run on, it will be run later
|
||||
|
||||
@@ -385,6 +385,12 @@ class Runner(object):
|
||||
and then run the async module wrapping the other module
|
||||
'''
|
||||
|
||||
# hack to make the 'shell' module keyword really be executed
|
||||
# by the command module
|
||||
if self.module_name == 'shell':
|
||||
self.module_name = 'command'
|
||||
self.module_args.append("#USE_SHELL")
|
||||
|
||||
async = self._transfer_module(conn, tmp, 'async_wrapper')
|
||||
module = self._transfer_module(conn, tmp, self.module_name)
|
||||
result = self._execute_module(conn, tmp, async, self.module_args,
|
||||
|
||||
Reference in New Issue
Block a user