Skip to content

Commit

Permalink
Fix: bootstrap: Improve sync_files_to_disk function (bsc#1219537)
Browse files Browse the repository at this point in the history
Filter out the files that not exist in local and remote
  • Loading branch information
liangxin1300 committed Jan 2, 2025
1 parent 2402198 commit 6bd7204
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions crmsh/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1882,9 +1882,22 @@ def sync_files_to_disk():
"""
Sync file content to disk between cluster nodes
"""
files_string = ' '.join(filter(lambda f: os.path.isfile(f), FILES_TO_SYNC))
if files_string:
utils.cluster_run_cmd("sync {}".format(files_string.strip()))
target_files_str = ""

for f in FILES_TO_SYNC:
# check if the file exists on the local node
if not os.path.isfile(f):
continue
try:
# check if the file exists on the remote node
utils.cluster_run_cmd(f"test -f {f}")
except ValueError:
continue
else:
target_files_str += f + " "

if target_files_str:
utils.cluster_run_cmd(f"sync {target_files_str.strip()}")


def detect_mountpoint(seed_host: str) -> None:
Expand Down

0 comments on commit 6bd7204

Please sign in to comment.