Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T258401: Stop deleting important objects found in commits #128

Merged
merged 7 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions perfact/zodbsync/tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2023,3 +2023,20 @@ def test_layer_update(self):
self.run('layer-hash', layer)
self.run('layer-update', ident)
assert self.app.Test.title == 'Changed'

def test_keep_acl(self):
'''
Make sure deletions on acl_users are NOT synced into Data.fs
'''
acl_path = os.path.join(
self.repo.path,
'__root__',
'acl_users',
)
shutil.rmtree(acl_path)
self.run('playback', '/')

# this playback will fail horribly if acl_users is gone!
self.run('playback', '/')

assert 'acl_users' in self.app.objectIds()
5 changes: 4 additions & 1 deletion perfact/zodbsync/zodbsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,10 @@ def _playback_path(self, pathinfo):
srv_contents = obj_contents(obj) if obj else []

# Find IDs in Data.fs object not present in file system
del_ids = [a for a in srv_contents if a not in contents]
del_ids = [
a for a in srv_contents
if a not in contents and a != 'acl_users'
]
if del_ids:
self.logger.warning('Deleting objects ' + repr(del_ids))
obj.manage_delObjects(ids=del_ids)
Expand Down