mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 06:31:23 -07:00
Import cleanup, plus have /bin/ansible remind you if no hosts were matched by a pattern (for instance, assume
there was a typo in the pattern)
This commit is contained in:
parent
fde7de80df
commit
9c5ec886a6
4 changed files with 20 additions and 10 deletions
|
@ -149,6 +149,14 @@ def has_dark_hosts(results):
|
|||
''' are there any uncontactable hosts? '''
|
||||
return len(results['dark'].keys()) > 0
|
||||
|
||||
def has_contacted_hosts(results):
|
||||
''' are there any contacted hosts? '''
|
||||
return len(results['contacted'].keys()) > 0
|
||||
|
||||
def has_hosts(results):
|
||||
''' did ansible run against any hosts at all? '''
|
||||
return has_contacted_hosts(results) or has_dark_hosts(results)
|
||||
|
||||
def contacted_hosts(results):
|
||||
''' what are the contactable hosts? '''
|
||||
return sorted(results['contacted'])
|
||||
|
@ -186,7 +194,11 @@ def async_poll_status(jid, host, clock, result):
|
|||
else:
|
||||
return "<job %s> polling on %s, %s remaining" % (jid, host, clock)
|
||||
|
||||
def json_loads(data):
|
||||
return json.loads(data)
|
||||
|
||||
def parse_json(data):
|
||||
''' this version for module return data only '''
|
||||
try:
|
||||
return json.loads(data)
|
||||
except:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue