I keep finding that I wish onlyif was a meta-parameter;  right now I
want it on the file resource type.

I need to install a file, but only if the source exists.  It's a
really simple file resource that works great when the source exists,
but fails when it doesn't.  I don't care if it fails, but I do not
want it to terminate the whole dependency chain.  Here's what I'm
working with:

define network($interface_name) {

    file { "ifcfg-$interface_name":
        group   => root,
        mode    => 644,
        owner   => root,
        path    => "/etc/sysconfig/network-scripts/ifcfg-
$interface_name",
        source  => [ "$puppeteer_cache/ifcfg-$interface_name" ],
    }

    service { "network":
        enable     => true,
        ensure     => running,
        hasrestart => true,
        status     => "test -e /var/lock/subsys/network",
        subscribe  => [
            File["ifcfg-$interface_name"],
        ],
    }

}

The contents of the $puppeteer_cache directory are independently
populated by rsync and are based upon the system's MAC address.  So
puppet doesn't know if the the file source is there or not.

Just to be clear, another resource depends on Service["network"] and I
want it run regardless of whether a "$puppeteer_cache/ifcfg-
$interface_name" file exists or not.  Most of the systems this runs on
are using DHCP, which will work fine given the default content of this
file.  I only want to deploy this file this way for those systems that
need a static address.

Do I have to kludge this with an exec type or is there some way to use
the file type that I'm missing?
--~--~---------~--~----~------------~-------~--~----~
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