FAQ
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/dfdda8af-df09-4fbd-b395-1a419d532564%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Christopher Wood at Aug 14, 2014 at 5:29 pm
    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][email protected].
    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+[email protected]
    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 [email protected].
    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.
  • Jcbollinger at Aug 15, 2014 at 1:33 pm

    On Thursday, August 14, 2014 11:44:02 AM UTC-5, Tim Arnold wrote:
    I want to 'manage' the files in a certain directory ONLY if the rpm is
    updated.

    Why?

    If it is not only acceptable but *desired* that these files be managed
    during runs when the RPM is updated, then why is it not acceptable to
    manage them all the time? The usual reason for wanting one-time management
    of files is to avoid clobbering later modifications, but this scheme in
    fact does clobber any and all modifications between RPM updates.


    Any help is appreciated.
    Repackage your RPM to include the desired versions of the files in question.


    John

    --
    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 [email protected].
    To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/32a518ad-9246-4020-854f-38e75dbc5b5d%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedAug 14, '14 at 5:07p
activeAug 15, '14 at 1:33p
posts3
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2023 Grokbase