quoting special characters in puppet.conf

1,392 views
Skip to first unread message

Amos Shapira

unread,
Aug 25, 2010, 2:52:31 AM8/25/10
to Puppet Users
Hello,

I'd like to pass the following flags to diff through puppet:

-urbB -I $Id -I $HeadURL -I $URL

But when I try to set diff_args in /etc/puppet/puppet.conf like this:

diff_args = -ubB -I \$Id -I \$HeadURL -I \$URL

Puppet tries to interpolate the $Id and fails.

How can I quote the '$' sign so puppet will pass it as-is to diff?

I'm using puppet 0.25.4 on CentOS 5.5 x64_86.

Thanks.

Patrick

unread,
Aug 25, 2010, 4:28:39 AM8/25/10
to puppet...@googlegroups.com

> --
> You received this message because you are subscribed to the Google Groups "Puppet Users" group.
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
>

Amos Shapira

unread,
Aug 25, 2010, 7:35:18 AM8/25/10
to Puppet Users
Patrick,

I see only a quote of my question in your reply.

Do you have an answer?

Thanks.

--Amos

Tom Duckering

unread,
Aug 25, 2010, 9:15:36 AM8/25/10
to puppet...@googlegroups.com
I believe the escape character is simply \

I use it to escape quotes - \"

Patrick

unread,
Aug 25, 2010, 12:37:45 PM8/25/10
to puppet...@googlegroups.com
Sorry. I must have pressed Send instead of Discard. I didn't actually have anything to say.

Amos Shapira

unread,
Aug 27, 2010, 4:06:05 AM8/27/10
to Puppet Users
Hi Tom,

That's what I tried but it doesn't help.

e.g. here is what I tested again right now:

diff_args = -ubB -I \$HeadURL

and here are the errors that I get:

err: /File[/usr/lib64/nagios/plugins/check_state_file.pl]: Failed to
retrieve current state of resource: Could not find value for $HeadURL

Thanks,

--Amos

On Aug 25, 11:15 pm, Tom Duckering <tom.ducker...@gmail.com> wrote:
> I believe the escape character is simply \
>
> I use it to escape quotes - \"
>
> On 25 Aug 2010, at 12:35, Amos Shapira wrote:
>
> > Patrick,
>
> > I see only a quote of my question in your reply.
>
> > Do you have an answer?
>
> > Thanks.
>
> > --Amos
>
> > On Aug 25, 6:28 pm, Patrick <kc7...@gmail.com> wrote:
> >> On Aug 24, 2010, at 11:52 PM, Amos Shapira wrote:
>
> >>> Hello,
>
> >>> I'd like to pass the following flags to diff through puppet:
>
> >>> -urbB -I $Id -I $HeadURL -I $URL
>
> >>> But when I try to set diff_args in /etc/puppet/puppet.conflike this:

Darren Chamberlain

unread,
Aug 27, 2010, 7:42:53 AM8/27/10
to puppet...@googlegroups.com
* Amos Shapira <amos.shapira at gmail.com> [2010/08/27 01:06]:

> e.g. here is what I tested again right now:
>
> diff_args = -ubB -I \$HeadURL
>
> and here are the errors that I get:
>
> err: /File[/usr/lib64/nagios/plugins/check_state_file.pl]: Failed to
> retrieve current state of resource: Could not find value for $HeadURL

In many config files, such as mutt's, you need to double all the
backslashes, to protect them from the dereferencing that happens
during parsing. So, in \\\$HeadURL, the first \ would escape the
second \, and the third \ would escape the $, so that what gets
passed through is \$HeadURL.

Thus, this is untested speculation, but it can't hurt to try:

diff_args = -ubB -I \\\$HeadURL

--
Darren Chamberlain <dar...@boston.com>

Amos Shapira

unread,
Aug 29, 2010, 11:17:02 PM8/29/10
to Puppet Users
I tried that:

diff_args = -ubB -I \\\$HeadURL

and still get:

err: ...: Failed to retrieve current state of resource: Could not find
value for $HeadURL

Does anyone knows what kind of code parses this? Is it passed through
the shell? How many "levels of quoting" does it go through before
reaching "diff" and by which programs?

Thanks,

--Amos
Reply all
Reply to author
Forward
0 new messages