Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inventory and varmanager updates #32054

Merged
merged 3 commits into from
Oct 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions lib/ansible/inventory/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,21 @@ def __init__(self):
self.add_child('all', 'ungrouped')

def serialize(self):
data = dict()
self._groups_dict_cache = None
data = {
'groups': self.groups,
'hosts': self.hosts,
'local': self.locahost,
'source': self.current_source,
}
return data

def deserialize(self, data):
pass
self._groups_dict_cache = {}
self.hosts = data.get('hosts')
self.groups = data.get('groups')
self.localhost = data.get('local')
self.current_source = data.get('source')

def _create_implicit_localhost(self, pattern):

Expand Down
6 changes: 4 additions & 2 deletions lib/ansible/inventory/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ def parse_source(self, source, cache=False):
display.vvv('Parsed %s inventory source with %s plugin' % (to_native(source), plugin_name))
break
except AnsibleParserError as e:
display.debug('%s did not meet %s requirements' % (to_native(source), plugin_name))
display.debug('%s was not parsable by %s' % (to_native(source), plugin_name))
failures.append({'src': source, 'plugin': plugin_name, 'exc': e})
except Exception as e:
display.debug('%s failed to parse %s' % (plugin_name, to_native(source)))
failures.append({'src': source, 'plugin': plugin_name, 'exc': e})
else:
display.debug('%s did not meet %s requirements' % (to_native(source), plugin_name))
Expand All @@ -287,7 +290,6 @@ def parse_source(self, source, cache=False):
for fail in failures:
display.warning('\n* Failed to parse %s with %s plugin: %s' % (to_native(fail['src']), fail['plugin'], to_native(fail['exc'])))
display.vvv(fail['exc'].tb)

if not parsed:
display.warning("Unable to parse %s as an inventory source" % to_native(source))

Expand Down