Skip to content

Commit

Permalink
Merge pull request #209 from kjsanger/feature/improve-logging
Browse files Browse the repository at this point in the history
Logging improvements
  • Loading branch information
kjsanger authored Nov 1, 2023
2 parents 98c4757 + c7a6b6e commit a264176
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cryptography==41.0.5
npg_id_generation@https://github.com/wtsi-npg/npg_id_generation/releases/download/4.0.1/npg_id_generation-4.0.1.tar.gz
partisan@https://github.com/wtsi-npg/partisan/releases/download/2.9.0/partisan-2.9.0.tar.gz
partisan@https://github.com/wtsi-npg/partisan/releases/download/2.9.4/partisan-2.9.4.tar.gz
pymysql==1.1.0
python-dateutil==2.8.2
rich==13.6.0
Expand Down
11 changes: 4 additions & 7 deletions src/npg_irods/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ def update_metadata(item: Collection | DataObject, avus: list[AVU]) -> bool:
log.info(
"Updated metadata",
path=item,
meta=avus,
num_added=num_added,
num_removed=num_removed,
)
Expand Down Expand Up @@ -275,23 +274,21 @@ def update_permissions(
user = rods_user()
user_acl = [ac for ac in item.permissions() if ac.user == user.name]

keep = sorted(set(admin_acl + not_managed_acl + user_acl))
preserve = sorted(set(admin_acl + not_managed_acl + user_acl))
log.debug(
"Found permissions to keep",
"Found permissions to preserve",
path=item,
user=user_acl,
admin=admin_acl,
not_managed=not_managed_acl,
)

log.info("Updating permissions", path=item, keep=keep, acl=acl)
log.info("Updating permissions", path=item, preserve=preserve, acl=acl)
kwargs = {"recurse": recurse} if recurse else {}
num_removed, num_added = item.supersede_permissions(*keep, *acl, **kwargs)
num_removed, num_added = item.supersede_permissions(*preserve, *acl, **kwargs)
log.info(
"Updated permissions",
path=item,
keep=keep,
acl=acl,
num_added=num_added,
num_removed=num_removed,
)
Expand Down

0 comments on commit a264176

Please sign in to comment.