Literal works when there is only one literal percent sign; last I checked,
you cannot use it twice in the same value. You can use "%%{::}{::hostname}"
to return "%{::hostname}" - the middle "%{::}" returns nothing and splits
the first percent from the variable name at the end, preventing
interpolation there.

The use of the two semi colons was to avoid a scoping issue that cropped up
as a regression around the puppet 4.3 timeframe that "%%{}{::hostname}"
would run into. It is possible this has been fixed by now and the
naked semi colons in the braces are optional, but I have not tested this
with the latest version of puppet myself.

On Monday, June 6, 2016, Christopher Wood <christopher_w...@pobox.com>
wrote:

> I ran into this too, use the literal function.
>
> $ grep -rh literal hieradata/
> testing::cwood1::param3: "%{literal('%')}{::hostname}"
> testing::cwood1::param3: "%{literal('%')}{::hostname}"
>
>
> https://docs.puppet.com/hiera/3.1/variables.html#the-literal-lookup-function
>
> On Mon, Jun 06, 2016 at 06:20:46AM -0700, Simon wrote:
> >    Hi all
> >    does anyone know how i can escape %{ in hiera without it trying to
> convert
> >    to variable?
> >    i want to add the following to configure a syslog filter for logstash
> >
> >    match => { "message" =>
> >    "<%{POSINT:syslog_pri}>%{SYSLOGTIMESTAMP:syslog_timestamp}
> >    %{SYSLOGHOST:syslog_hostname}
> >    %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?:
> >    %{GREEDYDATA:syslog_message}"}
> >
> >    problem is it will try and convert to variables so only shows the
> >    following on the server
> >
> >    match => { "message" => "<>  (?:\[\])?: "}
> >
> >    i have tried all the methods i can think of,  any help would be
> >    appreciated.
> >
> >    cheers
> >
> >    S
> >
> >    --
> >    You received this message because you are subscribed to the Google
> Groups
> >    "Puppet Users" group.
> >    To unsubscribe from this group and stop receiving emails from it,
> send an
> >    email to [1]puppet-users+unsubscr...@googlegroups.com <javascript:;>.
> >    To view this discussion on the web visit
> >    [2]
> https://groups.google.com/d/msgid/puppet-users/c1d3661a-ee9c-4460-bb13-be23b210ddb7%40googlegroups.com
> .
> >    For more options, visit [3]https://groups.google.com/d/optout.
> >
> > References
> >
> >    Visible links
> >    1. mailto:puppet-users+unsubscr...@googlegroups.com <javascript:;>
> >    2.
> https://groups.google.com/d/msgid/puppet-users/c1d3661a-ee9c-4460-bb13-be23b210ddb7%40googlegroups.com?utm_medium=email&utm_source=footer
> >    3. https://groups.google.com/d/optout
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com <javascript:;>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/20160606134212.GA8045%40iniquitous.heresiarch.ca
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Rob Nelson
rnels...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAC76iT8Dr3535kH77c0S-11XB%2Bb%3DgY64XbXCgaeGo3y-XMiATg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to