Skip to content

Commit

Permalink
check plugins: fix http command line
Browse files Browse the repository at this point in the history
Add macro expansion for virthost.
Add unit test for expansion

TESTS: local with .f12

CMK-20979

Change-Id: I7be00b713959613dae1af44b9da009ce08a85a03
  • Loading branch information
s-kipnis committed Feb 7, 2025
1 parent edb9bad commit 75cd8a6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmk/plugins/collection/server_side_calls/httpv1.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def _common_args(

args += ["-I", replace_macros(host.server_address, host_config.macros)]
if (virtual_host := host.virtual_host(mode)) is not None:
args += ["-H", virtual_host]
args += ["-H", replace_macros(virtual_host, host_config.macros)]

return args

Expand Down
25 changes: 25 additions & 0 deletions tests/unit/cmk/plugins/collection/server_side_calls/test_httpv1.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,31 @@
"virtual.host",
],
),
(
{
"name": "irrelevant",
"mode": ("url", {}),
"host": {
"virthost": "$to.expand.virthost$",
"address": ("direct", "$to.expand.address$"),
},
},
HostConfig(
name="hostname",
ipv4_config=IPv4Config(address="1.2.3.4"),
macros={
"$to.expand.virthost$": "expanded.virthost",
"$to.expand.address$": "expanded.address",
},
),
[
"--sni",
"-I",
"expanded.address",
"-H",
"expanded.virthost",
],
),
(
{
"name": "irrelevant",
Expand Down

0 comments on commit 75cd8a6

Please sign in to comment.