Skip to content

Commit

Permalink
fix uncaught SetAccessTask exceptions (#1906)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Feb 19, 2024
1 parent c8f59a7 commit 814f960
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Fixed
- Sheet template creation failure with slash characters in title/ID fields (#1896)
- **Taskflowbackend**
- Hardcoded iRODS path length in ``landing_zone_move`` (#1888)
- Uncaught exceptions in ``SetAccessTask`` (#1906)

Removed
-------
Expand Down
23 changes: 12 additions & 11 deletions taskflowbackend/tasks/irods_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,21 @@ def execute(
*args,
**kwargs
):
if obj_target:
target = self.irods.data_objects.get(path)
recursive = False
else:
target = self.irods.collections.get(path)
recursive = recursive
try:
if obj_target:
target = self.irods.data_objects.get(path)
recursive = False
else:
target = self.irods.collections.get(path)
recursive = recursive
target_access = self.irods.permissions.get(target=target)
except Exception as ex:
self._raise_irods_exception(ex, path)

target_access = self.irods.permissions.get(target=target)
user_access = next(
(x for x in target_access if x.user_name == user_name), None
)
modifying_data = False
if (
user_access
and user_access.access_name != access_lookup[access_name]
Expand All @@ -314,8 +318,6 @@ def execute(
elif not user_access:
self.execute_data['access_name'] = 'null'
modifying_data = True
else:
modifying_data = False

if modifying_data:
acl = iRODSAccess(
Expand All @@ -327,8 +329,7 @@ def execute(
try:
self.irods.permissions.set(acl, recursive=recursive)
except Exception as ex:
ex_info = user_name
self._raise_irods_exception(ex, ex_info)
self._raise_irods_exception(ex, user_name)
self.data_modified = True
super().execute(*args, **kwargs)

Expand Down

0 comments on commit 814f960

Please sign in to comment.