Skip to content

Commit

Permalink
fix load wrong cert
Browse files Browse the repository at this point in the history
  • Loading branch information
Thanayut Seethongchuen committed Nov 16, 2023
1 parent 9cb5d51 commit ea79505
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/python/RucioUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ def getNativeRucioClient(config=None, logger=None):
cl = logging.getLogger('charset_normalizer')
cl.setLevel(logging.ERROR)

# Need to use config from `config.TaskWorker` object instead to switch to
# user cert in PreDag.py
rucio_cert = getattr(config.TaskWorker, "Rucio_cert", config.TaskWorker.cmscert)
rucio_key = getattr(config.TaskWorker, "Rucio_key", config.TaskWorker.cmskey)
rucio_cert = getattr(config.Services, "Rucio_cert", config.TaskWorker.cmscert)
rucio_key = getattr(config.Services, "Rucio_key", config.TaskWorker.cmskey)
logger.debug("Using cert [%s]\n and key [%s] for rucio client.", rucio_cert, rucio_key)
nativeClient = Client(
rucio_host=config.Services.Rucio_host,
Expand Down
7 changes: 3 additions & 4 deletions src/python/TaskWorker/Actions/PreDAG.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,14 @@ def executeInternal(self, *args):
config.TaskWorker.cmskey = os.environ.get('X509_USER_PROXY')
config.TaskWorker.envForCMSWEB = newX509env(X509_USER_CERT=config.TaskWorker.cmscert,
X509_USER_KEY=config.TaskWorker.cmskey)
# also for talking with rucio
config.TaskWorker.Rucio_cert = os.environ.get('X509_USER_PROXY')
config.TaskWorker.Rucio_key = os.environ.get('X509_USER_PROXY')


# need to get username from classAd to setup for Rucio access
# and use user cert to talking with rucio
task_ad = classad.parseOne(open(os.environ['_CONDOR_JOB_AD']))
username = task_ad['CRAB_UserHN']
config.Services.Rucio_account = username
config.Services.Rucio_cert = os.environ.get('X509_USER_PROXY')
config.Services.Rucio_key = os.environ.get('X509_USER_PROXY')

# need the global black list
config.TaskWorker.scratchDir = './scratchdir'
Expand Down

0 comments on commit ea79505

Please sign in to comment.