Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Cluster credentials passed as ***** #2937

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
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from asyncio.log import logger
from typing import List

from fastapi import APIRouter, Depends, HTTPException
Expand Down Expand Up @@ -148,13 +149,15 @@ async def get_default_cluster_details(
clusters_repo: ClustersRepository = Depends(get_repository(ClustersRepository)),
dask_clients_pool: DaskClientsPool = Depends(get_dask_clients_pool),
):
return await _get_cluster_details_with_id(
default_cluster = await _get_cluster_details_with_id(
settings=settings,
user_id=user_id,
cluster_id=DEFAULT_CLUSTER_ID,
clusters_repo=clusters_repo,
dask_clients_pool=dask_clients_pool,
)
logger.debug("found followind %s", f"{default_cluster=!r}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

followind is like la bise in Lac Leman ?? :-D

return default_cluster


@router.get(
Expand All @@ -170,13 +173,15 @@ async def get_cluster_details(
clusters_repo: ClustersRepository = Depends(get_repository(ClustersRepository)),
dask_clients_pool: DaskClientsPool = Depends(get_dask_clients_pool),
):
return await _get_cluster_details_with_id(
cluster_details = await _get_cluster_details_with_id(
settings=settings,
user_id=user_id,
cluster_id=cluster_id,
clusters_repo=clusters_repo,
dask_clients_pool=dask_clients_pool,
)
logger.debug("found followind %s", f"{cluster_details=!r}")
return cluster_details


@router.post(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import json
import logging
from typing import Any, Dict, List, Optional, Tuple, Type, Union
from uuid import UUID
Expand All @@ -12,6 +13,7 @@
from pydantic.types import PositiveInt
from servicelib.logging_utils import log_decorator
from servicelib.utils import logged_gather
from settings_library.utils_cli import create_json_encoder_wo_secrets
from tenacity._asyncio import AsyncRetrying
from tenacity.before_sleep import before_sleep_log
from tenacity.stop import stop_after_attempt
Expand Down Expand Up @@ -454,8 +456,7 @@ async def restart(app: web.Application, node_uuid: str) -> None:
async def projects_networks_update(app: web.Application, project_id: ProjectID) -> None:
settings: DirectorV2Settings = get_plugin_settings(app)
backend_url = (
URL(settings.base_url)
/ f"dynamic_services/projects/{project_id}/-/networks"
URL(settings.base_url) / f"dynamic_services/projects/{project_id}/-/networks"
)
await _request_director_v2(
app, "PATCH", backend_url, expected_status=web.HTTPNoContent
Expand All @@ -472,7 +473,13 @@ async def create_cluster(
"POST",
url=(settings.base_url / "clusters").update_query(user_id=int(user_id)),
expected_status=web.HTTPCreated,
data=new_cluster.dict(by_alias=True, exclude_unset=True),
data=json.loads(
new_cluster.json(
by_alias=True,
exclude_unset=True,
encoder=create_json_encoder_wo_secrets(ClusterCreate),
)
),
)

assert isinstance(cluster, dict) # nosec
Expand Down Expand Up @@ -561,7 +568,13 @@ async def update_cluster(
user_id=int(user_id)
),
expected_status=web.HTTPOk,
data=cluster_patch.dict(by_alias=True, exclude_unset=True),
data=json.loads(
cluster_patch.json(
by_alias=True,
exclude_unset=True,
encoder=create_json_encoder_wo_secrets(ClusterPatch),
)
),
on_error={
web.HTTPNotFound.status_code: (
ClusterNotFoundError,
Expand Down Expand Up @@ -609,7 +622,13 @@ async def ping_cluster(app: web.Application, cluster_ping: ClusterPing) -> None:
"POST",
url=settings.base_url / "clusters:ping",
expected_status=web.HTTPNoContent,
data=cluster_ping.dict(by_alias=True, exclude_unset=True),
data=json.loads(
cluster_ping.json(
by_alias=True,
exclude_unset=True,
encoder=create_json_encoder_wo_secrets(ClusterPing),
)
),
on_error={
web.HTTPUnprocessableEntity.status_code: (
ClusterPingError,
Expand Down