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
4 changes: 2 additions & 2 deletions src/DIRAC/ProductionSystem/scripts/dirac_prod_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def main():
prodID = args[0]
res = prodClient.getProduction(prodID)

fields = ["ProductionName", "Status", "ProductionID", "CreationDate", "LastUpdate", "AuthorDN", "AuthorGroup"]
fields = ["ProductionName", "Status", "ProductionID", "CreationDate", "LastUpdate", "Author", "AuthorGroup"]
records = []

if res["OK"]:
Expand All @@ -39,7 +39,7 @@ def main():
str(prod["ProductionID"]),
str(prod["CreationDate"]),
str(prod["LastUpdate"]),
str(prod["AuthorDN"]),
str(prod["Author"]),
str(prod["AuthorGroup"]),
]
)
Expand Down
4 changes: 2 additions & 2 deletions src/DIRAC/ProductionSystem/scripts/dirac_prod_get_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def main():
prodClient = ProductionClient()
res = prodClient.getProductions()

fields = ["ProductionName", "Status", "ProductionID", "CreationDate", "LastUpdate", "AuthorDN", "AuthorGroup"]
fields = ["ProductionName", "Status", "ProductionID", "CreationDate", "LastUpdate", "Author", "AuthorGroup"]
records = []

if res["OK"]:
Expand All @@ -31,7 +31,7 @@ def main():
str(prod["ProductionID"]),
str(prod["CreationDate"]),
str(prod["LastUpdate"]),
str(prod["AuthorDN"]),
str(prod["Author"]),
str(prod["AuthorGroup"]),
]
)
Expand Down
25 changes: 2 additions & 23 deletions src/DIRAC/WorkloadManagementSystem/DB/SandboxMetadataDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def deleteSandboxes(self, SBIdList):
return result
return S_OK()

def getSandboxId(self, SEName, SEPFN, requesterName, requesterGroup, field="SBId", requesterDN=None):
def getSandboxId(self, SEName, SEPFN, requesterName, requesterGroup, field="SBId"):
"""
Get the sandboxId if it exists

Expand All @@ -350,7 +350,7 @@ def getSandboxId(self, SEName, SEPFN, requesterName, requesterGroup, field="SBId
"s.OwnerId=o.OwnerId",
]
sqlCmd = f"SELECT s.{field} FROM `sb_SandBoxes` s, `sb_Owners` o WHERE"
requesterProps = Registry.getPropertiesForEntity(requesterGroup, name=requesterName, dn=requesterDN)
requesterProps = Registry.getPropertiesForEntity(requesterGroup, name=requesterName)
if Properties.JOB_ADMINISTRATOR in requesterProps or Properties.JOB_MONITOR in requesterProps:
# Do nothing, just ensure it doesn't fit in the other cases
pass
Expand All @@ -370,24 +370,3 @@ def getSandboxId(self, SEName, SEPFN, requesterName, requesterGroup, field="SBId
if not data:
return S_ERROR("No sandbox matches the requirements")
return S_OK(data[0][0])

def getSandboxOwner(self, SEName, SEPFN, requesterDN, requesterGroup):
"""get the sandbox owner, if such sandbox exists

:param SEName: name of the StorageElement
:param SEPFN: PFN of the Sandbox
:param requesterDN: host DN used as credentials
:param requesterGroup: group used to use as credentials (should be 'hosts')

:returns: S_OK with tuple (owner, ownerGroup, VO)
"""
if not (res := self.getSandboxId(SEName, SEPFN, None, requesterGroup, "OwnerId", requesterDN=requesterDN))[
"OK"
]:
return res

if not (
res := self._query(f"SELECT `Owner`, `OwnerGroup`, `VO` FROM `sb_Owners` WHERE `OwnerId` = {res['Value']}")
)["OK"]:
return res
return S_OK(res["Value"][0])
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _stringInList(subStr, sList):

@Script()
def main():
parameters = ["OwnerDN", "StartExecTime", "EndExecTime"]
parameters = ["Owner", "StartExecTime", "EndExecTime"]
Script.registerSwitch("", "Parameters=", " List of strings to be matched by job parameters or attributes")
# Registering arguments will automatically add their description to the help menu
Script.registerArgument(["PilotID: Grid ID of the pilot"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def test_SandboxMetadataDB():
smDB = SandboxMetadataDB()

owner = "adminusername"
ownerDN = "/C=ch/O=DIRAC/OU=DIRAC CI/CN=ciuser"
ownerGroup = "dirac_admin"
VO = "vo"

Expand All @@ -33,10 +32,6 @@ def test_SandboxMetadataDB():
assert res["OK"], res["Message"]
assert res["Value"] == 1

res = smDB.getSandboxOwner(sbSE, sbPFN, ownerDN, ownerGroup)
assert res["OK"], res["Message"]
assert res["Value"] == (owner, ownerGroup, VO)

res = smDB.getSandboxId(sbSE, sbPFN, owner, ownerGroup)
assert res["OK"], res["Message"]
assert res["Value"] == sbId
Expand Down
Loading