Issue #7529 has been updated by Dominic Cleal.
Status changed from Needs Decision to Rejected
A fairly neat workaround for this is to use ERB templates rather than putting
the commands into the Puppet manifests directly. The Augeas provider will
split commands on new lines, so you can even write complicated Augeas
statements with loops etc.
Inside your template.erb just list the commands without extra quoting, taking
the original example:
set Foo[. = '"<%= bar %>"'] '"<%= bar %>"'
And then for the Augeas resource:
augeas { "example":
changes => template("mymodule/example.erb"),
}
Also see https://gist.github.com/1654201
----------------------------------------
Feature #7529: Support alternative quotes for string literals
https://projects.puppetlabs.com/issues/7529
Author: Dominic Cleal
Status: Rejected
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.