lab.nexedi.com will be down from Thursday, 20 March 2025, 07:30:00 UTC for a duration of approximately 2 hours

Commit ba1ab14a authored by Nicolas Wavrant's avatar Nicolas Wavrant

theia: support moving file on different filesystem during resiliency export

Due to disk usage on my production server, I had to move the theia's
backup to a different file system. I bind mount this other fs on:

slappart0/srv/backup/theia

Mounting on "slappart0/srv/backup" would make logrogate
complain (logrotate is used in the "backup" cron, triggering the
resiliency process). So "slappart0/srv/backup/theia" was the 2nd best
idea. Unfortunately for my case, os.rename raises if the src and dest
filesystems are different, as it os.rename guarantees the atomicity of
the operation. As atomicity is not that important for copying the
signature file, it can be replaced by shutil.move.
parent f4c4c160
Pipeline #40331 failed with stage
in 0 seconds
......@@ -2,6 +2,7 @@ import argparse
import glob
import itertools
import os
import shutil
import sys
import time
import traceback
......@@ -92,7 +93,7 @@ class TheiaExport(object):
with open(tmpfile, 'w') as f:
for s in signatures:
f.write(s + '\n')
os.rename(tmpfile, signaturefile)
shutil.move(tmpfile, signaturefile)
def sign_root(self):
signaturefile = os.path.join(self.backup_dir, 'backup.signature')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment