On Wed, Jul 1, 2009 at 10:47 AM, Tim Galyean<tim.galy...@gmail.com> wrote:
>
> Is there a way to "tell" puppet to do a sort of comparison on the
> files, so that if one does not match the default config it is ignored
> and or not replaced with the default.

A portion of my autofs class:


class autofs {
    package { autofs: ensure => installed }

# Only update /etc/auto.master if it doesn't exist, or if it has the same
# contents as the original package install.  Ie. do not overwrite user changes
# to the file.

# Compute the sha hash of the current file, and the original template, to see if
# the file has changed.  It it has, set "replace" to no.  /dev/null is used to
# prevent exceptions when the files don't exist (if /dev/null doesn't exist, we
# can assume we are f$cked)

    $tmp_a = sha1(file("/etc/auto.master", "/dev/null"))
    $tmp_b = sha1(file("/usr/share/autofs/conffiles/auto.master", "/dev/null"))
    if $tmp_a == $tmp_b {
        $replace_master = yes
    } else {
        $replace_master = no
    }

    rootfile { "/etc/auto.master":
        replace => $replace_master,
        source => "autofs/auto.master"
    }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to