Commit 8e2b1604 authored by Romain Courteaud's avatar Romain Courteaud

theia resiliency

parent d9b411da
......@@ -435,8 +435,8 @@ class TestTheiaExportAndImport(ResilienceMixin, ExportAndImportMixin, ResilientT
self.checkLog(os.path.join(dummy_root, 'log.log'), self.initial_log, newline=None)
# Check that the non ascii filename has been correctly propagated
self.assertTrue(os.path.exists(self.getPartitionPath('import', 'srv', 'project'),
non_ascii_only_filename))
self.assertTrue(os.path.exists(os.path.join(self.getPartitionPath('import', 'srv', 'project'),
non_ascii_only_filename)))
# Check that ~/srv/.backup_identity_script was detected and called
signature = self.getPartitionPath(
......
......@@ -7,6 +7,7 @@ import re
import shutil
import subprocess as sp
import sqlite3
from base64 import urlsafe_b64encode
import six
import zc.buildout.configparser
......@@ -113,6 +114,7 @@ def fast_hashwalk(root_dir):
filepath = os.path.join(dirpath, f)
if os.path.isfile(filepath):
displaypath = os.path.relpath(filepath, start=root_dir)
displaypath = urlsafe_b64encode(displaypath.encode()).decode()
yield '%s %s' % (sha256sum(filepath), displaypath)
......@@ -124,6 +126,7 @@ def exclude_hashwalk(root_dir, instance_dir):
filepath = os.path.join(dirpath, f)
if os.path.isfile(filepath):
displaypath = os.path.relpath(filepath, start=root_dir)
displaypath = urlsafe_b64encode(displaypath.encode()).decode()
yield '%s %s' % (sha256sum(filepath), displaypath)
if dirpath == instance_dir:
remaining_dirs = []
......
......@@ -6,6 +6,7 @@ import sys
import subprocess as sp
import time
import traceback
from base64 import urlsafe_b64decode
import requests
from requests.exceptions import RequestException
......@@ -110,7 +111,7 @@ class TheiaImport(object):
except ValueError:
yield 'Could not parse: %s' % line
continue
filepath = os.path.join(root_dir, relpath)
filepath = os.path.join(root_dir, urlsafe_b64decode(relpath).decode())
try:
signature = sha256sum(filepath)
except IOError:
......
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