mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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:
parent
d4bb67cac0
commit
c5b303fa52
1 changed files with 2 additions and 2 deletions
|
@ -224,8 +224,8 @@ class InventoryData(object):
|
||||||
|
|
||||||
def remove_host(self, host):
|
def remove_host(self, host):
|
||||||
|
|
||||||
if host in self.hosts:
|
if host.name in self.hosts:
|
||||||
del self.hosts[host]
|
del self.hosts[host.name]
|
||||||
|
|
||||||
for group in self.groups:
|
for group in self.groups:
|
||||||
g = self.groups[group]
|
g = self.groups[group]
|
||||||
|
|
Loading…
Reference in a new issue