Merge pull request #5697 from kormoc/fix_missing_localhost_group

Fix an issue where ansbile-pull fails with AttributeError
This commit is contained in:
jctanner 2014-01-21 06:22:27 -08:00
commit 13f5ec3698

View file

@ -272,6 +272,10 @@ class Inventory(object):
new_host.set_variable("ansible_python_interpreter", sys.executable)
new_host.set_variable("ansible_connection", "local")
ungrouped = self.get_group("ungrouped")
if ungrouped is None:
self.add_group(Group('ungrouped'))
ungrouped = self.get_group('ungrouped')
ungrouped.add_host(new_host)
results.append(new_host)
return results