Skip to content

Commit 363b205

Browse files
committed
http: align v1_scheme with ruleset
Change-Id: I300faf702061ca82dc9beb6c630e4bd4f6d37fb9
1 parent 8db181c commit 363b205

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

cmk/update_config/http/v1_scheme.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from typing import Literal
77

8-
from pydantic import BaseModel
8+
from pydantic import BaseModel, Field
99

1010

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

2828

2929
class V1Auth(BaseModel, extra="forbid"):

tests/unit/cmk/update_config/http/test_migrate.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,12 @@
742742
),
743743
}
744744

745+
EXAMPLE_92: Mapping[str, object] = {
746+
"name": "authorization",
747+
"host": {"address": ("direct", "[::1]"), "virthost": ""},
748+
"mode": ("url", {}),
749+
}
750+
745751

746752
@pytest.mark.parametrize(
747753
"rule_value",
@@ -1186,6 +1192,13 @@ def test_migrate_ssl(rule_value: Mapping[str, object], expected: str) -> None:
11861192
mode_fields=["onredirect", "expect_response"],
11871193
),
11881194
),
1195+
(
1196+
EXAMPLE_92,
1197+
Conflict(
1198+
type_="invalid_value",
1199+
cant_load=True,
1200+
),
1201+
),
11891202
],
11901203
)
11911204
def test_detect_conflicts(rule_value: Mapping[str, object], conflict: Conflict) -> None:

0 commit comments

Comments
 (0)