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.
pull/48167/head
Monty Taylor 6 years ago committed by ansibot
parent d4bb67cac0
commit c5b303fa52

@ -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]

Loading…
Cancel
Save