-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow filesystem.setperm to not have mode specified
The UI team uses the combination of no mode with stripacl to strip ACLs from paths.
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
|
||
from middlewared.test.integration.assets.pool import dataset | ||
from middlewared.test.integration.utils import call | ||
|
||
|
||
def test__strip_acl_setperm(): | ||
""" verify ACL can be stripped on single file by explicity specifying strip """ | ||
with dataset('stripacl_test', {'share_type': 'SMB'}) as ds: | ||
mp = os.path.join('/mnt', ds) | ||
|
||
dir_path = os.path.join(mp, 'thedir') | ||
assert call('filesystem.stat', mp)['acl'] | ||
|
||
call('filesystem.mkdir', {'path': dir_path, 'raise_chmod_error': False}) | ||
assert call('filesystem.stat', dir_path)['acl'] | ||
|
||
# nonrecursive | ||
call('filesystem.setperm', {'path': mp, 'options': {'stripacl': True}}, job=True) | ||
|
||
# target for setperm should not have ACL anymore | ||
assert not call('filesystem.stat', mp)['acl'] | ||
|
||
# but directory should | ||
assert call('filesystem.stat', dir_path)['acl'] | ||
|
||
# recursive | ||
call('filesystem.setperm', {'path': mp, 'options': {'stripacl': True, 'recursive': True}}, job=True) | ||
assert not call('filesystem.stat', dir_path)['acl'] |