public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] Fix remove_hosts() function
@ 2024-11-11 21:44 cel
  2024-11-12 20:20 ` Luis Chamberlain
  0 siblings, 1 reply; 2+ messages in thread
From: cel @ 2024-11-11 21:44 UTC (permalink / raw)
  To: Luis Chamberlain; +Cc: kdevops, Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

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 <chuck.lever@oracle.com>
---
 update_ssh_config/update_ssh_config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

This is the simple patch that address the immediate concern about
"--remove" not working. I can push it directly to the github repo,
or I can open a github PR, or you can apply it. Let me know.

diff --git a/update_ssh_config/update_ssh_config.py b/update_ssh_config/update_ssh_config.py
index feac31d2272f..731533d3cc76 100755
--- a/update_ssh_config/update_ssh_config.py
+++ b/update_ssh_config/update_ssh_config.py
@@ -41,7 +41,7 @@ def remove_hosts(args):
         if len(kv) > 1:
             key, value = kv
             if key.lower() == "host":
-                if value in hosts:
+                if value.split(' ')[0] in hosts:
                     rm_this_host = True
                     continue
                 else:
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix remove_hosts() function
  2024-11-11 21:44 [PATCH] Fix remove_hosts() function cel
@ 2024-11-12 20:20 ` Luis Chamberlain
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Chamberlain @ 2024-11-12 20:20 UTC (permalink / raw)
  To: cel; +Cc: kdevops, Chuck Lever

On Mon, Nov 11, 2024 at 04:44:25PM -0500, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> 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 <chuck.lever@oracle.com>
> ---
>  update_ssh_config/update_ssh_config.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> This is the simple patch that address the immediate concern about
> "--remove" not working. I can push it directly to the github repo,
> or I can open a github PR, or you can apply it. Let me know.

Please just push! All patches posted to the kdevops mailing list get
automatically tested now thanks to our integration with kpd [0] the
results published on the kdevops-kpd tree [1].

[0] https://github.com/linux-kdevops/kdevops/blob/main/docs/kernel-ci/README.md
[1] https://github.com/linux-kdevops/kdevops-kpd/actions

  Luis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-12 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-11 21:44 [PATCH] Fix remove_hosts() function cel
2024-11-12 20:20 ` Luis Chamberlain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox