Skip to content

Commit

Permalink
Modify permissions on staged subdirectories to allow deletion.
Browse files Browse the repository at this point in the history
Specifically, the subdirectories need to give write and execute
permissions to the service account running the gobbler backend, so that
it can properly purge old files from the staging directory. It's too
much hassle to try to give permissions specifically to the service
account so we just give write permissions to all users.
  • Loading branch information
LTLA committed Aug 29, 2024
1 parent aeebe4a commit 33cd6de
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions R/uploadDirectory.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
uploadDirectory <- function(project, asset, version, directory, staging, url, probation=FALSE) {
directory <- normalizePath(directory)
staging <- normalizePath(staging)

if (dirname(directory) != staging) {
new.dir <- allocateUploadDirectory(staging)
for (p in list.files(directory, recursive=TRUE)) {
Expand Down Expand Up @@ -76,5 +77,12 @@ uploadDirectory <- function(project, asset, version, directory, staging, url, pr
)

dump_request(staging, url, "upload", req)

# Once the upload is done, we make the directory world-writeable so the
# backend can more easily purge old files. We could also delete them right
# away but sometimes it's helpful for debugging to leave them there.
subdirs <- list.dirs(directory, full.names=TRUE, recursive=TRUE)
Sys.chmod(subdirs, mode="0777", use_umask=FALSE)

invisible(NULL)
}

0 comments on commit 33cd6de

Please sign in to comment.