Test host in inventory by name in remove_host (#45639)

The host argument is a Host object, and is used as such by
group.remove_host. However, self.hosts is a dictionary of host name to
Host object. Thus, the existing code is checking to see if the Host
object is one of the keys.

Use host.name to interact with the keys of the dictionary.
This commit is contained in:
Monty Taylor 2018-11-06 07:19:58 -06:00 committed by ansibot
parent d4bb67cac0
commit c5b303fa52

View file

@ -224,8 +224,8 @@ class InventoryData(object):
def remove_host(self, host):
if host in self.hosts:
del self.hosts[host]
if host.name in self.hosts:
del self.hosts[host.name]
for group in self.groups:
g = self.groups[group]