fixing bug in prep scripts

This commit is contained in:
brent s. 2020-07-15 12:26:14 -04:00
parent 7df740a225
commit 7df5d78ec1
Signed by: bts
GPG Key ID: 8C004C2F93481F6B

View File

@ -257,10 +257,12 @@ class Backup(object):
os.makedirs(tmpdir, exist_ok = True)
os.chmod(tmpdir, mode = 0o0700)
for idx, prep in enumerate(repo['prep']):
exec_tmp = tempfile.mkstemp(prefix = '_borgextend.',
suffix = '._tmpexc',
text = True,
dir = tmpdir)[1]
exec_fd, exec_tmp = tempfile.mkstemp(prefix = '_borgextend.',
suffix = '._tmpexc',
text = True,
dir = tmpdir)[1]
# D'oh. I need to close the FD before messing with it.
os.close(exec_fd)
os.chmod(exec_tmp, mode = 0o0700)
with open(exec_tmp, 'w') as f:
f.write(prep)