Rename 'successful' to 'contacted' ...

This commit is contained in:
Michael DeHaan 2012-02-23 22:47:03 -05:00
parent 530e54b3e4
commit 7be8d134c9
2 changed files with 9 additions and 5 deletions

View file

@ -75,7 +75,10 @@ Run a module by name with arguments
API Example API Example
=========== ===========
The API is simple and returns basic datastructures. The API is simple and returns basic datastructures. Ansible will keep
track of which hosts were successfully contacted seperately from hosts
that had communication problems. The format of the return, if successful,
is entirely up to the module.
import ansible import ansible
runner = ansible.Runner( runner = ansible.Runner(
@ -86,17 +89,18 @@ The API is simple and returns basic datastructures.
data = runner.run() data = runner.run()
{ {
'successful' : { 'contacted' : {
'xyz.example.com' : [ 'any kind of datastructure is returnable' ], 'xyz.example.com' : [ 'any kind of datastructure is returnable' ],
'foo.example.com' : [ '...' ] 'foo.example.com' : [ '...' ]
}, },
'failed' : { 'dark' : {
'bar.example.com' : [ 'failure message' ] 'bar.example.com' : [ 'failure message' ]
} }
} }
Additional options to Runner include the number of forks, hostname Additional options to Runner include the number of forks, hostname
exclusion pattern, library path, arguments, and so on. exclusion pattern, library path, arguments, and so on.
Read the source, it's not complicated. Read the source, it's not complicated.
Patterns Patterns

View file

@ -155,8 +155,8 @@ class Runner(object):
hosts = [ (self,x) for x in hosts ] hosts = [ (self,x) for x in hosts ]
results = pool.map(_executor_hook, hosts) results = pool.map(_executor_hook, hosts)
results2 = { results2 = {
"successful" : {}, "contacted" : {},
"failed" : {} "dark" : {}
} }
for x in results: for x in results:
(host, is_ok, result) = x (host, is_ok, result) = x