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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Robin Sheat
2009-May-05 01:57 UTC
[Puppet Users] Re: Conditionally install a file resource
On Tuesday 05 May 2009 08:58:53 John Florian wrote:> I keep finding that I wish onlyif was a meta-parameter; right now I > want it on the file resource type.I think this would be good, too. I encountered exactly the same situation yesterday. -- Robin <robin@kallisti.net.nz> JabberID: <eythian@jabber.kallisti.net.nz> http://www.kallisti.net.nz/blog ||| http://identi.ca/eythian PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D
Trevor Vaughan
2009-May-05 14:20 UTC
[Puppet Users] Re: Conditionally install a file resource
I agree that this would be useful, and fairly easy to add. I believe that the current best practice for this is to use a custom fact. If you stick it into the Puppet bug tracker as a feature request someone in the community may bite, or at least the technical merits can be hammered out. Trevor On Mon, May 4, 2009 at 21:57, Robin Sheat <robin@kallisti.net.nz> wrote:> On Tuesday 05 May 2009 08:58:53 John Florian wrote: >> I keep finding that I wish onlyif was a meta-parameter; right now I >> want it on the file resource type. > > I think this would be good, too. I encountered exactly the same situation > yesterday. > > -- > Robin <robin@kallisti.net.nz> JabberID: <eythian@jabber.kallisti.net.nz> > http://www.kallisti.net.nz/blog ||| http://identi.ca/eythian > > PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D >--~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
James Turnbull
2009-May-05 14:24 UTC
[Puppet Users] Re: Conditionally install a file resource
Trevor Vaughan wrote:> I agree that this would be useful, and fairly easy to add. > > I believe that the current best practice for this is to use a custom fact. > > If you stick it into the Puppet bug tracker as a feature request > someone in the community may bite, or at least the technical merits > can be hammered out. >http://projects.reductivelabs.com/issues/651 Regards James Turnbull -- Author of: * Pro Linux Systems Administration (http://www.amazon.com/gp/product/1430219122/) * Pulling Strings with Puppet (http://www.amazon.com/gp/product/1590599780/) * Pro Nagios 2.0 (http://www.amazon.com/gp/product/1590596099/) * Hardening Linux (http://www.amazon.com/gp/product/1590594444/)
Robin Sheat
2009-May-06 01:41 UTC
[Puppet Users] Re: Conditionally install a file resource
On Wed, 06 May 2009, James Turnbull wrote:> http://projects.reductivelabs.com/issues/651Internal error An error occurred on the page you were trying to access. If you continue to experience problems please contact your redMine administrator for assistance. ...I saw this error yesterday when looking for something, too. Is it a constant problem, or just my bad timing? -- Robin <robin@kallisti.net.nz> JabberID: <eythian@jabber.kallisti.net.nz> Hostes alienigeni me abduxerunt. Qui annus est? PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8 7175 14D3 6485 A99C EB6D