ahilashsasidharan commented on code in PR #63994:
URL: https://github.com/apache/airflow/pull/63994#discussion_r3040538801
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/variables.py:
##########
@@ -147,21 +148,33 @@ def patch_variable(
update_mask: list[str] | None = Query(None),
) -> VariableResponse:
"""Update a variable by key."""
+ if patch_body.team_name is not None and not conf.getboolean("core",
"multi_team"):
+ raise HTTPException(
+ status.HTTP_400_BAD_REQUEST,
+ "team_name cannot be set when multi_team mode is disabled. Please
contact your administrator.",
+ )
+
variable = update_orm_from_pydantic(variable_key, patch_body, update_mask,
session)
return variable
@variables_router.post(
"",
status_code=status.HTTP_201_CREATED,
- responses=create_openapi_http_exception_doc([status.HTTP_409_CONFLICT]),
+ responses=create_openapi_http_exception_doc([status.HTTP_400_BAD_REQUEST,
status.HTTP_409_CONFLICT]),
dependencies=[Depends(action_logging()),
Depends(requires_access_variable("POST"))],
)
def post_variable(
post_body: VariableBody,
session: SessionDep,
) -> VariableResponse:
"""Create a variable."""
+ if post_body.team_name is not None and not conf.getboolean("core",
"multi_team"):
+ raise HTTPException(
+ status.HTTP_400_BAD_REQUEST,
+ "team_name cannot be set when multi_team mode is disabled. Please
contact your administrator.",
+ )
Review Comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]