Skip to content

Commit

Permalink
Fix: bootstrap: ssh key of the init node is duplicated in the
Browse files Browse the repository at this point in the history
authorized_keys files of other node (bsc#1218940)

When a cluster is bootstrap with 'crm cluster init -N', the public key
of the init node is added for mutiple times to the authorized_key files
of other nodes.
  • Loading branch information
nicholasyang2022 committed Jan 22, 2024
1 parent e043def commit 6eade0c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crmsh/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,9 @@ def swap_public_ssh_key(
user=local_user_to_swap,
file=local_authorized_file,
))
utils.su_get_stdout_or_raise_error("sed -i '$a {}' '{}'".format(public_key, local_authorized_file), local_user_to_swap)
utils.su_get_stdout_or_raise_error("grep -F '{content}' '{file}' || sed -i '$a {content}' '{file}'".format(
content=public_key, file=local_authorized_file
), local_user_to_swap)
return public_key
else:
try:
Expand Down

0 comments on commit 6eade0c

Please sign in to comment.