FAQ
Hello puppet-users,

I need to use puppet to install a slightly modified version of a
package (modify a few lines in the scripts it installs), but I don't
want to build my own version of the package and distribute it via a
private package repository because this seems too heavyweight.

What's the common way to do this? I have a few things in mind:
* Add separate file resources to overwrite the files I need to
modify. Pro: easy to implement. Con: essentially fixes the "base"
version of the package I'm using (won't merge with the updated
package's changes in the same file)
* Add an exec task to patch the files. Pro: seems like the right way.
Con: how do I detect if the patch is already applied? (should I just
force-reinstall the base package before patching?)

--
Eugene Kirpichov
http://www.linkedin.com/in/eugenekirpichov

--
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.

Search Discussions

  • Bryan Hunt at Aug 1, 2012 at 8:34 am

    On Mon, Jul 30, 2012 at 10:51 PM, Eugene Kirpichov wrote:

    Hello puppet-users,

    I need to use puppet to install a slightly modified version of a
    package (modify a few lines in the scripts it installs)
    Which script, the init script? Which package?

    * Add separate file resources to overwrite the files I need to
    modify. Pro: easy to implement. Con: essentially fixes the "base"
    version of the package I'm using (won't merge with the updated
    package's changes in the same file)
    This is the fundamental issues with any fork. It's the oldest story in the
    book, once you have a customized package install you must then main your
    version in perpetuity.

    * Add an exec task to patch the files. Pro: seems like the right way.
    Con: how do I detect if the patch is already applied? (should I just
    force-reinstall the base package before patching?)
    Could use a checksum or execute something like sed to modify the file in
    old school manner. Or more idiomatically, write a puppet plugin.

    Regards,

    Bryan Hunt

    --
    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.
  • Calvin Walton at Aug 1, 2012 at 3:49 pm

    On Mon, 2012-07-30 at 14:51 -0700, Eugene Kirpichov wrote:
    Hello puppet-users,

    I need to use puppet to install a slightly modified version of a
    package (modify a few lines in the scripts it installs), but I don't
    want to build my own version of the package and distribute it via a
    private package repository because this seems too heavyweight.

    What's the common way to do this? I have a few things in mind:
    * Add an exec task to patch the files. Pro: seems like the right way.
    Con: how do I detect if the patch is already applied? (should I just
    force-reinstall the base package before patching?)
    The easiest way to do this sort of thing is to add some sort of marker
    keyword to the file when the patch is applied. Then you can use a
    resource like

    exec { 'patch script':
    unless => 'grep MARKER_KEYWORD /path/to/script',
    command => 'patch /path/to/script some-patch',
    require => [ Package['thepackage'], File['some-patch'] ],
    }

    If the package will always be installed and upgraded through puppet, you
    might consider making the exec 'refreshonly' and notifying it from the
    package resource.

    --
    Calvin Walton <calvin.walton@kepstin.ca>

    --
    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.
  • Eugene Kirpichov at Aug 1, 2012 at 4:55 pm
    Hi Calvin,

    Thanks, your solution is exactly what I need! So simple and elegant and
    obvious in retrospect :)

    среда, 1 августа 2012 г., 8:49:42 UTC-7 пользователь Calvin Walton написал:
    On Mon, 2012-07-30 at 14:51 -0700, Eugene Kirpichov wrote:
    Hello puppet-users,

    I need to use puppet to install a slightly modified version of a
    package (modify a few lines in the scripts it installs), but I don't
    want to build my own version of the package and distribute it via a
    private package repository because this seems too heavyweight.

    What's the common way to do this? I have a few things in mind:
    * Add an exec task to patch the files. Pro: seems like the right way.
    Con: how do I detect if the patch is already applied? (should I just
    force-reinstall the base package before patching?)
    The easiest way to do this sort of thing is to add some sort of marker
    keyword to the file when the patch is applied. Then you can use a
    resource like

    exec { 'patch script':
    unless => 'grep MARKER_KEYWORD /path/to/script',
    command => 'patch /path/to/script some-patch',
    require => [ Package['thepackage'], File['some-patch'] ],
    }

    If the package will always be installed and upgraded through puppet, you
    might consider making the exec 'refreshonly' and notifying it from the
    package resource.

    --
    Calvin Walton <calvin.walton@kepstin.ca>
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/PdHB3TUqsIgJ.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJul 30, '12 at 9:53p
activeAug 1, '12 at 4:55p
posts4
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase