Issue #7529 has been updated by Deven Phillips.

I had a similar situation today with the augeas provider:

<pre>

                        augeas { "main-$device" :
                                context => "/files/etc/network/interfaces",
                                changes => [
                                        "set auto[child::1 = $device]/1 
$device",
                                        "set iface[. = \'$device\'] $device",
                                        "set iface[. = \'$device\']/family 
inet",
                                        "set iface[. = \'$device\']/method 
static",
                                        "set iface[. = \'$device\']/address 
$ipaddr",
                                        "set iface[. = \'$device\']/netmask 
$netmask",
                                ],
                        }
</pre>

The "set iface" locator string for $device needed to be single quoted, but the 
regular variable did not. There is no documentation I am aware of to show users 
that this might be needed.
----------------------------------------
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