├── .editorconfig ├── .fixtures.yml ├── .gitattributes ├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md ├── labeler.yml ├── release.yml └── workflows │ ├── ci.yml │ ├── labeler.yml │ ├── prepare_release.yml │ └── release.yml ├── .gitignore ├── .msync.yml ├── .overcommit.yml ├── .pmtignore ├── .puppet-lint.rc ├── .rubocop.yml ├── .sync.yml ├── CHANGELOG.md ├── Gemfile ├── HISTORY.md ├── LICENSE ├── README.md ├── REFERENCE.md ├── Rakefile ├── data ├── common.yaml └── os │ └── FreeBSD.yaml ├── functions └── lens_dir.pp ├── hiera.yaml ├── lib └── puppet │ └── functions │ └── augeas.rb ├── manifests ├── files.pp ├── init.pp └── lens.pp ├── metadata.json └── spec ├── acceptance └── init_spec.rb ├── classes └── augeas_spec.rb ├── defines └── augeas_lens_spec.rb ├── functions └── augeas_spec.rb ├── spec_helper.rb └── spec_helper_acceptance.rb /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | # Managed by modulesync - DO NOT EDIT 4 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 5 | 6 | root = true 7 | 8 | [*] 9 | charset = utf-8 10 | end_of_line = lf 11 | indent_size = 2 12 | tab_width = 2 13 | indent_style = space 14 | insert_final_newline = true 15 | trim_trailing_whitespace = true 16 | -------------------------------------------------------------------------------- /.fixtures.yml: -------------------------------------------------------------------------------- 1 | # yamllint disable rule:line-length 2 | # This file can be used to install module dependencies for unit testing 3 | # See https://github.com/puppetlabs/puppetlabs_spec_helper#using-fixtures for details 4 | --- 5 | fixtures: 6 | repositories: 7 | stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git 8 | augeas_core: https://github.com/puppetlabs/puppetlabs-augeas_core.git 9 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.rb eol=lf 2 | *.erb eol=lf 3 | *.pp eol=lf 4 | *.sh eol=lf 5 | *.epp eol=lf 6 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution guidelines 2 | 3 | ## Table of contents 4 | 5 | * [Contributing](#contributing) 6 | * [Writing proper commits - short version](#writing-proper-commits-short-version) 7 | * [Writing proper commits - long version](#writing-proper-commits-long-version) 8 | * [Dependencies](#dependencies) 9 | * [Note for OS X users](#note-for-os-x-users) 10 | * [The test matrix](#the-test-matrix) 11 | * [Syntax and style](#syntax-and-style) 12 | * [Running the unit tests](#running-the-unit-tests) 13 | * [Unit tests in docker](#unit-tests-in-docker) 14 | * [Integration tests](#integration-tests) 15 | 16 | This module has grown over time based on a range of contributions from 17 | people using it. If you follow these contributing guidelines your patch 18 | will likely make it into a release a little more quickly. 19 | 20 | ## Contributing 21 | 22 | Please note that this project is released with a Contributor Code of Conduct. 23 | By participating in this project you agree to abide by its terms. 24 | [Contributor Code of Conduct](https://voxpupuli.org/coc/). 25 | 26 | * Fork the repo. 27 | * Create a separate branch for your change. 28 | * We only take pull requests with passing tests, and documentation. [GitHub Actions](https://docs.github.com/en/actions) run the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). 29 | * Checkout [our docs](https://voxpupuli.org/docs/reviewing_pr/) we use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). They provide some guidance for new code that might help you before you submit a pull request. 30 | * Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. 31 | * Squash your commits down into logical components. Make sure to rebase against our current master. 32 | * Push the branch to your fork and submit a pull request. 33 | 34 | Please be prepared to repeat some of these steps as our contributors review your code. 35 | 36 | Also consider sending in your profile code that calls this component module as an acceptance test or provide it via an issue. This helps reviewers a lot to test your use case and prevents future regressions! 37 | 38 | ## Writing proper commits - short version 39 | 40 | * Make commits of logical units. 41 | * Check for unnecessary whitespace with "git diff --check" before committing. 42 | * Commit using Unix line endings (check the settings around "crlf" in git-config(1)). 43 | * Do not check in commented out code or unneeded files. 44 | * The first line of the commit message should be a short description (50 characters is the soft limit, excluding ticket number(s)), and should skip the full stop. 45 | * Associate the issue in the message. The first line should include the issue number in the form "(#XXXX) Rest of message". 46 | * The body should provide a meaningful commit message, which: 47 | *uses the imperative, present tense: `change`, not `changed` or `changes`. 48 | * includes motivation for the change, and contrasts its implementation with the previous behavior. 49 | * Make sure that you have tests for the bug you are fixing, or feature you are adding. 50 | * Make sure the test suites passes after your commit: 51 | * When introducing a new feature, make sure it is properly documented in the README.md 52 | 53 | ## Writing proper commits - long version 54 | 55 | 1. Make separate commits for logically separate changes. 56 | 57 | Please break your commits down into logically consistent units 58 | which include new or changed tests relevant to the rest of the 59 | change. The goal of doing this is to make the diff easier to 60 | read for whoever is reviewing your code. In general, the easier 61 | your diff is to read, the more likely someone will be happy to 62 | review it and get it into the code base. 63 | 64 | If you are going to refactor a piece of code, please do so as a 65 | separate commit from your feature or bug fix changes. 66 | 67 | We also really appreciate changes that include tests to make 68 | sure the bug is not re-introduced, and that the feature is not 69 | accidentally broken. 70 | 71 | Describe the technical detail of the change(s). If your 72 | description starts to get too long, that is a good sign that you 73 | probably need to split up your commit into more finely grained 74 | pieces. 75 | 76 | Commits which plainly describe the things which help 77 | reviewers check the patch and future developers understand the 78 | code are much more likely to be merged in with a minimum of 79 | bike-shedding or requested changes. Ideally, the commit message 80 | would include information, and be in a form suitable for 81 | inclusion in the release notes for the version of Puppet that 82 | includes them. 83 | 84 | Please also check that you are not introducing any trailing 85 | whitespace or other "whitespace errors". You can do this by 86 | running "git diff --check" on your changes before you commit. 87 | 88 | 2. Sending your patches 89 | 90 | To submit your changes via a GitHub pull request, we _highly_ 91 | recommend that you have them on a topic branch, instead of 92 | directly on `master`. 93 | It makes things much easier to keep track of, especially if 94 | you decide to work on another thing before your first change 95 | is merged in. 96 | 97 | GitHub has some pretty good 98 | [general documentation](http://help.github.com/) on using 99 | their site. They also have documentation on 100 | [creating pull requests](http://help.github.com/send-pull-requests/). 101 | 102 | In general, after pushing your topic branch up to your 103 | repository on GitHub, you can switch to the branch in the 104 | GitHub UI and click "Pull Request" towards the top of the page 105 | in order to open a pull request. 106 | 107 | 108 | 3. Update the related GitHub issue. 109 | 110 | If there is a GitHub issue associated with the change you 111 | submitted, then you should update the ticket to include the 112 | location of your branch, along with any other commentary you 113 | may wish to make. 114 | 115 | ## Dependencies 116 | 117 | The testing and development tools have a bunch of dependencies, 118 | all managed by [bundler](http://bundler.io/) according to the 119 | [Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). 120 | 121 | By default the tests use a baseline version of Puppet. 122 | 123 | If you have Ruby 2.x or want a specific version of Puppet, 124 | you must set an environment variable such as: 125 | 126 | ```sh 127 | export PUPPET_GEM_VERSION="~> 6.1.0" 128 | ``` 129 | 130 | You can install all needed gems for spec tests into the modules directory by 131 | running: 132 | 133 | ```sh 134 | bundle config set --local path '.vendor/' 135 | bundle config set --local without 'development system_tests release' 136 | bundle install --jobs "$(nproc)" 137 | ``` 138 | 139 | If you also want to run acceptance tests: 140 | 141 | ```sh 142 | bundle config set --local path '.vendor/' 143 | bundle config set --local without 'development release' 144 | bundle config set --local with 'system_tests' 145 | bundle install --jobs "$(nproc)" 146 | ``` 147 | 148 | Our all in one solution if you don't know if you need to install or update gems: 149 | 150 | ```sh 151 | bundle config set --local path '.vendor/' 152 | bundle config set --local without 'development release' 153 | bundle config set --local with 'system_tests' 154 | bundle install --jobs "$(nproc)" 155 | bundle update 156 | bundle clean 157 | ``` 158 | 159 | As an alternative to the `--jobs "$(nproc)` parameter, you can set an 160 | environment variable: 161 | 162 | ```sh 163 | BUNDLE_JOBS="$(nproc)" 164 | ``` 165 | 166 | ### Note for OS X users 167 | 168 | `nproc` isn't a valid command under OS x. As an alternative, you can do: 169 | 170 | ```sh 171 | --jobs "$(sysctl -n hw.ncpu)" 172 | ``` 173 | 174 | ## The test matrix 175 | 176 | ### Syntax and style 177 | 178 | The test suite will run [Puppet Lint](http://puppet-lint.com/) and 179 | [Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to 180 | check various syntax and style things. You can run these locally with: 181 | 182 | ```sh 183 | bundle exec rake lint 184 | bundle exec rake validate 185 | ``` 186 | 187 | It will also run some [Rubocop](http://batsov.com/rubocop/) tests 188 | against it. You can run those locally ahead of time with: 189 | 190 | ```sh 191 | bundle exec rake rubocop 192 | ``` 193 | 194 | ### Running the unit tests 195 | 196 | The unit test suite covers most of the code, as mentioned above please 197 | add tests if you're adding new functionality. If you've not used 198 | [rspec-puppet](http://rspec-puppet.com/) before then feel free to ask 199 | about how best to test your new feature. 200 | 201 | To run the linter, the syntax checker and the unit tests: 202 | 203 | ```sh 204 | bundle exec rake test 205 | ``` 206 | 207 | To run your all the unit tests 208 | 209 | ```sh 210 | bundle exec rake spec 211 | ``` 212 | 213 | To run a specific spec test set the `SPEC` variable: 214 | 215 | ```sh 216 | bundle exec rake spec SPEC=spec/foo_spec.rb 217 | ``` 218 | 219 | #### Unit tests in docker 220 | 221 | Some people don't want to run the dependencies locally or don't want to install 222 | ruby. We ship a Dockerfile that enables you to run all unit tests and linting. 223 | You only need to run: 224 | 225 | ```sh 226 | docker build . 227 | ``` 228 | 229 | Please ensure that a docker daemon is running and that your user has the 230 | permission to talk to it. You can specify a remote docker host by setting the 231 | `DOCKER_HOST` environment variable. it will copy the content of the module into 232 | the docker image. So it will not work if a Gemfile.lock exists. 233 | 234 | ### Integration tests 235 | 236 | The unit tests just check the code runs, not that it does exactly what 237 | we want on a real machine. For that we're using 238 | [beaker](https://github.com/puppetlabs/beaker). 239 | 240 | This fires up a new virtual machine (using vagrant) and runs a series of 241 | simple tests against it after applying the module. You can run this 242 | with: 243 | 244 | ```sh 245 | BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker 246 | ``` 247 | 248 | or 249 | 250 | ```sh 251 | BEAKER_PUPPET_COLLECTION=none BEAKER_setfile=archlinux-64 bundle exec rake beaker 252 | ``` 253 | 254 | This latter example will use the distribution's own version of Puppet. 255 | 256 | You can replace the string `debian11` with any common operating system. 257 | The following strings are known to work: 258 | 259 | * ubuntu2004 260 | * ubuntu2204 261 | * debian11 262 | * debian12 263 | * centos9 264 | * archlinux 265 | * almalinux8 266 | * almalinux9 267 | * fedora36 268 | 269 | For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). 270 | 271 | The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) 272 | repository. 273 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 10 | 11 | ## Affected Puppet, Ruby, OS and module versions/distributions 12 | 13 | - Puppet: 14 | - Ruby: 15 | - Distribution: 16 | - Module version: 17 | 18 | ## How to reproduce (e.g Puppet code you use) 19 | 20 | ## What are you seeing 21 | 22 | ## What behaviour did you expect instead 23 | 24 | ## Output log 25 | 26 | ## Any additional information you'd like to impart 27 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 9 | #### Pull Request (PR) description 10 | 13 | 14 | #### This Pull Request (PR) fixes the following issues 15 | 21 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | skip-changelog: 6 | - head-branch: ['^release-*', 'release'] 7 | -------------------------------------------------------------------------------- /.github/release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | # https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes 6 | 7 | changelog: 8 | exclude: 9 | labels: 10 | - duplicate 11 | - invalid 12 | - modulesync 13 | - question 14 | - skip-changelog 15 | - wont-fix 16 | - wontfix 17 | 18 | categories: 19 | - title: Breaking Changes 🛠 20 | labels: 21 | - backwards-incompatible 22 | 23 | - title: New Features 🎉 24 | labels: 25 | - enhancement 26 | 27 | - title: Bug Fixes 🐛 28 | labels: 29 | - bug 30 | 31 | - title: Documentation Updates 📚 32 | labels: 33 | - documentation 34 | - docs 35 | 36 | - title: Dependency Updates ⬆️ 37 | labels: 38 | - dependencies 39 | 40 | - title: Other Changes 41 | labels: 42 | - "*" 43 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | name: CI 6 | 7 | # yamllint disable-line rule:truthy 8 | on: 9 | pull_request: {} 10 | push: 11 | branches: 12 | - main 13 | - master 14 | 15 | concurrency: 16 | group: ${{ github.ref_name }} 17 | cancel-in-progress: true 18 | 19 | jobs: 20 | puppet: 21 | name: Puppet 22 | uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v3 23 | with: 24 | additional_packages: 'libaugeas-dev augeas-tools' 25 | -------------------------------------------------------------------------------- /.github/workflows/labeler.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | name: "Pull Request Labeler" 6 | 7 | # yamllint disable-line rule:truthy 8 | on: 9 | pull_request_target: {} 10 | 11 | jobs: 12 | labeler: 13 | permissions: 14 | contents: read 15 | pull-requests: write 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: actions/labeler@v5 19 | -------------------------------------------------------------------------------- /.github/workflows/prepare_release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | name: 'Prepare Release' 6 | 7 | on: 8 | workflow_dispatch: 9 | inputs: 10 | version: 11 | description: 'Module version to be released. Must be a valid semver string without leading v. (1.2.3)' 12 | required: false 13 | 14 | jobs: 15 | release_prep: 16 | uses: 'voxpupuli/gha-puppet/.github/workflows/prepare_release.yml@v3' 17 | with: 18 | version: ${{ github.event.inputs.version }} 19 | allowed_owner: 'voxpupuli' 20 | secrets: 21 | # Configure secrets here: 22 | # https://docs.github.com/en/actions/security-guides/encrypted-secrets 23 | github_pat: '${{ secrets.PCCI_PAT_RELEASE_PREP }}' 24 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | name: Release 6 | 7 | # yamllint disable-line rule:truthy 8 | on: 9 | push: 10 | tags: 11 | - '*' 12 | 13 | jobs: 14 | release: 15 | name: Release 16 | uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v3 17 | with: 18 | allowed_owner: 'voxpupuli' 19 | secrets: 20 | # Configure secrets here: 21 | # https://docs.github.com/en/actions/security-guides/encrypted-secrets 22 | username: ${{ secrets.PUPPET_FORGE_USERNAME }} 23 | api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | /pkg/ 5 | /Gemfile.lock 6 | /Gemfile.local 7 | /vendor/ 8 | /.vendor/ 9 | /spec/fixtures/manifests/ 10 | /spec/fixtures/modules/ 11 | /.vagrant/ 12 | /.bundle/ 13 | /.ruby-version 14 | /coverage/ 15 | /log/ 16 | /.idea/ 17 | /.dependencies/ 18 | /.librarian/ 19 | /Puppetfile.lock 20 | *.iml 21 | .*.sw? 22 | /.yardoc/ 23 | /Guardfile 24 | bolt-debug.log 25 | .rerun.json 26 | -------------------------------------------------------------------------------- /.msync.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | modulesync_config_version: '9.7.0' 6 | -------------------------------------------------------------------------------- /.overcommit.yml: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | # 4 | # Hooks are only enabled if you take action. 5 | # 6 | # To enable the hooks run: 7 | # 8 | # ``` 9 | # bundle exec overcommit --install 10 | # # ensure .overcommit.yml does not harm to you and then 11 | # bundle exec overcommit --sign 12 | # ``` 13 | # 14 | # (it will manage the .git/hooks directory): 15 | # 16 | # Examples howto skip a test for a commit or push: 17 | # 18 | # ``` 19 | # SKIP=RuboCop git commit 20 | # SKIP=PuppetLint git commit 21 | # SKIP=RakeTask git push 22 | # ``` 23 | # 24 | # Don't invoke overcommit at all: 25 | # 26 | # ``` 27 | # OVERCOMMIT_DISABLE=1 git commit 28 | # ``` 29 | # 30 | # Read more about overcommit: https://github.com/brigade/overcommit 31 | # 32 | # To manage this config yourself in your module add 33 | # 34 | # ``` 35 | # .overcommit.yml: 36 | # unmanaged: true 37 | # ``` 38 | # 39 | # to your modules .sync.yml config 40 | --- 41 | PreCommit: 42 | RuboCop: 43 | enabled: true 44 | description: 'Runs rubocop on modified files only' 45 | command: ['bundle', 'exec', 'rubocop'] 46 | RakeTarget: 47 | enabled: true 48 | description: 'Runs lint on modified files only' 49 | targets: 50 | - 'lint' 51 | command: ['bundle', 'exec', 'rake'] 52 | YamlSyntax: 53 | enabled: true 54 | JsonSyntax: 55 | enabled: true 56 | TrailingWhitespace: 57 | enabled: true 58 | 59 | PrePush: 60 | RakeTarget: 61 | enabled: true 62 | description: 'Run rake targets' 63 | targets: 64 | - 'validate' 65 | - 'test' 66 | - 'rubocop' 67 | command: ['bundle', 'exec', 'rake'] 68 | -------------------------------------------------------------------------------- /.pmtignore: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | /docs/ 5 | /pkg/ 6 | /Gemfile 7 | /Gemfile.lock 8 | /Gemfile.local 9 | /vendor/ 10 | /.vendor/ 11 | /spec/ 12 | /Rakefile 13 | /.vagrant/ 14 | /.bundle/ 15 | /.ruby-version 16 | /coverage/ 17 | /log/ 18 | /.idea/ 19 | /.dependencies/ 20 | /.github/ 21 | /.librarian/ 22 | /Puppetfile.lock 23 | /Puppetfile 24 | *.iml 25 | /.editorconfig 26 | /.fixtures.yml 27 | /.gitignore 28 | /.msync.yml 29 | /.overcommit.yml 30 | /.pmtignore 31 | /.rspec 32 | /.rspec_parallel 33 | /.rubocop.yml 34 | /.sync.yml 35 | .*.sw? 36 | /.yardoc/ 37 | /.yardopts 38 | /Dockerfile 39 | /HISTORY.md 40 | -------------------------------------------------------------------------------- /.puppet-lint.rc: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | --fail-on-warnings 5 | --no-parameter_documentation-check 6 | --no-parameter_types-check 7 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Managed by modulesync - DO NOT EDIT 3 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 4 | 5 | inherit_gem: 6 | voxpupuli-test: rubocop.yml 7 | -------------------------------------------------------------------------------- /.sync.yml: -------------------------------------------------------------------------------- 1 | --- 2 | Gemfile: 3 | optional: 4 | ':test': 5 | - gem: ruby-augeas 6 | .github/workflows/ci.yml: 7 | with: 8 | additional_packages: libaugeas-dev augeas-tools 9 | spec/spec_helper_acceptance.rb: 10 | unmanaged: false 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | Each new release typically also includes the latest modulesync defaults. 5 | These should not affect the functionality of the module. 6 | 7 | ## [v2.0.0](https://github.com/voxpupuli/puppet-augeas/tree/v2.0.0) (2024-09-10) 8 | 9 | [Full Changelog](https://github.com/voxpupuli/puppet-augeas/compare/1.9.0...v2.0.0) 10 | 11 | **Breaking changes:** 12 | 13 | - drop support for EoL Amazon 2014.09 & 2015.03 [\#108](https://github.com/voxpupuli/puppet-augeas/pull/108) ([jhoblitt](https://github.com/jhoblitt)) 14 | - Drop support for EOL operating systems [\#104](https://github.com/voxpupuli/puppet-augeas/pull/104) ([smortex](https://github.com/smortex)) 15 | - Drop support for Puppet 4, 5, 6 \(EOL\) [\#101](https://github.com/voxpupuli/puppet-augeas/pull/101) ([smortex](https://github.com/smortex)) 16 | 17 | **Implemented enhancements:** 18 | 19 | - Add support for Debian 12, Ubuntu 24.04 [\#105](https://github.com/voxpupuli/puppet-augeas/pull/105) ([smortex](https://github.com/smortex)) 20 | - Add support for current Operating Systems [\#100](https://github.com/voxpupuli/puppet-augeas/pull/100) ([smortex](https://github.com/smortex)) 21 | - Add support for Puppet 7 & 8 [\#99](https://github.com/voxpupuli/puppet-augeas/pull/99) ([smortex](https://github.com/smortex)) 22 | - Improve facts management [\#92](https://github.com/voxpupuli/puppet-augeas/pull/92) ([smortex](https://github.com/smortex)) 23 | 24 | **Closed issues:** 25 | 26 | - Migrating this Repository to Vox Pupuli [\#96](https://github.com/voxpupuli/puppet-augeas/issues/96) 27 | - Debian 12 support [\#95](https://github.com/voxpupuli/puppet-augeas/issues/95) 28 | - Puppet 8x support [\#94](https://github.com/voxpupuli/puppet-augeas/issues/94) 29 | - puppetserver 7 warning: file does not contain a valid yaml hash [\#91](https://github.com/voxpupuli/puppet-augeas/issues/91) 30 | - Avoid "file does not contain a valid yaml hash" warning for puppetserver [\#86](https://github.com/voxpupuli/puppet-augeas/issues/86) 31 | - $lens\_dir is not set correctly for systems using the official Debian puppet packages [\#65](https://github.com/voxpupuli/puppet-augeas/issues/65) 32 | 33 | **Merged pull requests:** 34 | 35 | - drop support for EoL Puppet Enterprise \(pe\) [\#107](https://github.com/voxpupuli/puppet-augeas/pull/107) ([jhoblitt](https://github.com/jhoblitt)) 36 | - .fixtures.yml: pull dependencies from GitHub [\#102](https://github.com/voxpupuli/puppet-augeas/pull/102) ([bastelfreak](https://github.com/bastelfreak)) 37 | - Handle lense\_dir based on $::rubysitedir. [\#87](https://github.com/voxpupuli/puppet-augeas/pull/87) ([bzed](https://github.com/bzed)) 38 | - Fix PuppetServer warning [\#85](https://github.com/voxpupuli/puppet-augeas/pull/85) ([smortex](https://github.com/smortex)) 39 | - Allow customizing files owner and group [\#84](https://github.com/voxpupuli/puppet-augeas/pull/84) ([smortex](https://github.com/smortex)) 40 | - Add FreeBSD support [\#82](https://github.com/voxpupuli/puppet-augeas/pull/82) ([smortex](https://github.com/smortex)) 41 | - Resolve puppet-lint [\#81](https://github.com/voxpupuli/puppet-augeas/pull/81) ([jcpunk](https://github.com/jcpunk)) 42 | - Now passes yamllint [\#80](https://github.com/voxpupuli/puppet-augeas/pull/80) ([jcpunk](https://github.com/jcpunk)) 43 | - Ensure versioncmp 'a' parameter is a string [\#70](https://github.com/voxpupuli/puppet-augeas/pull/70) ([raoulbhatia](https://github.com/raoulbhatia)) 44 | 45 | ## [1.9.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.9.0) (2020-01-08) 46 | 47 | - Support Archlinux osfamily (GH #74) 48 | - Convert to PDK (GH #76) 49 | - Port augeas() function to Puppet 4.x API (GH #77) 50 | 51 | ## [1.8.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.8.0) (2019-07-23) 52 | 53 | - Allow Puppet 6 and remove stdlib dependency (GH #73) 54 | 55 | ## [1.7.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.7.0) (2018-09-03) 56 | 57 | - Remove pe requirements 58 | - Use cwd to make commands shorter (GH #63) 59 | - Assert types (GH #64) 60 | - Fix beaker version to 3.13 61 | - Fix stdlib dependency (GH #72) 62 | 63 | ## [1.6.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.6.1) (2017-03-31) 64 | 65 | - Update versions in tests 66 | - Linting 67 | 68 | ## [1.6.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.6.0) (2017-01-09) 69 | 70 | - Deprecate Puppet 2 and 3 71 | 72 | ## [1.5.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.5.1) (2016-08-19) 73 | 74 | - Fix Travis CI tests 75 | 76 | ## [1.5.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.5.0) (2016-08-18) 77 | 78 | - Use Augeas PPA for Travis CI tests 79 | - Include augeas 'super' class when not declared (fix #93) 80 | 81 | ## [1.4.2](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.4.2) (2015-09-09) 82 | 83 | Fix for puppet AIO packaging 84 | 85 | ## [1.4.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.4.1) (2015-08-31) 86 | 87 | Fix use of is_pe fact for Puppet open-source 88 | 89 | ## [1.4.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.4.0) (2015-08-31) 90 | 91 | Add support for Puppet Enterprise paths 92 | 93 | ## [1.3.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.3.1) (2015-08-21) 94 | 95 | Use docker for acceptance tests 96 | 97 | ## [1.3.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.3.0) (2015-08-12) 98 | 99 | Add puppet AIO packaging support 100 | Allow setting package name of ruby augeas bindings 101 | Add support for Amazon Linux AMI 102 | 103 | ## [1.2.13](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.13) (2015-06-26) 104 | 105 | Fix strict_variables activation with rspec-puppet 2.2 106 | 107 | ## [1.2.12](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.12) (2015-06-24) 108 | 109 | fix the ruby-augeas gem installation on SLES and openSUSE 110 | 111 | ## [1.2.11](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.11) (2015-05-28) 112 | 113 | Add beaker_spec_helper to Gemfile 114 | 115 | ## [1.2.10](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.10) (2015-05-26) 116 | 117 | Use random application order in nodeset 118 | 119 | ## [1.2.9](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.9) (2015-05-26) 120 | 121 | add utopic & vivid nodesets 122 | 123 | ## [1.2.8](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.8) (2015-05-25) 124 | 125 | Don't allow failure on Puppet 4 126 | 127 | ## [1.2.7](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.7) (2015-05-13) 128 | 129 | Fix source_without_rights warning 130 | 131 | ## [1.2.6](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.6) (2015-05-13) 132 | 133 | Add puppet-lint-file_source_rights-check gem 134 | 135 | ## [1.2.5](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.5) (2015-05-12) 136 | 137 | Don't pin beaker 138 | 139 | ## [1.2.4](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.4) (2015-04-27) 140 | 141 | Add nodeset ubuntu-12.04-x86_64-openstack 142 | 143 | ## [1.2.3](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.3) (2015-04-17) 144 | 145 | - Add beaker nodesets 146 | 147 | ## [1.2.2](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.2) (2015-04-14) 148 | 149 | - Fix lens test with content but no source 150 | 151 | ## [1.2.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.1) (2015-04-03) 152 | 153 | - Confine rspec pinning to ruby 1.8 154 | 155 | ## [1.2.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.0) (2015-03-24) 156 | 157 | - Add lens_content and test_content to augeas::lens 158 | - Fix augeas() function 159 | 160 | ## [1.1.7](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.1.7) (2015-03-24) 161 | 162 | - Fix for SUSE 163 | 164 | ## [1.1.6](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.1.6) (2015-01-19) 165 | 166 | - Add puppet-ling plugins 167 | 168 | ## [1.1.5](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.1.5) (2015-01-12) 169 | 170 | - Fix LICENSE file 171 | - Add some puppet-lint plugins to Gemfile 172 | 173 | ## [1.1.4](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.1.4) (2015-01-07) 174 | 175 | - Manage unit tests with rspec-puppet-facts 176 | 177 | ## [1.1.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.1.0) (2014-12-09) 178 | 179 | - Add future parser tests 180 | - Convert specs to rspec3 syntax 181 | - Fix metadata.json 182 | 183 | ## [1.0.3](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.0.3) (2014-11-17) 184 | 185 | - Lint metadata.json 186 | 187 | ## [1.0.2](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.0.2) (2014-11-04) 188 | 189 | - Fix path in unit tests 190 | - Drop Puppet 2.7 support 191 | 192 | ## [1.0.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.0.1) (2014-10-28) 193 | - Add path to exec in augeas::lens 194 | 195 | ## [1.0.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.0.0) (2014-10-20) 196 | - Linting 197 | - Setup automatic Forge releases 198 | 199 | ## [0.3.2](https://github.com/voxpupuli/puppet-augeas/releases/tag/0.3.2) (2014-10-06) 200 | - Remove symlink in spec/ directory (Fix #40) 201 | 202 | ## [0.3.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/0.3.1) (2014-09-23) 203 | - Centralize metadata files 204 | 205 | ## [0.3.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/0.3.0) (2014-07-02) 206 | ###Summary 207 | - Add purge parameter 208 | - Cleanup unscoped variables 209 | 210 | 211 | \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* 212 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | source ENV['GEM_SOURCE'] || 'https://rubygems.org' 5 | 6 | group :test do 7 | gem 'voxpupuli-test', '~> 10.0', :require => false 8 | gem 'puppet_metadata', '~> 5.0', :require => false 9 | gem 'ruby-augeas', :require => false 10 | end 11 | 12 | group :development do 13 | gem 'guard-rake', :require => false 14 | gem 'overcommit', '>= 0.39.1', :require => false 15 | end 16 | 17 | group :system_tests do 18 | gem 'voxpupuli-acceptance', '~> 3.5', :require => false 19 | end 20 | 21 | group :release do 22 | gem 'voxpupuli-release', '~> 3.0', :require => false 23 | end 24 | 25 | gem 'rake', :require => false 26 | gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] 27 | 28 | puppetversion = ENV['PUPPET_GEM_VERSION'] || [">= 7.24", "< 9"] 29 | gem 'puppet', puppetversion, :require => false, :groups => [:test] 30 | 31 | # vim: syntax=ruby 32 | -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | ## [1.9.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.9.0) (2020-01-08) 2 | 3 | - Support Archlinux osfamily (GH #74) 4 | - Convert to PDK (GH #76) 5 | - Port augeas() function to Puppet 4.x API (GH #77) 6 | 7 | ## [1.8.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.8.0) (2019-07-23) 8 | 9 | - Allow Puppet 6 and remove stdlib dependency (GH #73) 10 | 11 | ## [1.7.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.7.0) (2018-09-03) 12 | 13 | - Remove pe requirements 14 | - Use cwd to make commands shorter (GH #63) 15 | - Assert types (GH #64) 16 | - Fix beaker version to 3.13 17 | - Fix stdlib dependency (GH #72) 18 | 19 | ## [1.6.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.6.1) (2017-03-31) 20 | 21 | - Update versions in tests 22 | - Linting 23 | 24 | ## [1.6.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.6.0) (2017-01-09) 25 | 26 | - Deprecate Puppet 2 and 3 27 | 28 | ## [1.5.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.5.1) (2016-08-19) 29 | 30 | - Fix Travis CI tests 31 | 32 | ## [1.5.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.5.0) (2016-08-18) 33 | 34 | - Use Augeas PPA for Travis CI tests 35 | - Include augeas 'super' class when not declared (fix #93) 36 | 37 | ## [1.4.2](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.4.2) (2015-09-09) 38 | 39 | Fix for puppet AIO packaging 40 | 41 | ## [1.4.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.4.1) (2015-08-31) 42 | 43 | Fix use of is_pe fact for Puppet open-source 44 | 45 | ## [1.4.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.4.0) (2015-08-31) 46 | 47 | Add support for Puppet Enterprise paths 48 | 49 | ## [1.3.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.3.1) (2015-08-21) 50 | 51 | Use docker for acceptance tests 52 | 53 | ## [1.3.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.3.0) (2015-08-12) 54 | 55 | Add puppet AIO packaging support 56 | Allow setting package name of ruby augeas bindings 57 | Add support for Amazon Linux AMI 58 | 59 | ## [1.2.13](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.13) (2015-06-26) 60 | 61 | Fix strict_variables activation with rspec-puppet 2.2 62 | 63 | ## [1.2.12](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.12) (2015-06-24) 64 | 65 | fix the ruby-augeas gem installation on SLES and openSUSE 66 | 67 | ## [1.2.11](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.11) (2015-05-28) 68 | 69 | Add beaker_spec_helper to Gemfile 70 | 71 | ## [1.2.10](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.10) (2015-05-26) 72 | 73 | Use random application order in nodeset 74 | 75 | ## [1.2.9](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.9) (2015-05-26) 76 | 77 | add utopic & vivid nodesets 78 | 79 | ## [1.2.8](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.8) (2015-05-25) 80 | 81 | Don't allow failure on Puppet 4 82 | 83 | ## [1.2.7](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.7) (2015-05-13) 84 | 85 | Fix source_without_rights warning 86 | 87 | ## [1.2.6](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.6) (2015-05-13) 88 | 89 | Add puppet-lint-file_source_rights-check gem 90 | 91 | ## [1.2.5](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.5) (2015-05-12) 92 | 93 | Don't pin beaker 94 | 95 | ## [1.2.4](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.4) (2015-04-27) 96 | 97 | Add nodeset ubuntu-12.04-x86_64-openstack 98 | 99 | ## [1.2.3](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.3) (2015-04-17) 100 | 101 | - Add beaker nodesets 102 | 103 | ## [1.2.2](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.2) (2015-04-14) 104 | 105 | - Fix lens test with content but no source 106 | 107 | ## [1.2.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.1) (2015-04-03) 108 | 109 | - Confine rspec pinning to ruby 1.8 110 | 111 | ## [1.2.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.2.0) (2015-03-24) 112 | 113 | - Add lens_content and test_content to augeas::lens 114 | - Fix augeas() function 115 | 116 | ## [1.1.7](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.1.7) (2015-03-24) 117 | 118 | - Fix for SUSE 119 | 120 | ## [1.1.6](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.1.6) (2015-01-19) 121 | 122 | - Add puppet-ling plugins 123 | 124 | ## [1.1.5](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.1.5) (2015-01-12) 125 | 126 | - Fix LICENSE file 127 | - Add some puppet-lint plugins to Gemfile 128 | 129 | ## [1.1.4](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.1.4) (2015-01-07) 130 | 131 | - Manage unit tests with rspec-puppet-facts 132 | 133 | ## [1.1.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.1.0) (2014-12-09) 134 | 135 | - Add future parser tests 136 | - Convert specs to rspec3 syntax 137 | - Fix metadata.json 138 | 139 | ## [1.0.3](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.0.3) (2014-11-17) 140 | 141 | - Lint metadata.json 142 | 143 | ## [1.0.2](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.0.2) (2014-11-04) 144 | 145 | - Fix path in unit tests 146 | - Drop Puppet 2.7 support 147 | 148 | ## [1.0.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.0.1) (2014-10-28) 149 | - Add path to exec in augeas::lens 150 | 151 | ## [1.0.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/1.0.0) (2014-10-20) 152 | - Linting 153 | - Setup automatic Forge releases 154 | 155 | ## [0.3.2](https://github.com/voxpupuli/puppet-augeas/releases/tag/0.3.2) (2014-10-06) 156 | - Remove symlink in spec/ directory (Fix #40) 157 | 158 | ## [0.3.1](https://github.com/voxpupuli/puppet-augeas/releases/tag/0.3.1) (2014-09-23) 159 | - Centralize metadata files 160 | 161 | ## [0.3.0](https://github.com/voxpupuli/puppet-augeas/releases/tag/0.3.0) (2014-07-02) 162 | ###Summary 163 | - Add purge parameter 164 | - Cleanup unscoped variables 165 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Augeas Puppet module 2 | 3 | [![Puppet Forge Version](http://img.shields.io/puppetforge/v/camptocamp/augeas.svg)](https://forge.puppetlabs.com/camptocamp/augeas) 4 | [![Puppet Forge Downloads](http://img.shields.io/puppetforge/dt/camptocamp/augeas.svg)](https://forge.puppetlabs.com/camptocamp/augeas) 5 | [![Build Status](https://img.shields.io/travis/camptocamp/puppet-augeas/master.svg)](https://travis-ci.org/camptocamp/puppet-augeas) 6 | [![Gemnasium](https://img.shields.io/gemnasium/camptocamp/puppet-augeas.svg)](https://gemnasium.com/camptocamp/puppet-augeas) 7 | [![By Camptocamp](https://img.shields.io/badge/by-camptocamp-fb7047.svg)](http://www.camptocamp.com) 8 | 9 | **Install and configure Augeas.** 10 | 11 | This module is provided by [Camptocamp](http://www.camptocamp.com/) 12 | 13 | ## Usage 14 | 15 | Simple usage: 16 | 17 | include augeas 18 | 19 | ### Classes 20 | 21 | The module provides an `augeas` class which installs and configures Augeas. 22 | 23 | 24 | * lets you force the augeas version by defining `$augeas_version`, otherwise puppet will 25 | only ensure the packages are present; 26 | * lets you force the ruby library version by defining `$augeas_ruby_version`, otherwise puppet will 27 | only ensure the libaugeas-ruby version will be installed according to internal critera; 28 | * provides an `augeas()` master-side function to manipulate strings using Augeas; 29 | 30 | Note: the `augeas` class realizes all `augeas` resources in order to ensure they are managed after the required Augeas packages. 31 | 32 | 33 | ### Definitions 34 | 35 | #### `augeas::lens` 36 | 37 | The `augeas::lens` definition allows you to deploy an Augeas lens and any associated test files, running unit tests and not installing if they fail: 38 | 39 | Parameters: 40 | 41 | - *ensure*: present/absent 42 | - *lens_content*: the content of the lens 43 | - *lens_source*: deprecated, the source for the lens 44 | - *test_content*: optionally, the content of the test file 45 | - *test_source*: deprecated, the source for the test file. 46 | - *stock_since*: optionally, indicate in which version of Augeas 47 | the lens became stock, so it will not be deployed above that version. 48 | 49 | Example usage: 50 | 51 | ```puppet 52 | augeas::lens { 'networkmanager': 53 | lens_content => file('networkmanager/lenses/networkmanager.aug'), 54 | test_content => file('networkmanager/lenses/test_networkmanager.aug'), 55 | stock_since => '1.0.0', 56 | } 57 | ``` 58 | 59 | ### Functions 60 | 61 | #### `augeas()` 62 | 63 | Modifies a string using Augeas. 64 | 65 | *Example:* 66 | 67 | augeas("proc /proc proc nodev,noexec,nosuid 0 0\n", 'Fstab.lns', ['rm ./1/opt[3]']) 68 | 69 | Would result in: 70 | 71 | "proc /proc proc nodev,noexec 0 0\n" 72 | 73 | 74 | - *Type*: rvalue 75 | 76 | ## Contributing 77 | 78 | Please report bugs and feature request using [GitHub issue 79 | tracker](https://github.com/camptocamp/puppet-augeas/issues). 80 | 81 | For pull requests, it is very much appreciated to check your Puppet manifest 82 | with [puppet-lint](https://github.com/camptocamp/puppet-augeas/issues) to follow the recommended Puppet style guidelines from the 83 | [Puppet Labs style guide](http://docs.puppetlabs.com/guides/style_guide.html). 84 | -------------------------------------------------------------------------------- /REFERENCE.md: -------------------------------------------------------------------------------- 1 | # Reference 2 | 3 | 4 | 5 | ## Table of Contents 6 | 7 | ### Classes 8 | 9 | * [`augeas`](#augeas): Class: augeas Install and configure Augeas Parameters: ['lens_dir'] - the lens directory to use ['purge'] - whether to purge 10 | * [`augeas::files`](#augeas--files): Class: augeas::files Sets up directories and files for Augeas 11 | 12 | ### Defined types 13 | 14 | * [`augeas::lens`](#augeas--lens): Definition: augeas::lens Deploy an Augeas lens (and its test file). Check the lens (and run the unit tests) automatically and remove the fil 15 | 16 | ### Functions 17 | 18 | * [`augeas`](#augeas): Modifies a string using Augeas. 19 | * [`augeas::lens_dir`](#augeas--lens_dir): function to return augeas lens directory 20 | 21 | ## Classes 22 | 23 | ### `augeas` 24 | 25 | Class: augeas 26 | 27 | Install and configure Augeas 28 | 29 | Parameters: 30 | ['lens_dir'] - the lens directory to use 31 | ['purge'] - whether to purge lens directories 32 | 33 | #### Parameters 34 | 35 | The following parameters are available in the `augeas` class: 36 | 37 | * [`aio_lens_dir`](#-augeas--aio_lens_dir) 38 | * [`system_lens_dir`](#-augeas--system_lens_dir) 39 | * [`files_owner`](#-augeas--files_owner) 40 | * [`files_group`](#-augeas--files_group) 41 | * [`lens_dir`](#-augeas--lens_dir) 42 | * [`purge`](#-augeas--purge) 43 | 44 | ##### `aio_lens_dir` 45 | 46 | Data type: `Stdlib::Absolutepath` 47 | 48 | 49 | 50 | ##### `system_lens_dir` 51 | 52 | Data type: `Stdlib::Absolutepath` 53 | 54 | 55 | 56 | ##### `files_owner` 57 | 58 | Data type: `String` 59 | 60 | 61 | 62 | Default value: `'root'` 63 | 64 | ##### `files_group` 65 | 66 | Data type: `String` 67 | 68 | 69 | 70 | Default value: `'root'` 71 | 72 | ##### `lens_dir` 73 | 74 | Data type: `Optional[Stdlib::Absolutepath]` 75 | 76 | 77 | 78 | Default value: `undef` 79 | 80 | ##### `purge` 81 | 82 | Data type: `Boolean` 83 | 84 | 85 | 86 | Default value: `true` 87 | 88 | ### `augeas::files` 89 | 90 | Class: augeas::files 91 | 92 | Sets up directories and files for Augeas 93 | 94 | ## Defined types 95 | 96 | ### `augeas::lens` 97 | 98 | Definition: augeas::lens 99 | 100 | Deploy an Augeas lens (and its test file). 101 | Check the lens (and run the unit tests) automatically and remove the files if 102 | the checks fail. 103 | 104 | Parameters: 105 | ['ensure'] - present/absent 106 | ['lens_content'] - the content of the lens 107 | ['lens_source'] - the source for the lens 108 | ['test_content'] - optionally, the content of the test 109 | ['test_source'] - optionally, the source for the test file. 110 | ['stock_since'] - optionally, indicate in which version of Augeas 111 | the lens became stock, so it will not be deployed 112 | above that version. 113 | 114 | Example usage: 115 | 116 | augeas::lens { 'networkmanager': 117 | lens_content => file('networkmanager/lenses/networkmanager.aug'), 118 | test_content => file('networkmanager/lenses/test_networkmanager.aug'), 119 | stock_since => '1.0.0', 120 | } 121 | 122 | #### Parameters 123 | 124 | The following parameters are available in the `augeas::lens` defined type: 125 | 126 | * [`ensure`](#-augeas--lens--ensure) 127 | * [`lens_content`](#-augeas--lens--lens_content) 128 | * [`lens_source`](#-augeas--lens--lens_source) 129 | * [`test_content`](#-augeas--lens--test_content) 130 | * [`test_source`](#-augeas--lens--test_source) 131 | * [`stock_since`](#-augeas--lens--stock_since) 132 | 133 | ##### `ensure` 134 | 135 | Data type: `Any` 136 | 137 | 138 | 139 | Default value: `present` 140 | 141 | ##### `lens_content` 142 | 143 | Data type: `Any` 144 | 145 | 146 | 147 | Default value: `undef` 148 | 149 | ##### `lens_source` 150 | 151 | Data type: `Any` 152 | 153 | 154 | 155 | Default value: `undef` 156 | 157 | ##### `test_content` 158 | 159 | Data type: `Any` 160 | 161 | 162 | 163 | Default value: `undef` 164 | 165 | ##### `test_source` 166 | 167 | Data type: `Any` 168 | 169 | 170 | 171 | Default value: `undef` 172 | 173 | ##### `stock_since` 174 | 175 | Data type: `Any` 176 | 177 | 178 | 179 | Default value: `false` 180 | 181 | ## Functions 182 | 183 | ### `augeas` 184 | 185 | Type: Ruby 4.x API 186 | 187 | *Example:* 188 | 189 | augeas("proc /proc proc nodev,noexec,nosuid 0 0 190 | ", 'Fstab.lns', ['rm ./1/opt[3]']) 191 | 192 | Would result in: 193 | 194 | "proc /proc proc nodev,noexec 0 0 195 | " 196 | 197 | #### `augeas(String $content, String $lens, Array[String] $changes)` 198 | 199 | *Example:* 200 | 201 | augeas("proc /proc proc nodev,noexec,nosuid 0 0 202 | ", 'Fstab.lns', ['rm ./1/opt[3]']) 203 | 204 | Would result in: 205 | 206 | "proc /proc proc nodev,noexec 0 0 207 | " 208 | 209 | Returns: `String` The resulting string. 210 | 211 | ##### `content` 212 | 213 | Data type: `String` 214 | 215 | The string to modify. 216 | 217 | ##### `lens` 218 | 219 | Data type: `String` 220 | 221 | The lens to use for parsing. 222 | 223 | ##### `changes` 224 | 225 | Data type: `Array[String]` 226 | 227 | An array of changes to apply to the string. 228 | 229 | ### `augeas::lens_dir` 230 | 231 | Type: Puppet Language 232 | 233 | function to return augeas lens directory 234 | 235 | #### `augeas::lens_dir()` 236 | 237 | The augeas::lens_dir function. 238 | 239 | Returns: `String` 240 | 241 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Managed by modulesync - DO NOT EDIT 2 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 3 | 4 | # Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), 5 | # otherwise attempt to load it directly. 6 | begin 7 | require 'voxpupuli/test/rake' 8 | rescue LoadError 9 | begin 10 | require 'puppetlabs_spec_helper/rake_tasks' 11 | rescue LoadError 12 | end 13 | end 14 | 15 | # load optional tasks for acceptance 16 | # only available if gem group releases is installed 17 | begin 18 | require 'voxpupuli/acceptance/rake' 19 | rescue LoadError 20 | end 21 | 22 | # load optional tasks for releases 23 | # only available if gem group releases is installed 24 | begin 25 | require 'voxpupuli/release/rake_tasks' 26 | rescue LoadError 27 | # voxpupuli-release not present 28 | else 29 | GCGConfig.user = 'voxpupuli' 30 | GCGConfig.project = 'puppet-augeas' 31 | end 32 | 33 | desc "Run main 'test' task and report merged results to coveralls" 34 | task test_with_coveralls: [:test] do 35 | if Dir.exist?(File.expand_path('../lib', __FILE__)) 36 | require 'coveralls/rake/task' 37 | Coveralls::RakeTask.new 38 | Rake::Task['coveralls:push'].invoke 39 | else 40 | puts 'Skipping reporting to coveralls. Module has no lib dir' 41 | end 42 | end 43 | 44 | # vim: syntax=ruby 45 | -------------------------------------------------------------------------------- /data/common.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | augeas::aio_lens_dir: /opt/puppetlabs/puppet/share/augeas/lenses 3 | augeas::system_lens_dir: /usr/share/augeas/lenses 4 | -------------------------------------------------------------------------------- /data/os/FreeBSD.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | augeas::files_group: "wheel" 3 | augeas::system_lens_dir: /usr/local/share/augeas/lenses 4 | -------------------------------------------------------------------------------- /functions/lens_dir.pp: -------------------------------------------------------------------------------- 1 | # @summary function to return augeas lens directory 2 | # 3 | # @return [String] 4 | function augeas::lens_dir() >> String { 5 | if $augeas::lens_dir { 6 | $augeas::lens_dir 7 | } elsif 'aio_agent_version' in $facts { 8 | $augeas::aio_lens_dir 9 | } else { 10 | $augeas::system_lens_dir 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /hiera.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 5 3 | 4 | defaults: # Used for any hierarchy level that omits these keys. 5 | datadir: data # This path is relative to hiera.yaml's directory. 6 | data_hash: yaml_data # Use the built-in YAML backend. 7 | 8 | hierarchy: 9 | - name: "osfamily/major release" 10 | paths: 11 | - "os/%{facts.os.family}/%{facts.os.release.major}.yaml" 12 | # Used for Solaris 13 | - "os/%{facts.os.family}/%{facts.kernelrelease}.yaml" 14 | # Used to distinguish between Debian and Ubuntu 15 | - "os/%{facts.os.name}/%{facts.os.release.major}.yaml" 16 | - name: "osfamily" 17 | paths: 18 | - "os/%{facts.os.family}.yaml" 19 | - "os/%{facts.os.name}.yaml" 20 | - name: 'common' 21 | path: 'common.yaml' 22 | -------------------------------------------------------------------------------- /lib/puppet/functions/augeas.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # @summary 4 | # Modifies a string using Augeas. 5 | # 6 | # *Example:* 7 | # 8 | # augeas("proc /proc proc nodev,noexec,nosuid 0 0 9 | # ", 'Fstab.lns', ['rm ./1/opt[3]']) 10 | # 11 | # Would result in: 12 | # 13 | # "proc /proc proc nodev,noexec 0 0 14 | # " 15 | # 16 | Puppet::Functions.create_function(:augeas) do 17 | # @param content 18 | # The string to modify. 19 | # 20 | # @param lens 21 | # The lens to use for parsing. 22 | # 23 | # @param changes 24 | # An array of changes to apply to the string. 25 | # 26 | # @return [String] 27 | # The resulting string. 28 | # 29 | dispatch :apply_changes do 30 | param 'String', :content 31 | param 'String', :lens 32 | param 'Array[String]', :changes 33 | end 34 | 35 | def apply_changes(content, lens, changes) 36 | raise Puppet::ParseError, 'augeas(): this function requires the augeas feature. See http://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Augeas#Pre-requisites for how to activate it.' unless Puppet.features.augeas? 37 | 38 | require 'augeas' 39 | aug = Augeas.open(nil, nil, Augeas::NO_MODL_AUTOLOAD) 40 | augeas_version = aug.get('/augeas/version') 41 | raise(Puppet::ParseError, 'augeas(): requires Augeas 1.0.0 or greater') unless Puppet::Util::Package.versioncmp(augeas_version, '1.0.0') >= 0 42 | raise(Puppet::ParseError, 'augeas(): requires ruby-augeas 0.5.0 or greater') unless aug.methods.include?(:text_store) 43 | 44 | result = nil 45 | begin 46 | aug.set('/input', content) 47 | aug.text_store(lens, '/input', '/store') 48 | unless aug.match('/augeas/text/store//error').empty? 49 | error = aug.get('/augeas/text/store//error/message') 50 | raise Puppet::ParseError, "augeas(): Failed to parse string with lens #{lens}: #{error}" 51 | end 52 | 53 | # Apply changes 54 | aug.context = '/store' 55 | changes.each do |c| 56 | r = aug.srun(c) 57 | raise Puppet::ParseError, 'augeas(): Failed to apply change to tree' unless r && r[0] >= 0 58 | end 59 | unless aug.text_retrieve(lens, '/input', '/store', '/output') 60 | error = aug.get('/augeas/text/store//error/message') 61 | raise Puppet::ParseError, "augeas(): Failed to apply changes with lens #{lens}: #{error}" 62 | end 63 | result = aug.get('/output') 64 | ensure 65 | aug.close 66 | end 67 | result 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /manifests/files.pp: -------------------------------------------------------------------------------- 1 | # Class: augeas::files 2 | # 3 | # Sets up directories and files for Augeas 4 | # 5 | class augeas::files { 6 | include augeas 7 | 8 | $lens_dir = augeas::lens_dir() 9 | 10 | # ensure no file not managed by puppet ends up in there. 11 | file { $lens_dir: 12 | ensure => directory, 13 | purge => $augeas::purge, 14 | force => true, 15 | recurse => true, 16 | recurselimit => 1, 17 | mode => '0644', 18 | owner => $augeas::files_owner, 19 | group => $augeas::files_group, 20 | } 21 | 22 | file { "${lens_dir}/dist": 23 | ensure => directory, 24 | purge => false, 25 | mode => '0644', 26 | owner => $augeas::files_owner, 27 | group => $augeas::files_group, 28 | } 29 | 30 | file { "${lens_dir}/tests": 31 | ensure => directory, 32 | purge => $augeas::purge, 33 | force => true, 34 | mode => '0644', 35 | owner => $augeas::files_owner, 36 | group => $augeas::files_group, 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /manifests/init.pp: -------------------------------------------------------------------------------- 1 | # Class: augeas 2 | # 3 | # Install and configure Augeas 4 | # 5 | # Parameters: 6 | # ['lens_dir'] - the lens directory to use 7 | # ['purge'] - whether to purge lens directories 8 | class augeas ( 9 | Stdlib::Absolutepath $aio_lens_dir, 10 | Stdlib::Absolutepath $system_lens_dir, 11 | String $files_owner = 'root', 12 | String $files_group = 'root', 13 | Optional[Stdlib::Absolutepath] $lens_dir = undef, 14 | Boolean $purge = true, 15 | ) { 16 | contain 'augeas::files' 17 | } 18 | -------------------------------------------------------------------------------- /manifests/lens.pp: -------------------------------------------------------------------------------- 1 | # Definition: augeas::lens 2 | # 3 | # Deploy an Augeas lens (and its test file). 4 | # Check the lens (and run the unit tests) automatically and remove the files if 5 | # the checks fail. 6 | # 7 | # Parameters: 8 | # ['ensure'] - present/absent 9 | # ['lens_content'] - the content of the lens 10 | # ['lens_source'] - the source for the lens 11 | # ['test_content'] - optionally, the content of the test 12 | # ['test_source'] - optionally, the source for the test file. 13 | # ['stock_since'] - optionally, indicate in which version of Augeas 14 | # the lens became stock, so it will not be deployed 15 | # above that version. 16 | # 17 | # Example usage: 18 | # 19 | # augeas::lens { 'networkmanager': 20 | # lens_content => file('networkmanager/lenses/networkmanager.aug'), 21 | # test_content => file('networkmanager/lenses/test_networkmanager.aug'), 22 | # stock_since => '1.0.0', 23 | # } 24 | # 25 | define augeas::lens ( 26 | $ensure = present, 27 | $lens_content = undef, 28 | $lens_source = undef, 29 | $test_content = undef, 30 | $test_source = undef, 31 | $stock_since = false, 32 | ) { 33 | include augeas 34 | 35 | if $lens_source != undef { 36 | if $lens_content != undef { 37 | fail "You can't set both \$lens_source and \$lens_content" 38 | } else { 39 | warning 'Passing "lens_source" is deprecated; please use "lens_content"' 40 | } 41 | } else { 42 | if $lens_content == undef { 43 | fail "You must set either \$lens_source or \$lens_content" 44 | } 45 | } 46 | 47 | if $test_source != undef { 48 | if $test_content != undef { 49 | fail "You can't set both \$test_source and \$test_content" 50 | } else { 51 | warning 'Passing "test_source" is deprecated; please use "test_content"' 52 | } 53 | } 54 | 55 | File { 56 | owner => $augeas::files_owner, 57 | group => $augeas::files_group, 58 | mode => '0644', 59 | } 60 | 61 | $lens_dir = augeas::lens_dir() 62 | 63 | if (!$stock_since or versioncmp(String($facts['augeas']['version']), $stock_since) < 0) { 64 | $lens_name = "${name}.aug" 65 | $lens_dest = "${lens_dir}/${lens_name}" 66 | $test_name = "tests/test_${name}.aug" 67 | $test_dest = "${lens_dir}/${test_name}" 68 | 69 | # lint:ignore:source_without_rights 70 | file { $lens_dest: 71 | ensure => $ensure, 72 | source => $lens_source, 73 | content => $lens_content, 74 | } 75 | # lint:endignore 76 | 77 | exec { "Typecheck lens ${name}": 78 | command => "augparse -I . ${lens_name} || (rm -f ${lens_name} && exit 1)", 79 | cwd => $lens_dir, 80 | path => "/opt/puppetlabs/puppet/bin:${facts['path']}", 81 | refreshonly => true, 82 | subscribe => File[$lens_dest], 83 | } 84 | 85 | if $test_source or $test_content { 86 | # lint:ignore:source_without_rights 87 | file { $test_dest: 88 | ensure => $ensure, 89 | source => $test_source, 90 | content => $test_content, 91 | notify => Exec["Test lens ${name}"], 92 | } 93 | # lint:endignore 94 | 95 | exec { "Test lens ${name}": 96 | command => "augparse -I . ${test_name} || (rm -f ${lens_name} && rm -f ${test_name}.aug && exit 1)", 97 | cwd => $lens_dir, 98 | path => "/opt/puppetlabs/puppet/bin:${facts['path']}", 99 | refreshonly => true, 100 | subscribe => File[$lens_dest, $test_dest], 101 | } 102 | } 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "puppet-augeas", 3 | "version": "2.0.1-rc0", 4 | "author": "Vox Pupuli", 5 | "summary": "Puppet Augeas module", 6 | "license": "Apache-2.0", 7 | "source": "https://github.com/voxpupuli/puppet-augeas", 8 | "project_page": "https://github.com/voxpupuli/puppet-augeas", 9 | "issues_url": "https://github.com/voxpupuli/puppet-augeas/issues", 10 | "dependencies": [ 11 | { 12 | "name": "puppetlabs/augeas_core", 13 | "version_requirement": ">= 1.0.0 < 2.0.0" 14 | }, 15 | { 16 | "name": "puppetlabs/stdlib", 17 | "version_requirement": ">= 4.13.0 < 10.0.0" 18 | } 19 | ], 20 | "operatingsystem_support": [ 21 | { 22 | "operatingsystem": "Debian", 23 | "operatingsystemrelease": [ 24 | "11", 25 | "12" 26 | ] 27 | }, 28 | { 29 | "operatingsystem": "Ubuntu", 30 | "operatingsystemrelease": [ 31 | "20.04", 32 | "22.04", 33 | "24.04" 34 | ] 35 | }, 36 | { 37 | "operatingsystem": "RedHat", 38 | "operatingsystemrelease": [ 39 | "9" 40 | ] 41 | }, 42 | { 43 | "operatingsystem": "Archlinux" 44 | }, 45 | { 46 | "operatingsystem": "FreeBSD", 47 | "operatingsystemrelease": [ 48 | "13", 49 | "14" 50 | ] 51 | } 52 | ], 53 | "requirements": [ 54 | { 55 | "name": "puppet", 56 | "version_requirement": ">= 7.0.0 < 9.0.0" 57 | }, 58 | { 59 | "name": "openvox", 60 | "version_requirement": ">= 7.0.0 < 9.0.0" 61 | } 62 | ] 63 | } 64 | -------------------------------------------------------------------------------- /spec/acceptance/init_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper_acceptance' 4 | 5 | describe 'augeas class' do 6 | context 'with default parameters' do 7 | it_behaves_like 'an idempotent resource' do 8 | let(:manifest) do 9 | <<~PUPPET 10 | class { 'augeas': 11 | } 12 | PUPPET 13 | end 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/classes/augeas_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'augeas' do 6 | let(:lens_dir) do 7 | case facts[:os]['family'] 8 | when 'FreeBSD' 9 | '/usr/local/share/augeas/lenses' 10 | when 'Archlinux' 11 | '/usr/share/augeas/lenses' 12 | else 13 | if facts[:ruby]['sitedir'] =~ %r{/opt/puppetlabs/puppet} 14 | '/opt/puppetlabs/puppet/share/augeas/lenses' 15 | else 16 | '/usr/share/augeas/lenses' 17 | end 18 | end 19 | end 20 | 21 | on_supported_os.each do |os, facts| 22 | context "on #{os}" do 23 | let(:facts) do 24 | facts 25 | end 26 | 27 | context 'without params' do 28 | it { 29 | is_expected.to contain_file(lens_dir).with( 30 | ensure: 'directory', 31 | purge: 'true', 32 | force: 'true', 33 | recurse: 'true', 34 | recurselimit: 1 35 | ) 36 | } 37 | 38 | it { 39 | is_expected.to contain_file("#{lens_dir}/dist").with( 40 | ensure: 'directory', 41 | purge: 'false' 42 | ) 43 | } 44 | 45 | it { 46 | is_expected.to contain_file("#{lens_dir}/tests").with( 47 | ensure: 'directory', 48 | purge: 'true', 49 | force: 'true' 50 | ).without(:recurse) 51 | } 52 | end 53 | 54 | context 'with a non standard lens_dir' do 55 | let(:params) do 56 | { 57 | lens_dir: '/opt/augeas/lenses', 58 | } 59 | end 60 | 61 | it { 62 | is_expected.to contain_file('/opt/augeas/lenses').with( 63 | ensure: 'directory', 64 | purge: 'true', 65 | force: 'true', 66 | recurse: 'true', 67 | recurselimit: 1 68 | ) 69 | } 70 | 71 | it { 72 | is_expected.to contain_file('/opt/augeas/lenses/dist').with( 73 | ensure: 'directory', 74 | purge: 'false' 75 | ) 76 | } 77 | 78 | it { 79 | is_expected.to contain_file('/opt/augeas/lenses/tests').with( 80 | ensure: 'directory', 81 | purge: 'true', 82 | force: 'true' 83 | ).without(:recurse) 84 | } 85 | end 86 | end 87 | end 88 | end 89 | -------------------------------------------------------------------------------- /spec/defines/augeas_lens_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'augeas::lens' do 6 | let(:title) { 'foo' } 7 | 8 | let(:lens_dir) do 9 | case facts[:os]['family'] 10 | when 'FreeBSD' 11 | '/usr/local/share/augeas/lenses' 12 | when 'Archlinux' 13 | '/usr/share/augeas/lenses' 14 | else 15 | if facts[:ruby]['sitedir'] =~ %r{/opt/puppetlabs/puppet} 16 | '/opt/puppetlabs/puppet/share/augeas/lenses' 17 | else 18 | '/usr/share/augeas/lenses' 19 | end 20 | end 21 | end 22 | 23 | context 'when declaring augeas class first' do 24 | on_supported_os.each do |os, facts| 25 | context "on #{os}" do 26 | let(:facts) do 27 | facts 28 | end 29 | 30 | context 'With standard augeas version' do 31 | context 'when no lens_source is passed' do 32 | it 'errors' do 33 | expect { is_expected.to compile }.to raise_error(%r{You must set either \$lens_source or \$lens_content}) 34 | end 35 | end 36 | 37 | context 'when lens_source is passed' do 38 | let(:params) do 39 | { 40 | lens_source: '/tmp/foo.aug', 41 | } 42 | end 43 | 44 | it { is_expected.to contain_file("#{lens_dir}/foo.aug") } 45 | it { is_expected.to contain_exec('Typecheck lens foo') } 46 | it { is_expected.not_to contain_file("#{lens_dir}/tests/test_foo.aug") } 47 | it { is_expected.not_to contain_exec('Test lens foo') } 48 | end 49 | 50 | context 'when lens_source and test_source are passed' do 51 | let(:params) do 52 | { 53 | lens_source: '/tmp/foo.aug', 54 | test_source: '/tmp/test_foo.aug', 55 | } 56 | end 57 | 58 | it { is_expected.to contain_file("#{lens_dir}/foo.aug") } 59 | it { is_expected.to contain_file("#{lens_dir}/tests/test_foo.aug") } 60 | it { is_expected.to contain_exec('Typecheck lens foo') } 61 | it { is_expected.to contain_exec('Test lens foo') } 62 | end 63 | end 64 | 65 | context 'when stock_since is passed and augeas is older' do 66 | let(:params) do 67 | { 68 | lens_source: '/tmp/foo.aug', 69 | stock_since: '1.2.3', 70 | } 71 | end 72 | 73 | let(:facts) do 74 | facts.merge({ 75 | augeas: { version: '1.0.0' }, 76 | augeasversion: '1.0.0' 77 | }) 78 | end 79 | 80 | it { is_expected.to contain_file("#{lens_dir}/foo.aug") } 81 | it { is_expected.to contain_exec('Typecheck lens foo') } 82 | end 83 | 84 | context 'when stock_since is passed and augeas is newer' do 85 | let(:params) do 86 | { 87 | lens_source: '/tmp/foo.aug', 88 | stock_since: '1.2.3', 89 | } 90 | end 91 | 92 | let(:facts) do 93 | facts.merge({ 94 | augeas: { version: '1.3.0' }, 95 | augeasversion: '1.3.0' 96 | }) 97 | end 98 | 99 | it do 100 | is_expected.not_to contain_file("#{lens_dir}/foo.aug") 101 | end 102 | 103 | it do 104 | is_expected.not_to contain_exec('Typecheck lens foo') 105 | end 106 | end 107 | end 108 | end 109 | end 110 | end 111 | -------------------------------------------------------------------------------- /spec/functions/augeas_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | describe 'augeas' do 6 | let(:aug) { Augeas.open(nil, nil, Augeas::NO_MODL_AUTOLOAD) } 7 | 8 | it { is_expected.not_to be_nil } 9 | 10 | it 'fails if the augeas feature is not present' do 11 | allow(Puppet.features).to receive(:augeas?).and_return(false) 12 | is_expected.to run.with_params('', 'Foo.lns', []).and_raise_error(Puppet::ParseError, %r{requires the augeas feature}) 13 | expect(Puppet.features).to have_received(:augeas?) 14 | end 15 | 16 | context 'when passing wrong arguments' do 17 | before do 18 | allow(Puppet.features).to receive(:augeas?).and_return(true) 19 | end 20 | 21 | it 'raises a ParseError if there are no arguments' do 22 | is_expected.to run.with_params([]).and_raise_error(ArgumentError, %r{expects 3 arguments}) 23 | end 24 | 25 | it 'raises a ParseError if content is not a string' do 26 | is_expected.to run.with_params(['foo'], 'Fstab.lns', []).and_raise_error(ArgumentError, %r{expects a String value}) 27 | end 28 | 29 | it 'raises a ParseError if lens is not a string' do 30 | is_expected.to run.with_params('foo', ['Fstab.lns'], []).and_raise_error(ArgumentError, %r{expects a String value}) 31 | end 32 | 33 | it 'raises a ParseError if changes is not an array' do 34 | is_expected.to run.with_params('foo', 'Fstab.lns', 'changes').and_raise_error(ArgumentError, %r{expects an Array value}) 35 | end 36 | end 37 | 38 | if Puppet.features.augeas? 39 | context 'when passing invalid input' do 40 | it 'fails to parse input with lens' do 41 | is_expected.to run.with_params('foo', 'Fstab.lns', []).and_raise_error(Puppet::ParseError, %r{Failed to parse string with lens Fstab.lns:}) 42 | end 43 | end 44 | 45 | context 'when passing illegal changes' do 46 | it 'fails to apply illegal change' do 47 | is_expected.to run.with_params("\n", 'Fstab.lns', ['foo bar']).and_raise_error(Puppet::ParseError, %r{Failed to apply change to tree}) 48 | end 49 | end 50 | 51 | context 'when generating an invalid tree' do 52 | it 'fails to apply changes with wrong tree' do 53 | is_expected.to run.with_params("\n", 'Fstab.lns', ['set ./1/opt 3']).and_raise_error(Puppet::ParseError, %r{Failed to apply changes with lens Fstab.lns:}) 54 | end 55 | end 56 | 57 | context 'when applying valid changes' do 58 | it 'removes the 3rd option' do 59 | is_expected.to run. 60 | with_params("proc /proc proc nodev,noexec,nosuid 0 0\n", 'Fstab.lns', ['rm ./1/opt[3]']). 61 | and_return("proc /proc proc nodev,noexec 0 0\n") 62 | end 63 | 64 | it 'sets a 4th option' do 65 | is_expected.to run. 66 | with_params("proc /proc proc nodev,noexec,nosuid 0 0\n", 'Fstab.lns', ['ins opt after ./1/opt[last()]', 'set ./1/opt[last()] nofoo']). 67 | and_return("proc /proc proc nodev,noexec,nosuid,nofoo 0 0\n") 68 | end 69 | end 70 | 71 | context 'when using old libs' do 72 | it 'does not work with Augeas prior to 1.0.0' do 73 | allow(Augeas).to receive(:open).and_return(aug) 74 | allow(aug).to receive(:get).with('/augeas/version').and_return('0.10.0') 75 | is_expected.to run.with_params("\n", 'Fstab.lns', []).and_raise_error(Puppet::ParseError, %r{requires Augeas 1\.0\.0}) 76 | expect(Augeas).to have_received(:open) 77 | expect(aug).to have_received(:get).with('/augeas/version') 78 | end 79 | 80 | it 'does not work with ruby-augeas prior to 0.5.0' do 81 | allow(Augeas).to receive(:open).and_return(aug) 82 | allow(aug).to receive(:methods).and_return([]) 83 | is_expected.to run.with_params("\n", 'Fstab.lns', []).and_raise_error(Puppet::ParseError, %r{requires ruby-augeas 0\.5\.0}) 84 | expect(Augeas).to have_received(:open) 85 | expect(aug).to have_received(:methods) 86 | end 87 | end 88 | end 89 | end 90 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Managed by modulesync - DO NOT EDIT 4 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 5 | 6 | # puppetlabs_spec_helper will set up coverage if the env variable is set. 7 | # We want to do this if lib exists and it hasn't been explicitly set. 8 | ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) 9 | 10 | require 'voxpupuli/test/spec_helper' 11 | 12 | RSpec.configure do |c| 13 | c.facterdb_string_keys = false 14 | end 15 | 16 | add_mocked_facts! 17 | 18 | if File.exist?(File.join(__dir__, 'default_module_facts.yml')) 19 | facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) 20 | facts&.each do |name, value| 21 | add_custom_fact name.to_sym, value 22 | end 23 | end 24 | Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } 25 | -------------------------------------------------------------------------------- /spec/spec_helper_acceptance.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Managed by modulesync - DO NOT EDIT 4 | # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ 5 | 6 | require 'voxpupuli/acceptance/spec_helper_acceptance' 7 | 8 | configure_beaker(modules: :metadata) 9 | 10 | Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f } 11 | --------------------------------------------------------------------------------