
###############################################################################
#
# HTCondor-CE collector requirements configuration file.
#
# This file will not be overwritten on RPM upgrade.  This should contain
# a reasonable expression for OSG production.
#
###############################################################################

# The COLLECTOR_REQUIREMENTS expressions require that CE ads (ad type is
# Scheduler), xrootd startd ads (ad type is Machine) and xrootd master ads
# (ad type is DaemonMaster) have:
# - AuthenticatedIdentity attr that end in @daemon.opensciencegrid.org
# - Name attrs that match the AuthenticatedIdentity attr

# COLLECTOR_REQUIREMENTS subexpression for CE ad
# For a CE ad, the grid_resource must also match Name and AuthenticatedIdentity
# e.g. for this:
# - AuthenticatedIdentity == "ce.example.net@daemon.opensciencegrid.org"
# you need this:
# - grid_resource == "condor ce.example.net ce.example.net:XXXX" (port doesn't
#   matter for collector address part, and may be absent)
COLLECTOR_REQUIREMENTS = \
  (  (TARGET.MyType == "Scheduler") \
  && (strcat(TARGET.Name, "@daemon.opensciencegrid.org") == string(TARGET.AuthenticatedIdentity))  \
  && (isString(TARGET.grid_resource))  \
  && (stringListSize(TARGET.grid_resource, ": ") >= 3)  \
  && (split(TARGET.grid_resource, ": ")[1] == splitUserName(TARGET.AuthenticatedIdentity)[0]) \
  && (split(TARGET.grid_resource, ": ")[2] == splitUserName(TARGET.AuthenticatedIdentity)[0]) \
  )

# COLLECTOR_REQUIREMENTS subexpression for xrootd startd ad
COLLECTOR_REQUIREMENTS = $(COLLECTOR_REQUIREMENTS) || \
 (  (TARGET.MyType == "Machine") \
 && (strcat(TARGET.Name, "@daemon.opensciencegrid.org") == strcat("xrootd@", TARGET.AuthenticatedIdentity)) \
 )

# COLLECTOR_REQUIREMENTS subexpression for xrootd master ad
COLLECTOR_REQUIREMENTS = $(COLLECTOR_REQUIREMENTS) || \
 (  (TARGET.MyType == "DaemonMaster") \
 && (strcat(TARGET.Name, "@daemon.opensciencegrid.org") == string(TARGET.AuthenticatedIdentity)) \
 )

# Accept other ads
COLLECTOR_REQUIREMENTS = $(COLLECTOR_REQUIREMENTS) || \
 ((TARGET.MyType != "Scheduler") && (TARGET.MyType != "Machine") && (TARGET.MyType != "DaemonMaster"))

