We're automatically deploying readiness checks on our servers. The checks are defined in Hiera and deployed with Puppet. One of these checks involves a curl
command that should return the HTTP status code:
curl -sSLI -o /dev/null -w '%{http_code}' "https://$(hostname -f)/"
However, Hiera interpolates %{...}
expressions, so the statement is rendered as
curl -sSLI -o /dev/null -w '' "https://$(hostname -f)/"
and the check fails.
Escaping the percent character or a curly bracket with a backslash doesn't seem to work, neither does doubling the percent character:
-w '\%{http_code}'
turns into -w '\'
-w '%\{http_code}'
turns into -w '%\{http_code}'
-w '%%{http_code}'
turns into -w '%'
How do I prevent Hiera from trying to interpolate the string %{http_code}
?