Skip to content

Commit 49fa0ba

Browse files
chuckleverKPD
authored andcommitted
Fix remove_hosts() function
Commit 3b6fbaaaf1df ("update_ssh_config.py: add IP address on Host line") added an IP address at the end of each Host line. This extra field breaks the simple host entry matching logic in the remove_hosts() function, making "--remove" a no-op. If the ssh_config entries are not removed, the config file grows without bounds. If new hostnames are added that have the same name as existing entries, ssh to those hosts fails, which makes certain Ansible tasks hang for a bit and then fail. Fixes: 3b6fbaaaf1df ("update_ssh_config.py: add IP address on Host line") Signed-off-by: Chuck Lever <[email protected]>
1 parent c148677 commit 49fa0ba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

playbooks/roles/update_ssh_config_vagrant/update_ssh_config/update_ssh_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def remove_hosts(args):
4141
if len(kv) > 1:
4242
key, value = kv
4343
if key.lower() == "host":
44-
if value in hosts:
44+
if value.split(' ')[0] in hosts:
4545
rm_this_host = True
4646
continue
4747
else:

0 commit comments

Comments
 (0)