Skip to content

Commit

Permalink
fix: extract DN in case of running with certificates
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed Jun 22, 2023
1 parent ba3ae78 commit 56085f0
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Pilot/pilotCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,16 +541,28 @@ def execute(self):
self.__setFlavour()

if self.pp.useServerCertificate:
self.cfg.append("-o /DIRAC/Security/UseServerCertificate=yes")
self.cfg.append("-o /DIRAC/Security/UseServerCertificate=yes")
extractDNCommand = "openssl x509 -in %s/hostcert.pem " % self.pp.certsLocation
extractDNCommand += "-noout -subject -nameopt compat | sed 's/subject=//'"
retCode, res = self.executeAndGetOutput(extractDNCommand, self.pp.installEnv)
pilotOwnerDN = res.strip().split("\n")[-1]
if retCode:
self.log.error("Could not get execute %s [ERROR %d]" % (extractDNCommand, retCode))

pilotOwnerGroup = "certificate_group"
else:
pilotOwnerDN = self.pp.userDN
pilotOwnerGroup = self.pp.userGroup

if self.pp.localConfigFile:
if LooseVersion(self.releaseVersion) >= self.cfgOptionDIRACVersion:
self.cfg.append("--cfg")
self.cfg.append(self.pp.localConfigFile) # this file is as input

checkCmd = "dirac-admin-add-pilot %s %s %s %s %s --status=Running %s -d" % (
self.pp.pilotReference,
self.pp.userDN,
self.pp.userGroup,
pilotOwnerDN,
pilotOwnerGroup,
self.pp.flavour,
self.pilotStamp,
" ".join(self.cfg),
Expand Down

0 comments on commit 56085f0

Please sign in to comment.