Issue #1679 has been updated by ohookins.

I found another issue, may be the same thing if Puppet is generally stripping 
out control characters from variables before using them... I have an ugly 
definition which does search/replace stuff:

<pre>
define search_replace($search, $line) {
        Exec {
                path => "/bin:/sbin:/usr/bin:/usr/sbin",
        }

        # this is a slightly nasty hack to backup the file before the edit
        exec { search-replace-backup:
                command => "filebucket --remote backup '${name}'",
                unless => "egrep '^${line}$' '${name}'",
                path => "/bin:/sbin:/usr/bin:/usr/sbin",
                logoutput => true,
                notify => Exec["replace"],
        }
        
        exec { replace:
                command => "sed -r -i -e 's/${search}/${line}/' ${name}",
                unless => "egrep '^${line}$' '${name}'",
                path => "/bin:/sbin:/usr/bin:/usr/sbin",
                refreshonly => true,
        }
}
</pre>

In a manifest I have the following:

<pre>
                # fix default umask settings
                search_replace { "/etc/bashrc":
                        search => "^.*umask 022$",
                        line => "       umask 0072";
                }
</pre>

Note that in the above case I have defined "line" to be "\tumask 0072" - it has 
a leading tab.

I find that the search/replace is continually running the first exec because it 
can't find the line. I see that in the seemingly correctly-edited file the tab 
has been replaced with 8 spaces. So somewhere in the search/replace the tab is 
being interpreted as spaces rather than left as a control character.
----------------------------------------
Bug #1679: Control characters can't be used within a file resource
http://projects.reductivelabs.com/issues/show/1679

Author: ohookins
Status: Accepted
Priority: Normal
Assigned to: community
Category: file
Target version: unplanned
Complexity: Unknown
Affected version: 0.24.5
Keywords: 


Our use case is thus: occasionally users will copy perl scripts over to our 
Linux machines from a Windows machine, unchanged, resulting in carriage return 
characters on the end of the line. Therefore the shebang might end up looking 
like this:

<pre>
#!/usr/bin/perl^M
</pre>

where the ^M is a carriage return character (you can get this in Vi by typing 
^V^M). To alleviate problems with these scripts we usually create a few links:
/usr/bin/perl^M -> /usr/bin/perl
/usr/local/bin/perl^M -> /usr/bin/perl

etc.

If you attempt to put the control character ^M into the manifest to create the 
link, it is ignored (or stripped out) by puppet and we end up over-writing 
/usr/bin/perl with an invalid link to itself.

<pre>
file { "/usr/bin/perl^M":
        ensure => "/usr/bin/perl";
}
</pre>

For the moment I've had to resort to execs to get the job done (which 
unfortunately still messes with puppet's debug output due to the ^M) but it 
would be nice if puppet could handle the control character natively.


----------------------------------------
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://reductivelabs.com/redmine/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