Version information
This version is compatible with:
- Puppet Enterprise 2025.4.x, 2025.3.x, 2025.2.x, 2025.1.x, 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x
- Puppet >=6.0.0 <9.0.0
- Debian,Ubuntu
Start using this module
Add this module to your Puppetfile:
mod 'tohuwabohu-patch', '1.5.0'
Learn more about managing modules with a PuppetfileDocumentation
patch
Overview
Manage and apply diff files on original files using the patch command.
Usage
- Install patch with package settings; this itself doesn't do much. To apply patches, you have to use
patch::file
.
class { 'patch': }
- Apply diff referenced by a file on a given original file
patch::file { '/path/to/file':
diff_source => '/path/to/diff',
}
- Apply inline diff on a given original file
patch::file { '/path/to/file':
diff_content => '<inline-diff>',
}
- Apply two diff files in a particular order on the same original file
$target = '/path/to/file'
patch::file { 'first-patch':
target => $target,
prefix => '0001',
diff_source => '/path/to/0001.diff',
}
patch::file { 'second-patch':
target => $target,
prefix => '0002',
diff_source => '/path/to/0002.diff',
require => Patch::File['first-patch'],
}
- Apply diff to a directory
patch::directory { '/path/to/target/directory':
diff_source => '/path/to/diff',
strip => 2,
}
Limitations
The module has been tested on the following operating systems. Testing and patches for other platforms are welcome.
- Debian 7.0 (Wheezy)
- Debian 8.0 (Jessie)
- Ubuntu 14.04 (Trusty Tahr)
- Ubuntu 16.04 (Xenial Xerus)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Development
This project uses rspec-puppet and beaker to ensure the module works as expected and to prevent regressions.
gem install bundler
bundle install --path vendor
bundle exec rake spec
bundle exec rake beaker
(note: see Beaker - Supported ENV variables for a list of environment variables to control the default behaviour of Beaker)
2023-08-11 - Release 1.5.0
Improve compatibility with stdlib (#10).
2016-10-08 - Release 1.4.0
Add support for Ubuntu 16.04.
2016-05-08 - Release 1.3.0
Add manage_package
boolean (#5).
2016-03-09 - Release 1.2.2
Prefix only works if there are different title for the Exec ressource (#4).
2016-01-24 - Release 1.2.1
This is just a maintenance release.
- Bump gem dependencies to the latest version
- Update travis test matrix and add support for Puppet 4
- Add very basic acceptance tests
2015-05-10 - Release 1.2.0
Add ability to apply a patch to a directory (#2).
2014-11-01 - Release 1.1.0
Bad patches are no longer ignored and will now fail the Puppet run.
Dependencies
- puppetlabs/stdlib (>=8.0.0 <10.0.0)