Issue #12199 has been updated by Dominic Cleal.

I've been making similar changes upstream in Augeas to ensure we have 
consistent quoting between augtool/aug_srun and the Puppet provider, so would 
like to make sure that any change we make here can be implemented there too.  
(Eventually I'd like to use aug_srun from Puppet and remove this second parser.)

Looking through the results, the problem seems to come in whenever an ending 
quote or space exists, and there are more characters beyond it - is that it?

I'm working on something similar to support spaces with readline in augtool, 
permitting strings such as `"/white space/"foo`.  I think this would solve the 
problem here too?

We did discuss an alternative DSL quoting method in #7529, but the underlying 
problem with truncation still exists in the provider.  I'm not sure if an 
augeas_quote function would help, as you'd have to quote your argument to the 
function too.
----------------------------------------
Bug #12199: augeas "set" silently truncates values
https://projects.puppetlabs.com/issues/12199

Author: David Schmitt
Status: Needs More Information
Priority: Normal
Assignee: 
Category: augeas
Target version: 
Affected Puppet version: 2.6.2
Keywords: 
Branch: 


A simple augeas { '...': changes => 'set ... xxx' } can fail to put the 
complete value into the target while wrongly reporting a successful application.

Example manifest:

        define puppet::conf ($ensure) {
                augeas {
                        "puppet.conf_${name}" :
                                changes => "set 
/files/etc/puppet/puppet.conf/${name} ${ensure}" ;
                        "puppet.conf_${name}_sq" :
                                changes => "set 
/files/etc/puppet/puppet.conf/${name}_sq '${ensure}'" ;
                        "puppet.conf_${name}_dq" :
                                changes => "set 
/files/etc/puppet/puppet.conf/${name}_dq \"${ensure}\"" ;
                }
        }

        puppet::conf {
                "agent/server" :
                        ensure => 'puppetmaster-dev.edvbus' ;

                "agent/pluginsync" :
                        ensure => 'true' ;

                "test/sq" :
                        ensure => "'" ;
                "test/sqsq" :
                        ensure => "''" ;
                "test/sqsqsq" :
                        ensure => "'''" ;
                "test/sqsqsqsq" :
                        ensure => "''''" ;
                "test/dq" :
                        ensure => '"' ;
                "test/dqdq" :
                        ensure => '""' ;
                "test/dqdqdq" :
                        ensure => '"""' ;
                "test/dqdqdqdq" :
                        ensure => '""""' ;
                "test/truncated_dq" :
                        ensure => '"s"bc"d"ef' ;
                "test/truncated_sq" :
                        ensure => "'s'bc'd'ef" ;
                "test/truncated_dq_mix" :
                        ensure => '"s"bc\'d\'ef' ;
                "test/truncated_sq_mix" :
                        ensure => "'s'bc\"d\"ef" ;
                "test/truncated_space" :
                        ensure => "before after" ;                      
                "test/mix" :
                        ensure => "a\"b'c\"d'e" ;                       
        }

Result in /etc/puppet/puppet.conf (sorted for convenience): 

    [test]
    dqdqdqdq_sq=""""
    dqdqdq_sq="""
    dqdq_sq=""
    dq_sq="
    mix=a"b'c"d'e
    mix_dq=a
    mix_sq=a"b
    sq_dq='
    sqsq_dq=''
    sqsqsq_dq='''
    sqsqsqsq_dq=''''
    truncated_dq_mix=s
    truncated_dq_mix_sq="s"bc
    truncated_dq=s
    truncated_dq_sq="s"bc"d"ef
    truncated_space=before
    truncated_space_dq=before after
    truncated_space_sq=before after
    truncated_sq_dq='s'bc'd'ef
    truncated_sq_mix_dq='s'bc
    truncated_sq_mix=s
    truncated_sq=s

    
As you can see, depending on the used quoting style, different parts of the 
values are silently truncated. Only values that cannot be written at all into 
the file cause an error.

I've tested this with 2.6. on squeeze and 2.7.10 on centos 6.2 with the same 
results.


-- 
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