BUG/MINOR: ext-check: cannot use without preserve-env
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 7 Dec 2023 08:58:27 +0000 (09:58 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 8 Dec 2023 13:26:06 +0000 (14:26 +0100)
commit63282f3bfbaee50a0716823bdc8c4251a47e6e39
tree5cf73b19f6d6a2c01ac6d330bd0eb8212e717b6a
parentd7964c52ceb18a690d33d35b0c802660241d9ba9
BUG/MINOR: ext-check: cannot use without preserve-env

Since 1de44da ("MINOR: ext-check: add an option to preserve environment
variables"), it is now possible to provide an extra argument to
"external-check" directive. This allows to support the "preserve-env"
option which differs from the default behavior.

However a mistake was made, because the config parser doesn't allow the
default configuration anymore: using external-check without argument will
trigger an error:
  'external-check' only supports 'preserve-env' as an argument, found ''.

This is due to as small mistake in the code that make the check
systematically report an error if the first argument is not equal to
"preserve-env". The check was modified so that the error is only reported
if the argument is provided, so that the default behavior is restored.

This should fix GH #2380 and should be backported on 2.9 and potentially
further (anywhere 1de44da is, because a note about an optional backport
up to the 2.6 was left in the original commit message)
src/cfgparse-global.c