Skip to content

Commit

Permalink
Better error handling if set_ids fails
Browse files Browse the repository at this point in the history
  • Loading branch information
nmassey001 committed Feb 5, 2025
1 parent af453f7 commit 130e7d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion nlds_processors/transfer/base_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ def _callback_common(self, cm, method, properties, body, connection):

# Set uid and gid from message contents
self.log("Setting uid and gids now.", RK.LOG_INFO)
self.set_ids(self.body_json)
try:
self.set_ids(self.body_json)
except KeyError as e:
self.log("Problem running set_ids, exiting callback", RK.LOG_ERROR)
return

# Append route info to message to track the route of the message
self.body_json = self.append_route_info(self.body_json)
Expand Down
8 changes: 5 additions & 3 deletions nlds_processors/transfer/get_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,12 @@ def _transfer_files(
# build the routing keys
rk_complete = ".".join([rk_origin, RK.TRANSFER_GET, RK.COMPLETE])
rk_failed = ".".join([rk_origin, RK.TRANSFER_GET, RK.FAILED])
# set the ids for the
# set the ids for the files
if self.chown_fl:
self.set_ids(body_json)

try:
self.set_ids(body_json)
except KeyError as e:
self.log("Problem running set_ids in _transfer_files", RK.LOG_ERROR)
# Create client
self.client = minio.Minio(
tenancy,
Expand Down

0 comments on commit 130e7d3

Please sign in to comment.