Skip to content

Commit 01ac137

Browse files
fix: Use also VO as parameter (in case DIRAC has a bad VO)
1 parent 3e358bb commit 01ac137

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

diracx-client/src/diracx/client/patches/pilots/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class AddPilotStampsBody(TypedDict, total=False):
9898
grid_site: str
9999
pilot_references: dict[str, str]
100100
pilot_status: PilotStatus
101+
vo: str
101102

102103
class AddPilotStampsKwargs(AddPilotStampsBody, ResponseExtra): ...
103104

@@ -111,7 +112,7 @@ def make_add_pilot_stamps_body(**kwargs: Unpack[AddPilotStampsKwargs]) -> Underl
111112
for key in AddPilotStampsBody.__optional_keys__:
112113
if key not in kwargs:
113114
continue
114-
key = cast(Literal["pilot_stamps", "grid_type", "grid_site", "pilot_references", "pilot_status"], key)
115+
key = cast(Literal["pilot_stamps", "grid_type", "grid_site", "pilot_references", "pilot_status", "vo"], key)
115116
value = kwargs.pop(key)
116117
if value is not None:
117118
body[key] = value

diracx-routers/src/diracx/routers/pilots/management.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ async def add_pilot_stamps(
5555
pilot_status: Annotated[
5656
PilotStatus, Body(description="Status of the pilots.")
5757
] = PilotStatus.SUBMITTED,
58+
vo: str | None = None,
5859
):
5960
"""Endpoint where a you can create pilots with their references.
6061
@@ -79,7 +80,7 @@ async def add_pilot_stamps(
7980
await register_new_pilots(
8081
pilot_db=pilot_db,
8182
pilot_stamps=pilot_stamps,
82-
vo=user_info.vo,
83+
vo=vo if vo else user_info.vo,
8384
grid_type=grid_type,
8485
grid_site=grid_site,
8586
destination_site=destination_site,

0 commit comments

Comments
 (0)