Commit 13f5ec36 by jctanner

Merge pull request #5697 from kormoc/fix_missing_localhost_group

Fix an issue where ansbile-pull fails with AttributeError
parents 4b9127f0 761fe8cc
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment