If somebody came to me with this question at work, I'd ask why they aren't 
already managing the files in the directory to eliminate this dependency.

There's no "refreshonly" for files like there is for execs per the type list, 
so you're out of luck there ("not all types can refresh").

https://docs.puppetlabs.com/references/latest/type.html#file

https://docs.puppetlabs.com/references/latest/metaparameter.html#subscribe

In this case, where configs depend very much on the version of the underlying 
rpm, I might on one hand:

1) create a custom fact with the version of this package

https://docs.puppetlabs.com/facter/2.1/custom_facts.html

2) manage files based on the version exposed by this fact (have the files 
depend on the package so that they're managed after)

However, facts are only read once, iirc, so an rpm version change during an 
agent run will mean that configs are fixed up on the next agent run, leaving 
the daemon with stale configs for a time. Not desirable.

To get around this I might have two sets of manifests, each for the separate 
rpm version, and use hiera + class parameter to decide which set of rpm+configs 
gets managed and which gets removed. Toggle the value and I get newer versus 
older daemons.

If I were doing this in a high availability environment I might use the dual 
manifests to build a new set of servers with the new rpm+configs, while 
managing the hosts with the old rpm+configs. Then swap those into the load 
balancer in the same action where I swap the older servers out and carry on. 
That way if we find a problem we can just swap in the old servers to restore 
service and go ponder.

On Thu, Aug 14, 2014 at 09:44:01AM -0700, Tim Arnold wrote:
>    I want to 'manage' the files in a certain directory ONLY if the rpm is
>    updated.  Any help is appreciated.
>    For example (this doesn't work):
>    package { 'package-name' :
>      
>      ensure   => 'Version-2',   
>      provider => 'rpm',
>    }
>    file { '/home/thisuser/.java' :
>      
>       ensure => directory,   
>       subscribe =>  Package['package-name'],   
>       recurse => true,   
>       purge => true,   
>       force =>  true,   
>       backup => false,   
>       source =>  'puppet:///modules/test/home/thisuser/.java',
>    }
> 
>    --
>    You received this message because you are subscribed to the Google Groups
>    "Puppet Users" group.
>    To unsubscribe from this group and stop receiving emails from it, send an
>    email to [1]puppet-users+unsubscr...@googlegroups.com.
>    To view this discussion on the web visit
>    
> [2]https://groups.google.com/d/msgid/puppet-users/dfdda8af-df09-4fbd-b395-1a419d532564%40googlegroups.com.
>    For more options, visit [3]https://groups.google.com/d/optout.
> 
> References
> 
>    Visible links
>    1. mailto:puppet-users+unsubscr...@googlegroups.com
>    2. 
> https://groups.google.com/d/msgid/puppet-users/dfdda8af-df09-4fbd-b395-1a419d532564%40googlegroups.com?utm_medium=email&utm_source=footer
>    3. https://groups.google.com/d/optout

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/20140814172850.GA26640%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.

Reply via email to