Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions configs/xcache/config.d/40-xcache-auth.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,25 @@ if named stash-cache
else
setenv X509_USER_PROXY = /run/xcache-auth/x509_proxy
fi


if defined ?GridMapfile
# pass
else if named stash-cache-auth
set GridMapfile = /run/stash-cache-auth/grid-mapfile
else if named stash-origin-auth
set GridMapfile = /run/stash-origin-auth/grid-mapfile
else
set GridMapfile = /etc/grid-security/grid-mapfile
fi

if defined ?GmapOpt
# pass
else if named stash-cache-auth
set GmapOpt = usemap
else if named stash-origin-auth
set GmapOpt = usemap
else
set GmapOpt = trymap
fi

19 changes: 15 additions & 4 deletions src/authfile-update
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,20 @@ class Download:

self.full_destdir = f"{self.destdir}/{self.instance}"
self.dest_file = f"{self.full_destdir}/{self.config_file}"
self.local_files = [
self.local_files = []
if config_file == "grid-mapfile":
# Local additions to the grid-mapfile are prepended, not appended
# to what's downloaded from topology because we want them to "win"
self.prepend_local = True

# Backward compat: also read /etc/grid-security/grid-mapfile
self.local_files.append("/etc/grid-security/grid-mapfile")
else:
self.prepend_local = False
self.local_files += [
f"{self.destdir}/{self.instance}/{self.config_file}.local",
f"/etc/xrootd/{self.instance}-{self.config_file}.local",
]
self.prepend_local = config_file == "grid-mapfile"
# ^^ local additions to the grid-mapfile are prepended, not appended
# to what's downloaded from topology

def fetch(self) -> Tuple[Optional[str], bool]:
"""Download the data for this config file from Topology and return
Expand Down Expand Up @@ -137,6 +144,10 @@ class Download:
new_text = ""
for local_file in self.local_files:
try:
if os.path.samefile(os.path.realpath(local_file), os.path.realpath(self.dest_file)):
# The local file is a symlink to the destination file or something similar.
# Skip it to avoid a loop.
continue
with open(local_file, "rt", encoding="utf-8", errors="replace") as fh:
new_text += (
f"## The following lines are from {local_file}:\n"
Expand Down