Issue #7529 has been updated by Dominic Cleal.

Nigel Kersten wrote:
> I *just* had to deal with this exact issue, and so I feel the pain here at a 
> very personal level  :)

It's frustrating, and I think there might be a bug (possibly in the provider) 
that means they only work one particular way around... something else to 
investigate one day.

> I don't really remember ever having to deal with this problem at such a 
> frustrating level outside of the Augeas type though, which makes me wonder if 
> there's an alternative solution.

The only other one that seems similar would be for the Exec type, particularly 
before the advent of the shell provider in 2.6 where a user might use "sh -c".

I can't see any solution at the moment for the Augeas provider while we're 
having to quote XPath-type expressions and embed quotes inside it (which is a 
limitation of the Augeas lens or impl).
----------------------------------------
Feature #7529: Support alternative quotes for string literals
https://projects.puppetlabs.com/issues/7529

Author: Dominic Cleal
Status: Needs Decision
Priority: Normal
Assignee: Nigel Kersten
Category: language
Target version: 
Affected Puppet version: 
Keywords: language quoting
Branch: 


Quoting can be an issue with Augeas resources, where strings in commands are 
quoted but the value itself has to contain quotes.  For example, to set the 
value of a node to "bar" (with the quotes), one might do:

    augeas { "myaug":
      changes => "set Foo[. = '\"$bar\"'] '\"$bar\"'"
    }

If the DSL supported some alternative method of quoting, such as [Perl's q{} 
and/or qq{}](http://perldoc.perl.org/perlop.html#Quote-Like-Operators) or 
[Ruby's %q and 
%Q](http://en.wikibooks.org/wiki/Ruby_Programming/Alternate_quotes), we could 
lose a level of escaping.

Perhaps the above example could then be improved to read:

    augeas { "myaug":
      changes => %Q(set Foo[. = '"$bar"'] '"$bar"')
    }


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

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

Reply via email to