Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: bootstrap: Local joining node should be included when merging known_hosts (bsc#1229419) #1639

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions crmsh/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1748,7 +1748,7 @@ def join_ssh_merge(cluster_node, remote_user):
"""
logger.info("Merging known_hosts")

hosts = _context.node_list_in_cluster
hosts = _context.node_list_in_cluster + [utils.this_node()]

shell = sh.cluster_shell()
# create local entry in known_hosts
Expand All @@ -1757,7 +1757,6 @@ def join_ssh_merge(cluster_node, remote_user):
known_hosts_new: set[str] = set()

cat_cmd = "[ -e ~/.ssh/known_hosts ] && cat ~/.ssh/known_hosts || true"
#logger_utils.log_only_to_file("parallax.call {} : {}".format(hosts, cat_cmd))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the chance to make lines unique before saving known_hosts_new to the disk. Currently, it easily gets duplicate lines.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try again
I think this duplicate issue already gone

for host in hosts:
known_hosts_content = shell.get_stdout_or_raise_error(cat_cmd, host)
if known_hosts_content:
Expand Down