Skip to content

Commit

Permalink
fix race condition where setfacl command fails bc directory does not …
Browse files Browse the repository at this point in the history
…exist (#1477)
  • Loading branch information
rstijerina authored Oct 16, 2024
1 parent 041ba9b commit cf5bb9f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions designsafe/apps/auth/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def check_or_configure_system_and_user_directory(
logger.info(
f"Directory for user={username} on system={system_id}/{path} exists and works. "
)
except (NotFoundError, ForbiddenError, UnauthorizedError) as e:
except (NotFoundError, ForbiddenError, UnauthorizedError):
logger.info(
"Ensuring directory exists for user=%s then going to run setfacl on system=%s path=%s",
username,
Expand All @@ -80,9 +80,11 @@ def check_or_configure_system_and_user_directory(
)

tg458981_client = get_tg458981_client()
if isinstance(e, NotFoundError):
tg458981_client.files.mkdir(systemId=system_id, path=path)

# Create directory, resolves NotFoundError
tg458981_client.files.mkdir(systemId=system_id, path=path)

# Set ACLs, resolves UnauthorizedError and ForbiddenError
tg458981_client.files.setFacl(
systemId=system_id,
path=path,
Expand Down

0 comments on commit cf5bb9f

Please sign in to comment.