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

theia resiliency

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