From 719377c672d8c159a06c93781a47c2c2e6e0ed6c Mon Sep 17 00:00:00 2001 From: Lazlo Westerhof Date: Thu, 12 Oct 2023 15:00:08 +0200 Subject: [PATCH] YDA-5311: catch microservice errors when trying to set ACLs for replication or revision --- replication.py | 10 +++++----- revisions.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/replication.py b/replication.py index 513963a11..fce9f032c 100644 --- a/replication.py +++ b/replication.py @@ -27,15 +27,15 @@ def replicate_asynchronously(ctx, path, source_resource, target_resource): """ zone = user.zone(ctx) - # Give rods 'own' access so that they can remove the AVU. - msi.set_acl(ctx, "default", "own", "rods#{}".format(zone), path) - # Mark data object for batch replication by setting 'org_replication_scheduled' metadata. try: - # Add random id for replication balancing purposes + # Give rods 'own' access so that they can remove the AVU. + msi.set_acl(ctx, "default", "own", "rods#{}".format(zone), path) + + # Add random identifier for replication balancing purposes. msi.add_avu(ctx, '-d', path, constants.UUORGMETADATAPREFIX + "replication_scheduled", "{},{},{}".format(source_resource, target_resource, random.randint(1, 64)), "") except msi.Error as e: - # iRods error for CAT_UNKNOWN_FILE can be ignored + # iRODS error for CAT_UNKNOWN_FILE can be ignored. if str(e).find("-817000") == -1: error_status = re.search("status \[(.*?)\]", str(e)) log.write(ctx, "Schedule replication of data object {} failed with error {}".format(path, error_status.group(1))) diff --git a/revisions.py b/revisions.py index 19ab37148..30b9676fc 100644 --- a/revisions.py +++ b/revisions.py @@ -257,15 +257,15 @@ def resource_modified_post_revision(ctx, resource, zone, path): # Only create revisions for research space if path.startswith("/{}/home/{}".format(zone, constants.IIGROUPPREFIX)): if not pathutil.basename(path) in constants.UUBLOCKLIST: - # Give rods 'own' access so that they can remove the AVU. - msi.set_acl(ctx, "default", "own", "rods#{}".format(zone), path) - # Mark data object for batch revision by setting 'org_revision_scheduled' metadata. try: - # Add random id for revision balancing purposes + # Give rods 'own' access so that they can remove the AVU. + msi.set_acl(ctx, "default", "own", "rods#{}".format(zone), path) + + # Add random identifier for revision balancing purposes. msi.add_avu(ctx, '-d', path, constants.UUORGMETADATAPREFIX + "revision_scheduled", resource + ',' + str(random.randint(1, 64)), "") except msi.Error as e: - # iRods error for CAT_UNKNOWN_FILE can be ignored + # iRODS error for CAT_UNKNOWN_FILE can be ignored. if str(e).find("-817000") == -1: error_status = re.search("status \[(.*?)\]", str(e)) log.write(ctx, "Schedule revision of data object {} failed with error {}".format(path, error_status.group(1)))