Skip to content

Commit

Permalink
http: align v1_scheme with ruleset
Browse files Browse the repository at this point in the history
Change-Id: I300faf702061ca82dc9beb6c630e4bd4f6d37fb9
  • Loading branch information
SoloJacobs committed Feb 11, 2025
1 parent 8db181c commit 363b205
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmk/update_config/http/v1_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from typing import Literal

from pydantic import BaseModel
from pydantic import BaseModel, Field


class V1Proxy(BaseModel, extra="forbid"):
Expand All @@ -23,7 +23,7 @@ class V1Host(BaseModel, extra="forbid"):
# true, if client_cert is true, client private key or -S is enabled. On redirect new ports might
# be defined. This behaviour will not transfer to the new check, most likely.
port: int | None = None
virthost: str | None = None
virthost: str | None = Field(default=None, min_length=1)


class V1Auth(BaseModel, extra="forbid"):
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/cmk/update_config/http/test_migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,12 @@
),
}

EXAMPLE_92: Mapping[str, object] = {
"name": "authorization",
"host": {"address": ("direct", "[::1]"), "virthost": ""},
"mode": ("url", {}),
}


@pytest.mark.parametrize(
"rule_value",
Expand Down Expand Up @@ -1186,6 +1192,13 @@ def test_migrate_ssl(rule_value: Mapping[str, object], expected: str) -> None:
mode_fields=["onredirect", "expect_response"],
),
),
(
EXAMPLE_92,
Conflict(
type_="invalid_value",
cant_load=True,
),
),
],
)
def test_detect_conflicts(rule_value: Mapping[str, object], conflict: Conflict) -> None:
Expand Down

0 comments on commit 363b205

Please sign in to comment.