├── .editorconfig ├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .msync.yml ├── .nodeset.yml ├── .overcommit.yml ├── .pmtignore ├── .rspec ├── .rspec_parallel ├── .rubocop.yml ├── .sync.yml ├── .travis.yml ├── .yardopts ├── CHANGELOG.md ├── Dockerfile ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── manifests ├── authfetch.pp ├── fetch.pp └── init.pp ├── metadata.json └── spec ├── acceptance ├── nodesets │ ├── archlinux-2-x64.yml │ ├── centos-65-x64-docker.yml │ ├── centos-65-x64.yml │ ├── debian-7-x64-docker.yml │ ├── debian-7-x64.yml │ ├── debian-73-x64.yml │ ├── default.yml │ ├── ec2 │ │ ├── amazonlinux-2016091.yml │ │ ├── image_templates.yaml │ │ ├── rhel-73-x64.yml │ │ ├── sles-12sp2-x64.yml │ │ ├── ubuntu-1604-x64.yml │ │ └── windows-2016-base-x64.yml │ ├── ubuntu-server-1310-x64.yml │ └── ubuntu-server-1404-x64-docker.yml └── wget_system_spec.rb ├── classes └── init_spec.rb ├── defines ├── authfetch_spec.rb └── fetch_spec.rb ├── fixtures └── hiera.yaml ├── spec_helper.rb └── spec_helper_acceptance.rb /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | 3 | # MANAGED BY MODULESYNC 4 | 5 | root = true 6 | 7 | [*] 8 | charset = utf-8 9 | end_of_line = lf 10 | indent_size = 2 11 | tab_width = 2 12 | indent_style = space 13 | insert_final_newline = true 14 | trim_trailing_whitespace = true 15 | -------------------------------------------------------------------------------- /.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. [travis-ci](http://travis-ci.org) runs 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 | ## Writing proper commits - short version 37 | 38 | * Make commits of logical units. 39 | * Check for unnecessary whitespace with "git diff --check" before committing. 40 | * Commit using Unix line endings (check the settings around "crlf" in git-config(1)). 41 | * Do not check in commented out code or unneeded files. 42 | * 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. 43 | * Associate the issue in the message. The first line should include the issue number in the form "(#XXXX) Rest of message". 44 | * The body should provide a meaningful commit message, which: 45 | *uses the imperative, present tense: `change`, not `changed` or `changes`. 46 | * includes motivation for the change, and contrasts its implementation with the previous behavior. 47 | * Make sure that you have tests for the bug you are fixing, or feature you are adding. 48 | * Make sure the test suites passes after your commit: 49 | * When introducing a new feature, make sure it is properly documented in the README.md 50 | 51 | ## Writing proper commits - long version 52 | 53 | 1. Make separate commits for logically separate changes. 54 | 55 | Please break your commits down into logically consistent units 56 | which include new or changed tests relevant to the rest of the 57 | change. The goal of doing this is to make the diff easier to 58 | read for whoever is reviewing your code. In general, the easier 59 | your diff is to read, the more likely someone will be happy to 60 | review it and get it into the code base. 61 | 62 | If you are going to refactor a piece of code, please do so as a 63 | separate commit from your feature or bug fix changes. 64 | 65 | We also really appreciate changes that include tests to make 66 | sure the bug is not re-introduced, and that the feature is not 67 | accidentally broken. 68 | 69 | Describe the technical detail of the change(s). If your 70 | description starts to get too long, that is a good sign that you 71 | probably need to split up your commit into more finely grained 72 | pieces. 73 | 74 | Commits which plainly describe the things which help 75 | reviewers check the patch and future developers understand the 76 | code are much more likely to be merged in with a minimum of 77 | bike-shedding or requested changes. Ideally, the commit message 78 | would include information, and be in a form suitable for 79 | inclusion in the release notes for the version of Puppet that 80 | includes them. 81 | 82 | Please also check that you are not introducing any trailing 83 | whitespace or other "whitespace errors". You can do this by 84 | running "git diff --check" on your changes before you commit. 85 | 86 | 2. Sending your patches 87 | 88 | To submit your changes via a GitHub pull request, we _highly_ 89 | recommend that you have them on a topic branch, instead of 90 | directly on `master`. 91 | It makes things much easier to keep track of, especially if 92 | you decide to work on another thing before your first change 93 | is merged in. 94 | 95 | GitHub has some pretty good 96 | [general documentation](http://help.github.com/) on using 97 | their site. They also have documentation on 98 | [creating pull requests](http://help.github.com/send-pull-requests/). 99 | 100 | In general, after pushing your topic branch up to your 101 | repository on GitHub, you can switch to the branch in the 102 | GitHub UI and click "Pull Request" towards the top of the page 103 | in order to open a pull request. 104 | 105 | 106 | 3. Update the related GitHub issue. 107 | 108 | If there is a GitHub issue associated with the change you 109 | submitted, then you should update the ticket to include the 110 | location of your branch, along with any other commentary you 111 | may wish to make. 112 | 113 | ## Dependencies 114 | 115 | The testing and development tools have a bunch of dependencies, 116 | all managed by [bundler](http://bundler.io/) according to the 117 | [Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). 118 | 119 | By default the tests use a baseline version of Puppet. 120 | 121 | If you have Ruby 2.x or want a specific version of Puppet, 122 | you must set an environment variable such as: 123 | 124 | ```sh 125 | export PUPPET_VERSION="~> 5.5.6" 126 | ``` 127 | 128 | You can install all needed gems for spec tests into the modules directory by 129 | running: 130 | 131 | ```sh 132 | bundle install --path .vendor/ --without development system_tests release --jobs "$(nproc)" 133 | ``` 134 | 135 | If you also want to run acceptance tests: 136 | 137 | ```sh 138 | bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)" 139 | ``` 140 | 141 | Our all in one solution if you don't know if you need to install or update gems: 142 | 143 | ```sh 144 | bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"; bundle update; bundle clean 145 | ``` 146 | 147 | As an alternative to the `--jobs "$(nproc)` parameter, you can set an 148 | environment variable: 149 | 150 | ```sh 151 | BUNDLE_JOBS="$(nproc)" 152 | ``` 153 | 154 | ### Note for OS X users 155 | 156 | `nproc` isn't a valid command under OS x. As an alternative, you can do: 157 | 158 | ```sh 159 | --jobs "$(sysctl -n hw.ncpu)" 160 | ``` 161 | 162 | ## The test matrix 163 | 164 | ### Syntax and style 165 | 166 | The test suite will run [Puppet Lint](http://puppet-lint.com/) and 167 | [Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to 168 | check various syntax and style things. You can run these locally with: 169 | 170 | ```sh 171 | bundle exec rake lint 172 | bundle exec rake validate 173 | ``` 174 | 175 | It will also run some [Rubocop](http://batsov.com/rubocop/) tests 176 | against it. You can run those locally ahead of time with: 177 | 178 | ```sh 179 | bundle exec rake rubocop 180 | ``` 181 | 182 | ### Running the unit tests 183 | 184 | The unit test suite covers most of the code, as mentioned above please 185 | add tests if you're adding new functionality. If you've not used 186 | [rspec-puppet](http://rspec-puppet.com/) before then feel free to ask 187 | about how best to test your new feature. 188 | 189 | To run the linter, the syntax checker and the unit tests: 190 | 191 | ```sh 192 | bundle exec rake test 193 | ``` 194 | 195 | To run your all the unit tests 196 | 197 | ```sh 198 | bundle exec rake spec 199 | ``` 200 | 201 | To run a specific spec test set the `SPEC` variable: 202 | 203 | ```sh 204 | bundle exec rake spec SPEC=spec/foo_spec.rb 205 | ``` 206 | 207 | #### Unit tests in docker 208 | 209 | Some people don't want to run the dependencies locally or don't want to install 210 | ruby. We ship a Dockerfile that enables you to run all unit tests and linting. 211 | You only need to run: 212 | 213 | ```sh 214 | docker build . 215 | ``` 216 | 217 | Please ensure that a docker daemon is running and that your user has the 218 | permission to talk to it. You can specify a remote docker host by setting the 219 | `DOCKER_HOST` environment variable. it will copy the content of the module into 220 | the docker image. So it will not work if a Gemfile.lock exists. 221 | 222 | ### Integration tests 223 | 224 | The unit tests just check the code runs, not that it does exactly what 225 | we want on a real machine. For that we're using 226 | [beaker](https://github.com/puppetlabs/beaker). 227 | 228 | This fires up a new virtual machine (using vagrant) and runs a series of 229 | simple tests against it after applying the module. You can run this 230 | with: 231 | 232 | ```sh 233 | bundle exec rake acceptance 234 | ``` 235 | 236 | This will run the tests on the module's default nodeset. You can override the 237 | nodeset used, e.g., 238 | 239 | ```sh 240 | BEAKER_set=centos-7-x64 bundle exec rake acceptance 241 | ``` 242 | 243 | There are default rake tasks for the various acceptance test modules, e.g., 244 | 245 | ```sh 246 | bundle exec rake beaker:centos-7-x64 247 | bundle exec rake beaker:ssh:centos-7-x64 248 | ``` 249 | 250 | If you don't want to have to recreate the virtual machine every time you can 251 | use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at 252 | least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the 253 | created virtual machines will be in `.vagrant/beaker_vagrant_files`. 254 | 255 | Beaker also supports docker containers. We also use that in our automated CI 256 | pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant: 257 | 258 | ```sh 259 | PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian10-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker 260 | ``` 261 | 262 | You can replace the string `debian10` with any common operating system. 263 | The following strings are known to work: 264 | 265 | * ubuntu1604 266 | * ubuntu1804 267 | * debian8 268 | * debian9 269 | * debian10 270 | * centos6 271 | * centos7 272 | * centos8 273 | 274 | The easiest way to debug in a docker container is to open a shell: 275 | 276 | ```sh 277 | docker exec -it -u root ${container_id_or_name} bash 278 | ``` 279 | 280 | The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) 281 | repository. 282 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | pkg/ 2 | Gemfile.lock 3 | Gemfile.local 4 | vendor/ 5 | .vendor/ 6 | spec/fixtures/manifests/ 7 | spec/fixtures/modules/ 8 | .vagrant/ 9 | .bundle/ 10 | .ruby-version 11 | coverage/ 12 | log/ 13 | .idea/ 14 | .dependencies/ 15 | .librarian/ 16 | Puppetfile.lock 17 | *.iml 18 | .*.sw? 19 | .yardoc/ 20 | Guardfile 21 | -------------------------------------------------------------------------------- /.msync.yml: -------------------------------------------------------------------------------- 1 | modulesync_config_version: '2.12.0' 2 | -------------------------------------------------------------------------------- /.nodeset.yml: -------------------------------------------------------------------------------- 1 | default_set: 'centos-64-x64' 2 | sets: 3 | 'centos-64-x64': 4 | nodes: 5 | "main.foo.vm": 6 | prefab: 'centos-64-x64' 7 | 'debian-70rc1-x64': 8 | nodes: 9 | "main": 10 | prefab: 'debian-70rc1-x64' 11 | -------------------------------------------------------------------------------- /.overcommit.yml: -------------------------------------------------------------------------------- 1 | # Managed by https://github.com/voxpupuli/modulesync_configs 2 | # 3 | # Hooks are only enabled if you take action. 4 | # 5 | # To enable the hooks run: 6 | # 7 | # ``` 8 | # bundle exec overcommit --install 9 | # # ensure .overcommit.yml does not harm to you and then 10 | # bundle exec overcommit --sign 11 | # ``` 12 | # 13 | # (it will manage the .git/hooks directory): 14 | # 15 | # Examples howto skip a test for a commit or push: 16 | # 17 | # ``` 18 | # SKIP=RuboCop git commit 19 | # SKIP=PuppetLint git commit 20 | # SKIP=RakeTask git push 21 | # ``` 22 | # 23 | # Don't invoke overcommit at all: 24 | # 25 | # ``` 26 | # OVERCOMMIT_DISABLE=1 git commit 27 | # ``` 28 | # 29 | # Read more about overcommit: https://github.com/brigade/overcommit 30 | # 31 | # To manage this config yourself in your module add 32 | # 33 | # ``` 34 | # .overcommit.yml: 35 | # unmanaged: true 36 | # ``` 37 | # 38 | # to your modules .sync.yml config 39 | --- 40 | PreCommit: 41 | RuboCop: 42 | enabled: true 43 | description: 'Runs rubocop on modified files only' 44 | command: ['bundle', 'exec', 'rubocop'] 45 | PuppetLint: 46 | enabled: true 47 | description: 'Runs puppet-lint on modified files only' 48 | command: ['bundle', 'exec', 'puppet-lint'] 49 | YamlSyntax: 50 | enabled: true 51 | JsonSyntax: 52 | enabled: true 53 | TrailingWhitespace: 54 | enabled: true 55 | 56 | PrePush: 57 | RakeTarget: 58 | enabled: true 59 | description: 'Run rake targets' 60 | targets: 61 | - 'validate' 62 | - 'test' 63 | - 'rubocop' 64 | command: [ 'bundle', 'exec', 'rake' ] 65 | -------------------------------------------------------------------------------- /.pmtignore: -------------------------------------------------------------------------------- 1 | docs/ 2 | pkg/ 3 | Gemfile.lock 4 | Gemfile.local 5 | vendor/ 6 | .vendor/ 7 | spec/fixtures/manifests/ 8 | spec/fixtures/modules/ 9 | .vagrant/ 10 | .bundle/ 11 | .ruby-version 12 | coverage/ 13 | log/ 14 | .idea/ 15 | .dependencies/ 16 | .librarian/ 17 | Puppetfile.lock 18 | *.iml 19 | .*.sw? 20 | .yardoc/ 21 | Dockerfile 22 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --format documentation 2 | --color 3 | -------------------------------------------------------------------------------- /.rspec_parallel: -------------------------------------------------------------------------------- 1 | --format progress 2 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | require: rubocop-rspec 2 | AllCops: 3 | # Puppet Server 5 defaults to jruby 1.7 so TargetRubyVersion must stay at 1.9 until we drop support for puppet 5 4 | TargetRubyVersion: 1.9 5 | Include: 6 | - ./**/*.rb 7 | Exclude: 8 | - files/**/* 9 | - vendor/**/* 10 | - .vendor/**/* 11 | - pkg/**/* 12 | - spec/fixtures/**/* 13 | - Gemfile 14 | - Rakefile 15 | - Guardfile 16 | - Vagrantfile 17 | Lint/ConditionPosition: 18 | Enabled: True 19 | 20 | Lint/ElseLayout: 21 | Enabled: True 22 | 23 | Lint/UnreachableCode: 24 | Enabled: True 25 | 26 | Lint/UselessComparison: 27 | Enabled: True 28 | 29 | Lint/EnsureReturn: 30 | Enabled: True 31 | 32 | Lint/HandleExceptions: 33 | Enabled: True 34 | 35 | Lint/LiteralInCondition: 36 | Enabled: True 37 | 38 | Lint/ShadowingOuterLocalVariable: 39 | Enabled: True 40 | 41 | Lint/LiteralInInterpolation: 42 | Enabled: True 43 | 44 | Style/HashSyntax: 45 | Enabled: True 46 | 47 | Style/RedundantReturn: 48 | Enabled: True 49 | 50 | Layout/EndOfLine: 51 | Enabled: False 52 | 53 | Lint/AmbiguousOperator: 54 | Enabled: True 55 | 56 | Lint/AssignmentInCondition: 57 | Enabled: True 58 | 59 | Layout/SpaceBeforeComment: 60 | Enabled: True 61 | 62 | Style/AndOr: 63 | Enabled: True 64 | 65 | Style/RedundantSelf: 66 | Enabled: True 67 | 68 | Metrics/BlockLength: 69 | Enabled: False 70 | 71 | # Method length is not necessarily an indicator of code quality 72 | Metrics/MethodLength: 73 | Enabled: False 74 | 75 | # Module length is not necessarily an indicator of code quality 76 | Metrics/ModuleLength: 77 | Enabled: False 78 | 79 | Style/WhileUntilModifier: 80 | Enabled: True 81 | 82 | Lint/AmbiguousRegexpLiteral: 83 | Enabled: True 84 | 85 | Security/Eval: 86 | Enabled: True 87 | 88 | Lint/BlockAlignment: 89 | Enabled: True 90 | 91 | Lint/DefEndAlignment: 92 | Enabled: True 93 | 94 | Lint/EndAlignment: 95 | Enabled: True 96 | 97 | Lint/DeprecatedClassMethods: 98 | Enabled: True 99 | 100 | Lint/Loop: 101 | Enabled: True 102 | 103 | Lint/ParenthesesAsGroupedExpression: 104 | Enabled: True 105 | 106 | Lint/RescueException: 107 | Enabled: True 108 | 109 | Lint/StringConversionInInterpolation: 110 | Enabled: True 111 | 112 | Lint/UnusedBlockArgument: 113 | Enabled: True 114 | 115 | Lint/UnusedMethodArgument: 116 | Enabled: True 117 | 118 | Lint/UselessAccessModifier: 119 | Enabled: True 120 | 121 | Lint/UselessAssignment: 122 | Enabled: True 123 | 124 | Lint/Void: 125 | Enabled: True 126 | 127 | Layout/AccessModifierIndentation: 128 | Enabled: True 129 | 130 | Style/AccessorMethodName: 131 | Enabled: True 132 | 133 | Style/Alias: 134 | Enabled: True 135 | 136 | Layout/AlignArray: 137 | Enabled: True 138 | 139 | Layout/AlignHash: 140 | Enabled: True 141 | 142 | Layout/AlignParameters: 143 | Enabled: True 144 | 145 | Metrics/BlockNesting: 146 | Enabled: True 147 | 148 | Style/AsciiComments: 149 | Enabled: True 150 | 151 | Style/Attr: 152 | Enabled: True 153 | 154 | Style/BracesAroundHashParameters: 155 | Enabled: True 156 | 157 | Style/CaseEquality: 158 | Enabled: True 159 | 160 | Layout/CaseIndentation: 161 | Enabled: True 162 | 163 | Style/CharacterLiteral: 164 | Enabled: True 165 | 166 | Style/ClassAndModuleCamelCase: 167 | Enabled: True 168 | 169 | Style/ClassAndModuleChildren: 170 | Enabled: False 171 | 172 | Style/ClassCheck: 173 | Enabled: True 174 | 175 | # Class length is not necessarily an indicator of code quality 176 | Metrics/ClassLength: 177 | Enabled: False 178 | 179 | Style/ClassMethods: 180 | Enabled: True 181 | 182 | Style/ClassVars: 183 | Enabled: True 184 | 185 | Style/WhenThen: 186 | Enabled: True 187 | 188 | Style/WordArray: 189 | Enabled: True 190 | 191 | Style/UnneededPercentQ: 192 | Enabled: True 193 | 194 | Layout/Tab: 195 | Enabled: True 196 | 197 | Layout/SpaceBeforeSemicolon: 198 | Enabled: True 199 | 200 | Layout/TrailingBlankLines: 201 | Enabled: True 202 | 203 | Layout/SpaceInsideBlockBraces: 204 | Enabled: True 205 | 206 | Layout/SpaceInsideBrackets: 207 | Enabled: True 208 | 209 | Layout/SpaceInsideHashLiteralBraces: 210 | Enabled: True 211 | 212 | Layout/SpaceInsideParens: 213 | Enabled: True 214 | 215 | Layout/LeadingCommentSpace: 216 | Enabled: True 217 | 218 | Layout/SpaceBeforeFirstArg: 219 | Enabled: True 220 | 221 | Layout/SpaceAfterColon: 222 | Enabled: True 223 | 224 | Layout/SpaceAfterComma: 225 | Enabled: True 226 | 227 | Layout/SpaceAfterMethodName: 228 | Enabled: True 229 | 230 | Layout/SpaceAfterNot: 231 | Enabled: True 232 | 233 | Layout/SpaceAfterSemicolon: 234 | Enabled: True 235 | 236 | Layout/SpaceAroundEqualsInParameterDefault: 237 | Enabled: True 238 | 239 | Layout/SpaceAroundOperators: 240 | Enabled: True 241 | 242 | Layout/SpaceBeforeBlockBraces: 243 | Enabled: True 244 | 245 | Layout/SpaceBeforeComma: 246 | Enabled: True 247 | 248 | Style/CollectionMethods: 249 | Enabled: True 250 | 251 | Layout/CommentIndentation: 252 | Enabled: True 253 | 254 | Style/ColonMethodCall: 255 | Enabled: True 256 | 257 | Style/CommentAnnotation: 258 | Enabled: True 259 | 260 | # 'Complexity' is very relative 261 | Metrics/CyclomaticComplexity: 262 | Enabled: False 263 | 264 | Style/ConstantName: 265 | Enabled: True 266 | 267 | Style/Documentation: 268 | Enabled: False 269 | 270 | Style/DefWithParentheses: 271 | Enabled: True 272 | 273 | Style/PreferredHashMethods: 274 | Enabled: True 275 | 276 | Layout/DotPosition: 277 | EnforcedStyle: trailing 278 | 279 | Style/DoubleNegation: 280 | Enabled: True 281 | 282 | Style/EachWithObject: 283 | Enabled: True 284 | 285 | Layout/EmptyLineBetweenDefs: 286 | Enabled: True 287 | 288 | Layout/IndentArray: 289 | Enabled: True 290 | 291 | Layout/IndentHash: 292 | Enabled: True 293 | 294 | Layout/IndentationConsistency: 295 | Enabled: True 296 | 297 | Layout/IndentationWidth: 298 | Enabled: True 299 | 300 | Layout/EmptyLines: 301 | Enabled: True 302 | 303 | Layout/EmptyLinesAroundAccessModifier: 304 | Enabled: True 305 | 306 | Style/EmptyLiteral: 307 | Enabled: True 308 | 309 | # Configuration parameters: AllowURI, URISchemes. 310 | Metrics/LineLength: 311 | Enabled: False 312 | 313 | Style/MethodCallWithoutArgsParentheses: 314 | Enabled: True 315 | 316 | Style/MethodDefParentheses: 317 | Enabled: True 318 | 319 | Style/LineEndConcatenation: 320 | Enabled: True 321 | 322 | Layout/TrailingWhitespace: 323 | Enabled: True 324 | 325 | Style/StringLiterals: 326 | Enabled: True 327 | 328 | Style/TrailingCommaInArguments: 329 | Enabled: True 330 | 331 | Style/TrailingCommaInLiteral: 332 | Enabled: True 333 | 334 | Style/GlobalVars: 335 | Enabled: True 336 | 337 | Style/GuardClause: 338 | Enabled: True 339 | 340 | Style/IfUnlessModifier: 341 | Enabled: True 342 | 343 | Style/MultilineIfThen: 344 | Enabled: True 345 | 346 | Style/NegatedIf: 347 | Enabled: True 348 | 349 | Style/NegatedWhile: 350 | Enabled: True 351 | 352 | Style/Next: 353 | Enabled: True 354 | 355 | Style/SingleLineBlockParams: 356 | Enabled: True 357 | 358 | Style/SingleLineMethods: 359 | Enabled: True 360 | 361 | Style/SpecialGlobalVars: 362 | Enabled: True 363 | 364 | Style/TrivialAccessors: 365 | Enabled: True 366 | 367 | Style/UnlessElse: 368 | Enabled: True 369 | 370 | Style/VariableInterpolation: 371 | Enabled: True 372 | 373 | Style/VariableName: 374 | Enabled: True 375 | 376 | Style/WhileUntilDo: 377 | Enabled: True 378 | 379 | Style/EvenOdd: 380 | Enabled: True 381 | 382 | Style/FileName: 383 | Enabled: True 384 | 385 | Style/For: 386 | Enabled: True 387 | 388 | Style/Lambda: 389 | Enabled: True 390 | 391 | Style/MethodName: 392 | Enabled: True 393 | 394 | Style/MultilineTernaryOperator: 395 | Enabled: True 396 | 397 | Style/NestedTernaryOperator: 398 | Enabled: True 399 | 400 | Style/NilComparison: 401 | Enabled: True 402 | 403 | Style/FormatString: 404 | Enabled: True 405 | 406 | Style/MultilineBlockChain: 407 | Enabled: True 408 | 409 | Style/Semicolon: 410 | Enabled: True 411 | 412 | Style/SignalException: 413 | Enabled: True 414 | 415 | Style/NonNilCheck: 416 | Enabled: True 417 | 418 | Style/Not: 419 | Enabled: True 420 | 421 | Style/NumericLiterals: 422 | Enabled: True 423 | 424 | Style/OneLineConditional: 425 | Enabled: True 426 | 427 | Style/OpMethod: 428 | Enabled: True 429 | 430 | Style/ParenthesesAroundCondition: 431 | Enabled: True 432 | 433 | Style/PercentLiteralDelimiters: 434 | Enabled: True 435 | 436 | Style/PerlBackrefs: 437 | Enabled: True 438 | 439 | Style/PredicateName: 440 | Enabled: True 441 | 442 | Style/RedundantException: 443 | Enabled: True 444 | 445 | Style/SelfAssignment: 446 | Enabled: True 447 | 448 | Style/Proc: 449 | Enabled: True 450 | 451 | Style/RaiseArgs: 452 | Enabled: True 453 | 454 | Style/RedundantBegin: 455 | Enabled: True 456 | 457 | Style/RescueModifier: 458 | Enabled: True 459 | 460 | # based on https://github.com/voxpupuli/modulesync_config/issues/168 461 | Style/RegexpLiteral: 462 | EnforcedStyle: percent_r 463 | Enabled: True 464 | 465 | Lint/UnderscorePrefixedVariableName: 466 | Enabled: True 467 | 468 | Metrics/ParameterLists: 469 | Enabled: False 470 | 471 | Lint/RequireParentheses: 472 | Enabled: True 473 | 474 | Style/ModuleFunction: 475 | Enabled: True 476 | 477 | Lint/Debugger: 478 | Enabled: True 479 | 480 | Style/IfWithSemicolon: 481 | Enabled: True 482 | 483 | Style/Encoding: 484 | Enabled: True 485 | 486 | Style/BlockDelimiters: 487 | Enabled: True 488 | 489 | Layout/MultilineBlockLayout: 490 | Enabled: True 491 | 492 | # 'Complexity' is very relative 493 | Metrics/AbcSize: 494 | Enabled: False 495 | 496 | # 'Complexity' is very relative 497 | Metrics/PerceivedComplexity: 498 | Enabled: False 499 | 500 | Lint/UselessAssignment: 501 | Enabled: True 502 | 503 | Layout/ClosingParenthesisIndentation: 504 | Enabled: True 505 | 506 | # RSpec 507 | 508 | RSpec/BeforeAfterAll: 509 | Exclude: 510 | - spec/acceptance/**/* 511 | 512 | # We don't use rspec in this way 513 | RSpec/DescribeClass: 514 | Enabled: False 515 | 516 | # Example length is not necessarily an indicator of code quality 517 | RSpec/ExampleLength: 518 | Enabled: False 519 | 520 | RSpec/NamedSubject: 521 | Enabled: False 522 | 523 | # disabled for now since they cause a lot of issues 524 | # these issues aren't easy to fix 525 | RSpec/RepeatedDescription: 526 | Enabled: False 527 | 528 | RSpec/NestedGroups: 529 | Enabled: False 530 | 531 | # this is broken on ruby1.9 532 | Layout/IndentHeredoc: 533 | Enabled: False 534 | 535 | # disable Yaml safe_load. This is needed to support ruby2.0.0 development envs 536 | Security/YAMLLoad: 537 | Enabled: false 538 | 539 | # This affects hiera interpolation, as well as some configs that we push. 540 | Style/FormatStringToken: 541 | Enabled: false 542 | 543 | # This is useful, but sometimes a little too picky about where unit tests files 544 | # are located. 545 | RSpec/FilePath: 546 | Enabled: false 547 | -------------------------------------------------------------------------------- /.sync.yml: -------------------------------------------------------------------------------- 1 | --- 2 | .travis.yml: 3 | secure: "Wb5Hs28JNnFp4ZuQp4KTzUDfT3hXK5QW50e25gFULXjIY1+/vmhxb43Wl27lL+8/vRRe+1t3z0AIrZiYYapQWgWGfvAaBux1tRVTprWme4YqURMNSW4bxXVtYpCA4O0HiTJq6WZoRT9+/LRmEPnyBHSackgYKF0R4/LnZGfK0AY=" 4 | spec/spec_helper_acceptance.rb: 5 | unmanaged: false 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | dist: bionic 3 | language: ruby 4 | cache: bundler 5 | before_install: 6 | - yes | gem update --system 7 | - bundle --version 8 | script: 9 | - 'bundle exec rake $CHECK' 10 | matrix: 11 | fast_finish: true 12 | include: 13 | - rvm: 2.4.4 14 | bundler_args: --without system_tests development release 15 | env: PUPPET_VERSION="~> 5.0" CHECK=test 16 | - rvm: 2.5.3 17 | bundler_args: --without system_tests development release 18 | env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls 19 | - rvm: 2.5.3 20 | bundler_args: --without system_tests development release 21 | env: PUPPET_VERSION="~> 6.0" CHECK=rubocop 22 | - rvm: 2.4.4 23 | bundler_args: --without system_tests development release 24 | env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes 25 | branches: 26 | only: 27 | - master 28 | - /^v\d/ 29 | notifications: 30 | email: false 31 | webhooks: https://voxpupu.li/incoming/travis 32 | irc: 33 | on_success: always 34 | on_failure: always 35 | channels: 36 | - "chat.freenode.org#voxpupuli-notifications" 37 | deploy: 38 | provider: puppetforge 39 | user: puppet 40 | password: 41 | secure: "Wb5Hs28JNnFp4ZuQp4KTzUDfT3hXK5QW50e25gFULXjIY1+/vmhxb43Wl27lL+8/vRRe+1t3z0AIrZiYYapQWgWGfvAaBux1tRVTprWme4YqURMNSW4bxXVtYpCA4O0HiTJq6WZoRT9+/LRmEPnyBHSackgYKF0R4/LnZGfK0AY=" 42 | on: 43 | tags: true 44 | # all_branches is required to use tags 45 | all_branches: true 46 | # Only publish the build marked with "DEPLOY_TO_FORGE" 47 | condition: "$DEPLOY_TO_FORGE = yes" 48 | -------------------------------------------------------------------------------- /.yardopts: -------------------------------------------------------------------------------- 1 | --markup markdown 2 | --output-dir docs/ 3 | -------------------------------------------------------------------------------- /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.1](https://github.com/voxpupuli/puppet-wget/tree/v2.0.1) (2018-10-14) 8 | 9 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v2.0.0...v2.0.1) 10 | 11 | **Merged pull requests:** 12 | 13 | - modulesync 2.2.0 and allow puppet 6.x [\#100](https://github.com/voxpupuli/puppet-wget/pull/100) ([bastelfreak](https://github.com/bastelfreak)) 14 | - update README.md for Vox Pupuli [\#95](https://github.com/voxpupuli/puppet-wget/pull/95) ([bastelfreak](https://github.com/bastelfreak)) 15 | 16 | ## [v2.0.0](https://github.com/voxpupuli/puppet-wget/tree/v2.0.0) (2018-07-16) 17 | 18 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.7.3...v2.0.0) 19 | 20 | **Closed issues:** 21 | 22 | - Module being maintained? [\#91](https://github.com/voxpupuli/puppet-wget/issues/91) 23 | 24 | **Merged pull requests:** 25 | 26 | - Fixing package source not found on FreeBSD. [\#80](https://github.com/voxpupuli/puppet-wget/pull/80) ([madelaney](https://github.com/madelaney)) 27 | - Add 'group' option and document 'execuser' [\#76](https://github.com/voxpupuli/puppet-wget/pull/76) ([luyseyal](https://github.com/luyseyal)) 28 | 29 | ## [v1.7.3](https://github.com/voxpupuli/puppet-wget/tree/v1.7.3) (2016-03-01) 30 | 31 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.7.2...v1.7.3) 32 | 33 | **Closed issues:** 34 | 35 | - Error: Invalid parameter unless on Wget::Fetch [\#71](https://github.com/voxpupuli/puppet-wget/issues/71) 36 | 37 | **Merged pull requests:** 38 | 39 | - Make compatible with strict variables. [\#66](https://github.com/voxpupuli/puppet-wget/pull/66) ([BobVincentatNCRdotcom](https://github.com/BobVincentatNCRdotcom)) 40 | - Changed fetch exec require from Class to Package [\#63](https://github.com/voxpupuli/puppet-wget/pull/63) ([drewhemm](https://github.com/drewhemm)) 41 | 42 | ## [v1.7.2](https://github.com/voxpupuli/puppet-wget/tree/v1.7.2) (2016-02-17) 43 | 44 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.7.1...v1.7.2) 45 | 46 | **Closed issues:** 47 | 48 | - Errors when enabling strict\_variables [\#62](https://github.com/voxpupuli/puppet-wget/issues/62) 49 | - feature: Do not manage wget package [\#55](https://github.com/voxpupuli/puppet-wget/issues/55) 50 | - Add a $destination\_dir param [\#51](https://github.com/voxpupuli/puppet-wget/issues/51) 51 | - specify http\_proxy information as wget::fetch attribute [\#45](https://github.com/voxpupuli/puppet-wget/issues/45) 52 | - Windows redownload fails? [\#35](https://github.com/voxpupuli/puppet-wget/issues/35) 53 | 54 | **Merged pull requests:** 55 | 56 | - Added custom unless option [\#60](https://github.com/voxpupuli/puppet-wget/pull/60) ([apazga](https://github.com/apazga)) 57 | - Improvement to $destination param \(issue \#51\) [\#58](https://github.com/voxpupuli/puppet-wget/pull/58) ([seanscottking](https://github.com/seanscottking)) 58 | - Issue \#55 Add Param manage\_package [\#57](https://github.com/voxpupuli/puppet-wget/pull/57) ([mkrakowitzer](https://github.com/mkrakowitzer)) 59 | 60 | ## [v1.7.1](https://github.com/voxpupuli/puppet-wget/tree/v1.7.1) (2015-08-20) 61 | 62 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.7.0...v1.7.1) 63 | 64 | **Closed issues:** 65 | 66 | - File does not get updated when the file is updated [\#52](https://github.com/voxpupuli/puppet-wget/issues/52) 67 | - Not working in Windows [\#43](https://github.com/voxpupuli/puppet-wget/issues/43) 68 | - destination file's permission can't be edited [\#37](https://github.com/voxpupuli/puppet-wget/issues/37) 69 | - Do not download if wget::fetch { redownload =\> false } [\#26](https://github.com/voxpupuli/puppet-wget/issues/26) 70 | - Disable .wgetrc files [\#25](https://github.com/voxpupuli/puppet-wget/issues/25) 71 | - Add support for headers or cookies [\#19](https://github.com/voxpupuli/puppet-wget/issues/19) 72 | 73 | **Merged pull requests:** 74 | 75 | - Update to work on Windows [\#54](https://github.com/voxpupuli/puppet-wget/pull/54) ([mirthy](https://github.com/mirthy)) 76 | - Pass schedule metaparam down to resources. [\#46](https://github.com/voxpupuli/puppet-wget/pull/46) ([robbat2](https://github.com/robbat2)) 77 | - Add parameter to set file mode on destination [\#44](https://github.com/voxpupuli/puppet-wget/pull/44) ([mcallaway](https://github.com/mcallaway)) 78 | 79 | ## [v1.7.0](https://github.com/voxpupuli/puppet-wget/tree/v1.7.0) (2015-05-01) 80 | 81 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.6.0...v1.7.0) 82 | 83 | **Merged pull requests:** 84 | 85 | - Add md5sum check [\#42](https://github.com/voxpupuli/puppet-wget/pull/42) ([squiddle](https://github.com/squiddle)) 86 | 87 | ## [v1.6.0](https://github.com/voxpupuli/puppet-wget/tree/v1.6.0) (2015-03-27) 88 | 89 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.5.7...v1.6.0) 90 | 91 | **Closed issues:** 92 | 93 | - no way to disable file backup [\#39](https://github.com/voxpupuli/puppet-wget/issues/39) 94 | 95 | **Merged pull requests:** 96 | 97 | - added support for solaris 10 in fetch.pp [\#41](https://github.com/voxpupuli/puppet-wget/pull/41) ([tosmi](https://github.com/tosmi)) 98 | - Add backup option [\#40](https://github.com/voxpupuli/puppet-wget/pull/40) ([duskglow](https://github.com/duskglow)) 99 | - fetch is not a class [\#36](https://github.com/voxpupuli/puppet-wget/pull/36) ([igalic](https://github.com/igalic)) 100 | 101 | ## [v1.5.7](https://github.com/voxpupuli/puppet-wget/tree/v1.5.7) (2014-12-22) 102 | 103 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.5.6...v1.5.7) 104 | 105 | **Closed issues:** 106 | 107 | - Support Mac [\#32](https://github.com/voxpupuli/puppet-wget/issues/32) 108 | 109 | ## [v1.5.6](https://github.com/voxpupuli/puppet-wget/tree/v1.5.6) (2014-09-15) 110 | 111 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.5.5...v1.5.6) 112 | 113 | ## [v1.5.5](https://github.com/voxpupuli/puppet-wget/tree/v1.5.5) (2014-09-11) 114 | 115 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.5.4...v1.5.5) 116 | 117 | ## [v1.5.4](https://github.com/voxpupuli/puppet-wget/tree/v1.5.4) (2014-09-11) 118 | 119 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.5.3...v1.5.4) 120 | 121 | ## [v1.5.3](https://github.com/voxpupuli/puppet-wget/tree/v1.5.3) (2014-09-08) 122 | 123 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.5.2...v1.5.3) 124 | 125 | **Merged pull requests:** 126 | 127 | - Fixed PE version to allow 3.2 and 3.3 [\#33](https://github.com/voxpupuli/puppet-wget/pull/33) ([adamcrews](https://github.com/adamcrews)) 128 | 129 | ## [v1.5.2](https://github.com/voxpupuli/puppet-wget/tree/v1.5.2) (2014-08-27) 130 | 131 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.5.1...v1.5.2) 132 | 133 | ## [v1.5.1](https://github.com/voxpupuli/puppet-wget/tree/v1.5.1) (2014-08-18) 134 | 135 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.4.5...v1.5.1) 136 | 137 | **Merged pull requests:** 138 | 139 | - Fixed 'unless' test when we are using caching [\#30](https://github.com/voxpupuli/puppet-wget/pull/30) ([stevesaliman](https://github.com/stevesaliman)) 140 | 141 | ## [v1.4.5](https://github.com/voxpupuli/puppet-wget/tree/v1.4.5) (2014-07-23) 142 | 143 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.4.4...v1.4.5) 144 | 145 | **Merged pull requests:** 146 | 147 | - Resolves issue \#19 added --no-cookies boolean and --header array parameters [\#29](https://github.com/voxpupuli/puppet-wget/pull/29) ([Limess](https://github.com/Limess)) 148 | 149 | ## [v1.4.4](https://github.com/voxpupuli/puppet-wget/tree/v1.4.4) (2014-06-27) 150 | 151 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.4.3...v1.4.4) 152 | 153 | ## [v1.4.3](https://github.com/voxpupuli/puppet-wget/tree/v1.4.3) (2014-06-13) 154 | 155 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.4.2...v1.4.3) 156 | 157 | **Merged pull requests:** 158 | 159 | - Update fetch.pp [\#28](https://github.com/voxpupuli/puppet-wget/pull/28) ([mens](https://github.com/mens)) 160 | 161 | ## [v1.4.2](https://github.com/voxpupuli/puppet-wget/tree/v1.4.2) (2014-06-10) 162 | 163 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.4.1...v1.4.2) 164 | 165 | **Closed issues:** 166 | 167 | - Wget package fails under Windows [\#24](https://github.com/voxpupuli/puppet-wget/issues/24) 168 | 169 | **Merged pull requests:** 170 | 171 | - Add freebsd support [\#27](https://github.com/voxpupuli/puppet-wget/pull/27) ([illogicalimbecile](https://github.com/illogicalimbecile)) 172 | 173 | ## [v1.4.1](https://github.com/voxpupuli/puppet-wget/tree/v1.4.1) (2014-04-01) 174 | 175 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.4.0...v1.4.1) 176 | 177 | **Merged pull requests:** 178 | 179 | - Exec wget with default user when using cache\_dir [\#22](https://github.com/voxpupuli/puppet-wget/pull/22) ([gnustavo](https://github.com/gnustavo)) 180 | 181 | ## [v1.4.0](https://github.com/voxpupuli/puppet-wget/tree/v1.4.0) (2014-03-31) 182 | 183 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.3.2...v1.4.0) 184 | 185 | **Closed issues:** 186 | 187 | - License File [\#20](https://github.com/voxpupuli/puppet-wget/issues/20) 188 | 189 | ## [v1.3.2](https://github.com/voxpupuli/puppet-wget/tree/v1.3.2) (2014-02-24) 190 | 191 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.3.1...v1.3.2) 192 | 193 | **Closed issues:** 194 | 195 | - Last release fails on Debian Wheezy [\#18](https://github.com/voxpupuli/puppet-wget/issues/18) 196 | 197 | ## [v1.3.1](https://github.com/voxpupuli/puppet-wget/tree/v1.3.1) (2013-12-11) 198 | 199 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.3.0...v1.3.1) 200 | 201 | ## [v1.3.0](https://github.com/voxpupuli/puppet-wget/tree/v1.3.0) (2013-12-10) 202 | 203 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.2.3...v1.3.0) 204 | 205 | **Closed issues:** 206 | 207 | - Unable to run as non-root user [\#14](https://github.com/voxpupuli/puppet-wget/issues/14) 208 | 209 | ## [v1.2.3](https://github.com/voxpupuli/puppet-wget/tree/v1.2.3) (2013-11-21) 210 | 211 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.2.2...v1.2.3) 212 | 213 | ## [v1.2.2](https://github.com/voxpupuli/puppet-wget/tree/v1.2.2) (2013-09-14) 214 | 215 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.2.1...v1.2.2) 216 | 217 | **Merged pull requests:** 218 | 219 | - Make source default to title [\#13](https://github.com/voxpupuli/puppet-wget/pull/13) ([igalic](https://github.com/igalic)) 220 | 221 | ## [v1.2.1](https://github.com/voxpupuli/puppet-wget/tree/v1.2.1) (2013-08-29) 222 | 223 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.2.0...v1.2.1) 224 | 225 | **Merged pull requests:** 226 | 227 | - quote both source and destination [\#12](https://github.com/voxpupuli/puppet-wget/pull/12) ([peterhoeg](https://github.com/peterhoeg)) 228 | - Proper wget quote handling [\#10](https://github.com/voxpupuli/puppet-wget/pull/10) ([pjagielski](https://github.com/pjagielski)) 229 | 230 | ## [v1.2.0](https://github.com/voxpupuli/puppet-wget/tree/v1.2.0) (2013-06-06) 231 | 232 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.1.0...v1.2.0) 233 | 234 | **Merged pull requests:** 235 | 236 | - reworked for style [\#9](https://github.com/voxpupuli/puppet-wget/pull/9) ([ghoneycutt](https://github.com/ghoneycutt)) 237 | - Add option to download with user. [\#8](https://github.com/voxpupuli/puppet-wget/pull/8) ([juanibiapina](https://github.com/juanibiapina)) 238 | - added support for nocheckcertificate option [\#6](https://github.com/voxpupuli/puppet-wget/pull/6) ([srse](https://github.com/srse)) 239 | - Option for forcing re-download of a file which already exists [\#5](https://github.com/voxpupuli/puppet-wget/pull/5) ([acr31](https://github.com/acr31)) 240 | 241 | ## [v1.1.0](https://github.com/voxpupuli/puppet-wget/tree/v1.1.0) (2013-01-25) 242 | 243 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/v1.0.0...v1.1.0) 244 | 245 | **Merged pull requests:** 246 | 247 | - New version param for package ensure [\#3](https://github.com/voxpupuli/puppet-wget/pull/3) ([dcarley](https://github.com/dcarley)) 248 | 249 | ## [v1.0.0](https://github.com/voxpupuli/puppet-wget/tree/v1.0.0) (2012-11-30) 250 | 251 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/0.0.1...v1.0.0) 252 | 253 | ## [0.0.1](https://github.com/voxpupuli/puppet-wget/tree/0.0.1) (2012-07-13) 254 | 255 | [Full Changelog](https://github.com/voxpupuli/puppet-wget/compare/a0ef13c4af9c6e809c52561a572ba4bd8ffdc172...0.0.1) 256 | 257 | **Merged pull requests:** 258 | 259 | - MAESTRO-1884 added Mac OS support. [\#1](https://github.com/voxpupuli/puppet-wget/pull/1) ([etiennep](https://github.com/etiennep)) 260 | 261 | 262 | 263 | \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* 264 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ruby:2.5.3 2 | 3 | WORKDIR /opt/puppet 4 | 5 | # https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 6 | RUN mkdir -p /etc/sv 7 | 8 | ARG PUPPET_VERSION="~> 6.0" 9 | ARG PARALLEL_TEST_PROCESSORS=4 10 | 11 | # Cache gems 12 | COPY Gemfile . 13 | RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle} 14 | 15 | COPY . . 16 | 17 | RUN bundle install 18 | RUN bundle exec rake release_checks 19 | 20 | # Container should not saved 21 | RUN exit 1 22 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source ENV['GEM_SOURCE'] || "https://rubygems.org" 2 | 3 | def location_for(place, fake_version = nil) 4 | if place =~ /^(git[:@][^#]*)#(.*)/ 5 | [fake_version, { :git => $1, :branch => $2, :require => false }].compact 6 | elsif place =~ /^file:\/\/(.*)/ 7 | ['>= 0', { :path => File.expand_path($1), :require => false }] 8 | else 9 | [place, { :require => false }] 10 | end 11 | end 12 | 13 | group :test do 14 | gem 'voxpupuli-test', '>= 1.0.0', :require => false 15 | gem 'coveralls', :require => false 16 | gem 'simplecov-console', :require => false 17 | end 18 | 19 | group :development do 20 | gem 'travis', :require => false 21 | gem 'travis-lint', :require => false 22 | gem 'guard-rake', :require => false 23 | gem 'overcommit', '>= 0.39.1', :require => false 24 | end 25 | 26 | group :system_tests do 27 | gem 'voxpupuli-acceptance', :require => false 28 | end 29 | 30 | group :release do 31 | gem 'github_changelog_generator', :require => false, :git => 'https://github.com/voxpupuli/github-changelog-generator', :branch => 'voxpupuli_essential_fixes' 32 | gem 'puppet-blacksmith', :require => false 33 | gem 'voxpupuli-release', :require => false 34 | gem 'puppet-strings', '>= 2.2', :require => false 35 | end 36 | 37 | 38 | 39 | if facterversion = ENV['FACTER_GEM_VERSION'] 40 | gem 'facter', facterversion.to_s, :require => false, :groups => [:test] 41 | else 42 | gem 'facter', :require => false, :groups => [:test] 43 | end 44 | 45 | ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 6.0' : puppetversion = ENV['PUPPET_VERSION'].to_s 46 | gem 'puppet', puppetversion, :require => false, :groups => [:test] 47 | 48 | # vim: syntax=ruby 49 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/voxpupuli/puppet-wget.svg?branch=master)](https://travis-ci.org/voxpupuli/puppet-wget) 2 | [![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/wget.svg)](https://forge.puppetlabs.com/puppet/wget) 3 | [![Puppet Forge](https://img.shields.io/puppetforge/f/puppet/wget.svg)](https://forge.puppetlabs.com/puppet/wget) 4 | [![Puppet Forge](https://img.shields.io/puppetforge/e/puppet/wget.svg)](https://forge.puppetlabs.com/puppet/wget) 5 | 6 | This module is declared as deprecated by Vox Pupuli. 7 | 8 | The module [puppet-archive](https://github.com/voxpupuli/puppet-archive) is suggested as its replacement. 9 | 10 | 11 | A Puppet module to download files with wget, supporting authentication. 12 | It got migrated from [maestrodev](https://forge.puppet.com/maestrodev/wget) to [Vox Pupuli](https://voxpupuli.org/) 13 | 14 | ### ToC 15 | 16 | * [Example](#example) 17 | * [Building](#building) 18 | * [License](#license) 19 | 20 | --- 21 | 22 | ## Example 23 | 24 | install wget: 25 | 26 | ```puppet 27 | include wget 28 | ``` 29 | 30 | ```puppet 31 | wget::fetch { "download Google's index": 32 | source => 'http://www.google.com/index.html', 33 | destination => '/tmp/', 34 | timeout => 0, 35 | verbose => false, 36 | } 37 | ``` 38 | or alternatively: 39 | 40 | ```puppet 41 | wget::fetch { 'http://www.google.com/index.html': 42 | destination => '/tmp/', 43 | timeout => 0, 44 | verbose => false, 45 | } 46 | ``` 47 | 48 | If `$destination` ends in either a forward or backward slash, it will treat the destination as a directory and name the file with the basename of the `$source`. 49 | ```puppet 50 | wget::fetch { 'http://mywebsite.com/apples': 51 | destination => '/downloads/', 52 | } 53 | ``` 54 | 55 | Download from an array of URLs into one directory 56 | ```puppet 57 | $manyfiles = [ 58 | 'http://mywebsite.com/apples', 59 | 'http://mywebsite.com/oranges', 60 | 'http://mywebsite.com/bananas', 61 | ] 62 | 63 | wget::fetch { $manyfiles: 64 | destination => '/downloads/', 65 | } 66 | ``` 67 | 68 | This fetches a document which requires authentication: 69 | 70 | ```puppet 71 | wget::fetch { 'Fetch secret PDF': 72 | source => 'https://confidential.example.com/secret.pdf', 73 | destination => '/tmp/', 74 | user => 'user', 75 | password => 'p$ssw0rd', 76 | timeout => 0, 77 | verbose => false, 78 | } 79 | ``` 80 | 81 | This caches the downloaded file in an intermediate directory to avoid 82 | repeatedly downloading it. This uses the timestamping (-N) and prefix (-P) 83 | wget options to only re-download if the source file has been updated. 84 | 85 | ```puppet 86 | wget::fetch { 'https://tool.com/downloads/tool-1.0.tgz': 87 | destination => '/tmp/', 88 | cache_dir => '/var/cache/wget', 89 | } 90 | ``` 91 | 92 | It's assumed that the cached file will be named after the source's URL 93 | basename but this assumption can be broken if wget follows some redirects. In 94 | this case you must inform the correct filename in the cache like this: 95 | 96 | ```puppet 97 | wget::fetch { 'https://tool.com/downloads/tool-latest.tgz': 98 | destination => '/tmp/tool-1.0.tgz', 99 | cache_dir => '/var/cache/wget', 100 | cache_file => 'tool-1.1.tgz', 101 | execuser => 'fileowner', 102 | group => 'filegroup', 103 | } 104 | ``` 105 | 106 | Checksum can be used in the `source_hash` parameter, with the MD5-sum of the content to be downloaded. 107 | If content exists, but does not match it is removed before downloading. 108 | 109 | If you want to use your own unless condition, you can do it. This example uses wget to download the latest version of Wordpress to your destination folder only if the folder is empty (test used returns 1 if directory is empty or 0 if not). 110 | ```puppet 111 | wget::fetch { 'wordpress': 112 | source => 'https://wordpress.org/latest.tar.gz', 113 | destination => "/var/www/html/latest_wordpress.tar.gz", 114 | timeout => 0, 115 | unless => "test $(ls -A /var/www/html 2>/dev/null)", 116 | } 117 | ``` 118 | 119 | # Building 120 | 121 | Testing is done with rspec, [Beaker-rspec](https://github.com/puppetlabs/beaker-rspec), [Beaker](https://github.com/puppetlabs/beaker)) 122 | 123 | To test and build the module 124 | 125 | bundle install 126 | # run specs 127 | rake 128 | 129 | # run Beaker system tests with vagrant vms 130 | rake beaker 131 | # to use other vm from the list spec/acceptance/nodesets and not destroy the vm after the tests 132 | BEAKER_destroy=no BEAKER_set=centos-65-x64-docker bundle exec rake beaker 133 | 134 | # Release the Puppet module to the Forge, doing a clean, build, tag, push, bump_commit and git push 135 | rake module:release 136 | 137 | # License 138 | 139 | Copyright 2011-2013 MaestroDev 140 | 141 | Licensed under the Apache License, Version 2.0 (the "License"); 142 | you may not use this file except in compliance with the License. 143 | You may obtain a copy of the License at 144 | 145 | http://www.apache.org/licenses/LICENSE-2.0 146 | 147 | Unless required by applicable law or agreed to in writing, software 148 | distributed under the License is distributed on an "AS IS" BASIS, 149 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 150 | See the License for the specific language governing permissions and 151 | limitations under the License. 152 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'voxpupuli/test/rake' 2 | 3 | # load optional tasks for releases 4 | # only available if gem group releases is installed 5 | begin 6 | require 'voxpupuli/release/rake_tasks' 7 | rescue LoadError 8 | end 9 | 10 | desc "Run main 'test' task and report merged results to coveralls" 11 | task test_with_coveralls: [:test] do 12 | if Dir.exist?(File.expand_path('../lib', __FILE__)) 13 | require 'coveralls/rake/task' 14 | Coveralls::RakeTask.new 15 | Rake::Task['coveralls:push'].invoke 16 | else 17 | puts 'Skipping reporting to coveralls. Module has no lib dir' 18 | end 19 | end 20 | 21 | desc 'Generate REFERENCE.md' 22 | task :reference, [:debug, :backtrace] do |t, args| 23 | patterns = '' 24 | Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) 25 | end 26 | 27 | begin 28 | require 'github_changelog_generator/task' 29 | GitHubChangelogGenerator::RakeTask.new :changelog do |config| 30 | version = (Blacksmith::Modulefile.new).version 31 | config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/ 32 | config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." 33 | config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} 34 | config.user = 'voxpupuli' 35 | metadata_json = File.join(File.dirname(__FILE__), 'metadata.json') 36 | metadata = JSON.load(File.read(metadata_json)) 37 | config.project = metadata['name'] 38 | end 39 | 40 | # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 41 | require 'rbconfig' 42 | if RbConfig::CONFIG['host_os'] =~ /linux/ 43 | task :changelog do 44 | puts 'Fixing line endings...' 45 | changelog_file = File.join(__dir__, 'CHANGELOG.md') 46 | changelog_txt = File.read(changelog_file) 47 | new_contents = changelog_txt.gsub(%r{\r\n}, "\n") 48 | File.open(changelog_file, "w") {|file| file.puts new_contents } 49 | end 50 | end 51 | 52 | rescue LoadError 53 | end 54 | # vim: syntax=ruby 55 | -------------------------------------------------------------------------------- /manifests/authfetch.pp: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Definition: wget::authfetch 3 | # 4 | # This class will download files from the internet. You may define a web proxy 5 | # using $::http_proxy if necessary. Username must be provided. And the user's 6 | # password must be stored in the password variable within the .wgetrc file. 7 | # 8 | ################################################################################ 9 | define wget::authfetch ( 10 | $destination, 11 | $user, 12 | $source = $title, 13 | $password = '', 14 | $timeout = '0', 15 | $verbose = false, 16 | $redownload = false, 17 | $nocheckcertificate = false, 18 | $execuser = undef, 19 | $unless = undef, 20 | ) { 21 | 22 | notice('wget::authfetch is deprecated, use wget::fetch with user/password params') 23 | 24 | wget::fetch { $title: 25 | destination => $destination, 26 | source => $source, 27 | timeout => $timeout, 28 | verbose => $verbose, 29 | redownload => $redownload, 30 | nocheckcertificate => $nocheckcertificate, 31 | execuser => $execuser, 32 | user => $user, 33 | password => $password, 34 | unless => $unless, 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /manifests/fetch.pp: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Definition: wget::fetch 3 | # 4 | # This defined type will download files from the internet. You may define a 5 | # web proxy using $http_proxy if necessary. 6 | # 7 | # == Parameters: 8 | # $source_hash: MD5-sum of the content to be downloaded, 9 | # if content exists, but does not match it is removed 10 | # before downloading 11 | # 12 | ################################################################################ 13 | define wget::fetch ( 14 | $destination, 15 | $source = $title, 16 | $source_hash = undef, 17 | $timeout = '0', 18 | $verbose = false, 19 | $redownload = false, 20 | $nocheckcertificate = false, 21 | $no_cookies = false, 22 | $execuser = undef, 23 | $user = undef, 24 | $password = undef, 25 | $headers = undef, 26 | $cache_dir = undef, 27 | $cache_file = undef, 28 | $flags = undef, 29 | $backup = true, 30 | $group = undef, 31 | $mode = undef, 32 | $unless = undef, 33 | ) { 34 | 35 | include wget 36 | 37 | # The strict_variables setting aborts compilation referencing unset variables. 38 | $strict = defined('$::settings::strict_variables') and $::settings::strict_variables 39 | 40 | if $strict and !defined('$schedule') { 41 | $schedule = undef 42 | } 43 | 44 | # Does $destination end in a slash? If so, treat as a directory 45 | case $destination { 46 | # This is a nasty looking regex but it's simply checking to see if the $destination 47 | # ends in either forward slash "\" (Linux) or backwards slash "/" (Windows) 48 | /^.*\/$/, /^.*\$/: { 49 | $source_split = split($source, '/') # split the URL into arrays, using "/" as a delimiter 50 | $source_filename = $source_split[-1] # take the very last value in the array. this is the filename 51 | $_destination = "${destination}/${source_filename}" 52 | } 53 | default: { 54 | $_destination = $destination 55 | } 56 | } 57 | 58 | if $strict and !defined('$::http_proxy') { 59 | $http_proxy = undef 60 | } else { 61 | $http_proxy = $::http_proxy 62 | } 63 | if $strict and !defined('$::https_proxy') { 64 | $https_proxy = undef 65 | } else { 66 | $https_proxy = $::https_proxy 67 | } 68 | 69 | $http_proxy_env = $http_proxy ? { 70 | undef => [], 71 | default => [ "HTTP_PROXY=${http_proxy}", "http_proxy=${http_proxy}" ], 72 | } 73 | $https_proxy_env = $https_proxy ? { 74 | undef => [], 75 | default => [ "HTTPS_PROXY=${https_proxy}", "https_proxy=${https_proxy}" ], 76 | } 77 | $password_env = $user ? { 78 | undef => [], 79 | default => [ "WGETRC=${_destination}.wgetrc" ], 80 | } 81 | 82 | # not using stdlib.concat to avoid extra dependency 83 | $environment = split(inline_template('<%= (@http_proxy_env+@https_proxy_env+@password_env).join(\',\') %>'),',') 84 | 85 | $verbose_option = $verbose ? { 86 | true => '--verbose', 87 | false => '--no-verbose' 88 | } 89 | 90 | # Windows exec unless testing requires different syntax 91 | if ($facts['os']['name'] == 'windows') { 92 | $exec_path = $::path 93 | $unless_test = "cmd.exe /c \"dir ${_destination}\"" 94 | } else { 95 | $exec_path = '/usr/bin:/usr/sbin:/bin:/usr/local/bin:/opt/local/bin:/usr/sfw/bin' 96 | if $unless != undef { 97 | $unless_test = $unless 98 | } 99 | elsif $redownload == true or $cache_dir != undef { 100 | $unless_test = 'test' 101 | } else { 102 | $unless_test = "test -s '${_destination}'" 103 | } 104 | } 105 | 106 | $nocheckcert_option = $nocheckcertificate ? { 107 | true => ' --no-check-certificate', 108 | false => '' 109 | } 110 | 111 | $no_cookies_option = $no_cookies ? { 112 | true => ' --no-cookies', 113 | false => '', 114 | } 115 | 116 | $user_option = $user ? { 117 | undef => '', 118 | default => " --user=${user}", 119 | } 120 | 121 | if $user != undef { 122 | $wgetrc_content = $facts['os']['name'] ? { 123 | # This is to work around an issue with macports wget and out of date CA cert bundle. This requires 124 | # installing the curl-ca-bundle package like so: 125 | # 126 | # sudo port install curl-ca-bundle 127 | 'Darwin' => "password=${password}\nCA_CERTIFICATE=/opt/local/share/curl/curl-ca-bundle.crt\n", 128 | default => "password=${password}", 129 | } 130 | 131 | file { "${_destination}.wgetrc": 132 | owner => $execuser, 133 | mode => '0600', 134 | content => $wgetrc_content, 135 | before => Exec["wget-${name}"], 136 | schedule => $schedule, 137 | } 138 | } 139 | 140 | $output_option = $cache_dir ? { 141 | undef => " --output-document=\"${_destination}\"", 142 | default => " -N -P \"${cache_dir}\"", 143 | } 144 | 145 | # again, not using stdlib.concat, concatanate array of headers into a single string 146 | if $headers != undef { 147 | $headers_all = inline_template('<% @headers.each do | header | -%> --header "<%= header -%>"<% end -%>') 148 | } 149 | 150 | $header_option = $headers ? { 151 | undef => '', 152 | default => $headers_all, 153 | } 154 | 155 | $flags_joined = $flags ? { 156 | undef => '', 157 | default => inline_template(' <%= @flags.join(" ") %>') 158 | } 159 | 160 | $exec_user = $cache_dir ? { 161 | undef => $execuser, 162 | default => undef, 163 | } 164 | 165 | case $source_hash{ 166 | '', undef: { 167 | $command = "wget ${verbose_option}${nocheckcert_option}${no_cookies_option}${header_option}${user_option}${output_option}${flags_joined} \"${source}\"" 168 | } 169 | default: { 170 | $command = "wget ${verbose_option}${nocheckcert_option}${no_cookies_option}${header_option}${user_option}${output_option}${flags_joined} \"${source}\" && echo '${source_hash} ${_destination}' | md5sum -c --quiet" 171 | } 172 | } 173 | 174 | 175 | # ensure that wget is installed before the exec resource 176 | # but only if we manage wget.... 177 | Class['wget'] 178 | -> Exec["wget-${name}"] 179 | 180 | exec { "wget-${name}": 181 | command => $command, 182 | timeout => $timeout, 183 | unless => $unless_test, 184 | environment => $environment, 185 | user => $exec_user, 186 | path => $exec_path, 187 | schedule => $schedule, 188 | } 189 | 190 | if $cache_dir != undef { 191 | $cache = $cache_file ? { 192 | undef => inline_template('<%= require \'uri\'; File.basename(URI::parse(@source).path) %>'), 193 | default => $cache_file, 194 | } 195 | file { $_destination: 196 | ensure => file, 197 | source => "${cache_dir}/${cache}", 198 | owner => $execuser, 199 | group => $group, 200 | mode => $mode, 201 | require => Exec["wget-${name}"], 202 | backup => $backup, 203 | schedule => $schedule, 204 | } 205 | } 206 | 207 | # remove destination if source_hash is invalid 208 | if $source_hash != undef { 209 | exec { "wget-source_hash-check-${name}": 210 | command => "test ! -e '${_destination}' || rm ${_destination}", 211 | path => '/usr/bin:/usr/sbin:/bin:/usr/local/bin:/opt/local/bin', 212 | # only remove destination if md5sum does not match $source_hash 213 | unless => "echo '${source_hash} ${_destination}' | md5sum -c --quiet", 214 | notify => Exec["wget-${name}"], 215 | schedule => $schedule, 216 | } 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /manifests/init.pp: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Class: wget 3 | # 4 | # This class will install wget - a tool used to download content from the web. 5 | # 6 | ################################################################################ 7 | class wget ( 8 | $version = present, 9 | $manage_package = true, 10 | ) { 11 | 12 | if $manage_package { 13 | if !defined(Package['wget']) { 14 | if $::kernel == 'Linux' { 15 | package { 'wget': ensure => $version } 16 | } 17 | elsif $::kernel == 'FreeBSD' { 18 | if versioncmp($facts['os']['release']['major'], '10') >= 0 { 19 | package { 'wget': ensure => $version } 20 | } 21 | else { 22 | package { 'wget': 23 | ensure => $version, 24 | name => 'ftp/wget', 25 | alias => 'wget'; 26 | } 27 | } 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "puppet-wget", 3 | "version": "2.0.2-rc0", 4 | "source": "https://github.com/voxpupuli/puppet-wget.git", 5 | "author": "Vox Pupuli", 6 | "license": "Apache-2.0", 7 | "summary": "Download files with wget", 8 | "description": "A module for wget that allows downloading of files, supporting authentication", 9 | "project_page": "https://github.com/voxpupuli/puppet-wget", 10 | "dependencies": [], 11 | "requirements": [ 12 | { 13 | "name": "puppet", 14 | "version_requirement": ">= 5.5.8 < 7.0.0" 15 | } 16 | ], 17 | "operatingsystem_support": [ 18 | { 19 | "operatingsystem": "RedHat", 20 | "operatingsystemrelease": [ 21 | "6", 22 | "7" 23 | ] 24 | }, 25 | { 26 | "operatingsystem": "CentOS", 27 | "operatingsystemrelease": [ 28 | "6", 29 | "7" 30 | ] 31 | }, 32 | { 33 | "operatingsystem": "OracleLinux", 34 | "operatingsystemrelease": [ 35 | "6", 36 | "7" 37 | ] 38 | }, 39 | { 40 | "operatingsystem": "Scientific", 41 | "operatingsystemrelease": [ 42 | "6", 43 | "7" 44 | ] 45 | }, 46 | { 47 | "operatingsystem": "SLES", 48 | "operatingsystemrelease": [ 49 | "11 SP1" 50 | ] 51 | }, 52 | { 53 | "operatingsystem": "Debian", 54 | "operatingsystemrelease": [ 55 | "8", 56 | "9" 57 | ] 58 | }, 59 | { 60 | "operatingsystem": "Ubuntu", 61 | "operatingsystemrelease": [ 62 | "16.04", 63 | "18.04" 64 | ] 65 | }, 66 | { 67 | "operatingsystem": "Solaris", 68 | "operatingsystemrelease": [ 69 | "10", 70 | "11" 71 | ] 72 | }, 73 | { 74 | "operatingsystem": "Windows", 75 | "operatingsystemrelease": [ 76 | "Server 2003", 77 | "Server 2003 R2", 78 | "Server 2008", 79 | "Server 2008 R2", 80 | "Server 2012", 81 | "Server 2012 R2", 82 | "7", 83 | "8" 84 | ] 85 | }, 86 | { 87 | "operatingsystem": "AIX", 88 | "operatingsystemrelease": [ 89 | "5.3", 90 | "6.1", 91 | "7.1" 92 | ] 93 | }, 94 | { 95 | "operatingsystem": "Darwin", 96 | "operatingsystemrelease": [ 97 | "10", 98 | "11", 99 | "12", 100 | "13" 101 | ] 102 | }, 103 | { 104 | "operatingsystem": "FreeBSD", 105 | "operatingsystemrelease": [ 106 | "10", 107 | "11" 108 | ] 109 | } 110 | ] 111 | } 112 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/archlinux-2-x64.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This file is managed via modulesync 3 | # https://github.com/voxpupuli/modulesync 4 | # https://github.com/voxpupuli/modulesync_config 5 | HOSTS: 6 | archlinux-2-x64: 7 | roles: 8 | - master 9 | platform: archlinux-2-x64 10 | box: archlinux/archlinux 11 | hypervisor: vagrant 12 | CONFIG: 13 | type: foss 14 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/centos-65-x64-docker.yml: -------------------------------------------------------------------------------- 1 | # This file is managed centrally by modulesync 2 | # https://github.com/maestrodev/puppet-modulesync 3 | 4 | HOSTS: 5 | centos-65-x64: 6 | roles: 7 | - master 8 | platform: el-6-x86_64 9 | image: devopsil/puppet:3.5.1 10 | # ip: localhost 11 | hypervisor : docker 12 | docker_image_commands: 13 | - yum -y install tar 14 | - useradd vagrant 15 | - "sed -ri 's/^#?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config" 16 | - "sed -ri 's/^#?PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config" 17 | docker_cmd: 18 | - 'sh' 19 | - '-c' 20 | - 'service sshd start; tail -f /dev/null' 21 | CONFIG: 22 | log_level: debug 23 | type: git 24 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/centos-65-x64.yml: -------------------------------------------------------------------------------- 1 | # This file is managed centrally by modulesync 2 | # https://github.com/maestrodev/puppet-modulesync 3 | 4 | HOSTS: 5 | centos-65-x64: 6 | roles: 7 | - master 8 | platform: el-6-x86_64 9 | box : centos-65-x64-virtualbox-nocm 10 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box 11 | hypervisor : vagrant 12 | CONFIG: 13 | log_level: debug 14 | type: git 15 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/debian-7-x64-docker.yml: -------------------------------------------------------------------------------- 1 | # This file is managed centrally by modulesync 2 | # https://github.com/maestrodev/puppet-modulesync 3 | 4 | HOSTS: 5 | debian-7-x64: 6 | roles: 7 | - master 8 | platform: debian-7-amd64 9 | image: debian:7 10 | # ip: localhost 11 | hypervisor : docker 12 | docker_image_commands: 13 | - useradd vagrant 14 | - "sed -ri 's/^#?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config" 15 | - "sed -ri 's/^#?PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config" 16 | docker_cmd: 17 | - 'sh' 18 | - '-c' 19 | - 'service ssh start; tail -f /dev/null' 20 | CONFIG: 21 | log_level: debug 22 | type: git 23 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/debian-7-x64.yml: -------------------------------------------------------------------------------- 1 | # This file is managed centrally by modulesync 2 | # https://github.com/maestrodev/puppet-modulesync 3 | 4 | HOSTS: 5 | debian-7-x64: 6 | roles: 7 | - master 8 | platform: debian-7-amd64 9 | box : debian-73-x64-virtualbox-nocm 10 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box 11 | hypervisor : vagrant 12 | CONFIG: 13 | log_level: debug 14 | type: git 15 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/debian-73-x64.yml: -------------------------------------------------------------------------------- 1 | # This file is managed centrally by modulesync 2 | # https://github.com/maestrodev/puppet-modulesync 3 | 4 | HOSTS: 5 | debian-73-x64: 6 | roles: 7 | - master 8 | platform: debian-7-amd64 9 | box : debian-73-x64-virtualbox-nocm 10 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box 11 | hypervisor : vagrant 12 | CONFIG: 13 | log_level: debug 14 | type: git 15 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/default.yml: -------------------------------------------------------------------------------- 1 | # This file is managed centrally by modulesync 2 | # https://github.com/maestrodev/puppet-modulesync 3 | 4 | HOSTS: 5 | centos-65-x64: 6 | roles: 7 | - master 8 | platform: el-6-x86_64 9 | image: devopsil/puppet:3.5.1 10 | # ip: localhost 11 | hypervisor : docker 12 | docker_image_commands: 13 | - yum -y install tar 14 | - useradd vagrant 15 | - "sed -ri 's/^#?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config" 16 | - "sed -ri 's/^#?PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config" 17 | docker_cmd: 18 | - 'sh' 19 | - '-c' 20 | - 'service sshd start; tail -f /dev/null' 21 | CONFIG: 22 | log_level: debug 23 | type: git 24 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This file is managed via modulesync 3 | # https://github.com/voxpupuli/modulesync 4 | # https://github.com/voxpupuli/modulesync_config 5 | # 6 | # Additional ~/.fog config file with AWS EC2 credentials 7 | # required. 8 | # 9 | # see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md 10 | # 11 | # Amazon Linux is not a RHEL clone. 12 | # 13 | HOSTS: 14 | amazonlinux-2016091-x64: 15 | roles: 16 | - master 17 | platform: centos-6-x86_64 18 | hypervisor: ec2 19 | # refers to image_tempaltes.yaml AMI[vmname] entry: 20 | vmname: amazonlinux-2016091-eu-central-1 21 | # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: 22 | snapshot: aio 23 | # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): 24 | amisize: t2.micro 25 | # required so that beaker sanitizes sshd_config and root authorized_keys: 26 | user: ec2-user 27 | CONFIG: 28 | type: aio 29 | :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml 30 | ... 31 | # vim: syntax=yaml 32 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ec2/image_templates.yaml: -------------------------------------------------------------------------------- 1 | # This file is managed via modulesync 2 | # https://github.com/voxpupuli/modulesync 3 | # https://github.com/voxpupuli/modulesync_config 4 | # 5 | # see also: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md 6 | # 7 | # Hint: image IDs (ami-*) for the same image are different per location. 8 | # 9 | AMI: 10 | # Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type 11 | amazonlinux-2016091-eu-central-1: 12 | :image: 13 | :aio: ami-af0fc0c0 14 | :region: eu-central-1 15 | # Red Hat Enterprise Linux 7.3 (HVM), SSD Volume Type 16 | rhel-73-eu-central-1: 17 | :image: 18 | :aio: ami-e4c63e8b 19 | :region: eu-central-1 20 | # SUSE Linux Enterprise Server 12 SP2 (HVM), SSD Volume Type 21 | sles-12sp2-eu-central-1: 22 | :image: 23 | :aio: ami-c425e4ab 24 | :region: eu-central-1 25 | # Ubuntu Server 16.04 LTS (HVM), SSD Volume Type 26 | ubuntu-1604-eu-central-1: 27 | :image: 28 | :aio: ami-fe408091 29 | :region: eu-central-1 30 | # Microsoft Windows Server 2016 Base 31 | windows-2016-base-eu-central-1: 32 | :image: 33 | :aio: ami-88ec20e7 34 | :region: eu-central-1 35 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ec2/rhel-73-x64.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This file is managed via modulesync 3 | # https://github.com/voxpupuli/modulesync 4 | # https://github.com/voxpupuli/modulesync_config 5 | # 6 | # Additional ~/.fog config file with AWS EC2 credentials 7 | # required. 8 | # 9 | # see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md 10 | # 11 | HOSTS: 12 | rhel-73-x64: 13 | roles: 14 | - master 15 | platform: el-7-x86_64 16 | hypervisor: ec2 17 | # refers to image_tempaltes.yaml AMI[vmname] entry: 18 | vmname: rhel-73-eu-central-1 19 | # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: 20 | snapshot: aio 21 | # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): 22 | amisize: t2.micro 23 | # required so that beaker sanitizes sshd_config and root authorized_keys: 24 | user: ec2-user 25 | CONFIG: 26 | type: aio 27 | :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml 28 | ... 29 | # vim: syntax=yaml 30 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This file is managed via modulesync 3 | # https://github.com/voxpupuli/modulesync 4 | # https://github.com/voxpupuli/modulesync_config 5 | # 6 | # Additional ~/.fog config file with AWS EC2 credentials 7 | # required. 8 | # 9 | # see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md 10 | # 11 | HOSTS: 12 | sles-12sp2-x64: 13 | roles: 14 | - master 15 | platform: sles-12-x86_64 16 | hypervisor: ec2 17 | # refers to image_tempaltes.yaml AMI[vmname] entry: 18 | vmname: sles-12sp2-eu-central-1 19 | # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: 20 | snapshot: aio 21 | # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): 22 | amisize: t2.micro 23 | # required so that beaker sanitizes sshd_config and root authorized_keys: 24 | user: ec2-user 25 | CONFIG: 26 | type: aio 27 | :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml 28 | ... 29 | # vim: syntax=yaml 30 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This file is managed via modulesync 3 | # https://github.com/voxpupuli/modulesync 4 | # https://github.com/voxpupuli/modulesync_config 5 | # 6 | # Additional ~/.fog config file with AWS EC2 credentials 7 | # required. 8 | # 9 | # see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md 10 | # 11 | HOSTS: 12 | ubuntu-1604-x64: 13 | roles: 14 | - master 15 | platform: ubuntu-16.04-amd64 16 | hypervisor: ec2 17 | # refers to image_tempaltes.yaml AMI[vmname] entry: 18 | vmname: ubuntu-1604-eu-central-1 19 | # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: 20 | snapshot: aio 21 | # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): 22 | amisize: t2.micro 23 | # required so that beaker sanitizes sshd_config and root authorized_keys: 24 | user: ubuntu 25 | CONFIG: 26 | type: aio 27 | :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml 28 | ... 29 | # vim: syntax=yaml 30 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This file is managed via modulesync 3 | # https://github.com/voxpupuli/modulesync 4 | # https://github.com/voxpupuli/modulesync_config 5 | # 6 | # Additional ~/.fog config file with AWS EC2 credentials 7 | # required. 8 | # 9 | # see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md 10 | # 11 | HOSTS: 12 | windows-2016-base-x64: 13 | roles: 14 | - master 15 | platform: windows-2016-64 16 | hypervisor: ec2 17 | # refers to image_tempaltes.yaml AMI[vmname] entry: 18 | vmname: windows-2016-base-eu-central-1 19 | # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]: 20 | snapshot: aio 21 | # t2.micro is free tier eligible (https://aws.amazon.com/en/free/): 22 | amisize: t2.micro 23 | # required so that beaker sanitizes sshd_config and root authorized_keys: 24 | user: ec2-user 25 | CONFIG: 26 | type: aio 27 | :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml 28 | ... 29 | # vim: syntax=yaml 30 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ubuntu-server-1310-x64.yml: -------------------------------------------------------------------------------- 1 | # This file is managed centrally by modulesync 2 | # https://github.com/maestrodev/puppet-modulesync 3 | 4 | HOSTS: 5 | ubuntu-server-1310-x64: 6 | roles: 7 | - master 8 | platform: ubuntu-13.10-amd64 9 | box : ubuntu-server-1310-x64-vbox4210-nocm 10 | box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-1310-x64-virtualbox-nocm.box 11 | hypervisor : vagrant 12 | CONFIG: 13 | log_level : debug 14 | type: git 15 | -------------------------------------------------------------------------------- /spec/acceptance/nodesets/ubuntu-server-1404-x64-docker.yml: -------------------------------------------------------------------------------- 1 | # This file is managed centrally by modulesync 2 | # https://github.com/maestrodev/puppet-modulesync 3 | 4 | HOSTS: 5 | ubuntu-server-1404-x64: 6 | roles: 7 | - master 8 | platform: ubuntu-14.04-amd64 9 | image: ubuntu:trusty 10 | # ip: localhost 11 | hypervisor : docker 12 | docker_image_commands: 13 | - useradd vagrant 14 | - "sed -ri 's/^#?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config" 15 | - "sed -ri 's/^#?PasswordAuthentication .*/PasswordAuthentication yes/' /etc/ssh/sshd_config" 16 | docker_cmd: 17 | - 'sh' 18 | - '-c' 19 | - 'service ssh start; tail -f /dev/null' 20 | CONFIG: 21 | log_level: debug 22 | type: git 23 | -------------------------------------------------------------------------------- /spec/acceptance/wget_system_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe 'wget' do 4 | let(:wget_manifest) { "class { 'wget': }" } 5 | let(:manifest) { wget_manifest } 6 | 7 | before do 8 | shell 'rm -f /tmp/index*' 9 | end 10 | 11 | context 'when running as root' do 12 | let(:manifest) do 13 | super() + %( 14 | wget::fetch { "download Google's index": 15 | source => 'http://www.google.com/index.html', 16 | destination => '/tmp/index.html', 17 | timeout => 0, 18 | verbose => false, 19 | } 20 | ) 21 | end 22 | 23 | it 'is idempotent' do 24 | apply_manifest(manifest, catch_failures: true) 25 | apply_manifest(manifest, catch_changes: true) 26 | shell('test -e /tmp/index.html') 27 | end 28 | end 29 | 30 | context 'when running as user' do 31 | before do 32 | apply_manifest(wget_manifest, catch_failures: true) 33 | end 34 | 35 | let(:manifest) do 36 | %( 37 | wget::fetch { 'download Google index': 38 | source => 'http://www.google.com/index.html', 39 | destination => '/tmp/index-vagrant.html', 40 | timeout => 0, 41 | verbose => false, 42 | } 43 | ) 44 | end 45 | 46 | it 'succeeds' do 47 | shell("cat << EOF | su - vagrant -c 'puppet apply --verbose --detailed-exitcodes --modulepath=/etc/puppet/modules'\n#{manifest}", acceptable_exit_codes: [2]) do |r| 48 | expect(r.stdout).to match(%r{Wget::Fetch\[download Google index\].*returns: executed successfully}) 49 | end 50 | shell('test -e /tmp/index-vagrant.html') 51 | end 52 | end 53 | 54 | context 'when running with source_hash' do 55 | before do 56 | apply_manifest(wget_manifest, catch_failures: true) 57 | end 58 | 59 | # the source_hash for the example.net index page might change over time 60 | 61 | let(:manifest) do 62 | %( 63 | wget::fetch { 'download RFC 2606': 64 | source => 'https://tools.ietf.org/rfc/rfc2606.txt', 65 | source_hash => 'c24c7a3118bafb5d7111f9ed5f73264b', 66 | destination => '/tmp/rfc-2606.txt', 67 | timeout => 0, 68 | verbose => false, 69 | } 70 | ) 71 | end 72 | 73 | it 'succeeds' do 74 | shell("cat << EOF | su - vagrant -c 'puppet apply --verbose --detailed-exitcodes --modulepath=/etc/puppet/modules'\n#{manifest}", acceptable_exit_codes: [2]) do |r| 75 | expect(r.stdout).to match(%r{Wget::Fetch\[download RFC 2606\].*returns: executed successfully}) 76 | end 77 | shell('test -e /tmp/rfc-2606.txt') 78 | end 79 | end 80 | end 81 | -------------------------------------------------------------------------------- /spec/classes/init_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'wget' do 4 | on_supported_os.each do |os, facts| 5 | next if %w[AIX windows SunOS].include? facts[:kernel] 6 | 7 | context "on #{os} " do 8 | let :facts do 9 | facts 10 | end 11 | 12 | context 'no version specified', :compile do 13 | it { is_expected.to contain_package('wget').with_ensure('present') } 14 | end 15 | 16 | context 'manage_package => false', :compile do 17 | let(:params) { { manage_package: false } } 18 | 19 | it { is_expected.not_to contain_package('wget').with_ensure('present') } 20 | end 21 | 22 | context 'version is present', :compile do 23 | let(:params) { { version: 'present' } } 24 | 25 | it { is_expected.to contain_package('wget').with_ensure('present') } 26 | end 27 | 28 | case facts[:kernel] 29 | when 'Darwin' 30 | context 'running on OS X', :compile do 31 | it { is_expected.not_to contain_package('wget') } 32 | end 33 | when 'FreeBSD' 34 | context 'running on FreeBSD', :compile do 35 | it { is_expected.to contain_package('wget') } 36 | end 37 | end 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /spec/defines/authfetch_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'wget::authfetch' do 4 | on_supported_os.each do |os, facts| 5 | next if %w[SunOS].include? facts[:kernel] 6 | 7 | context "on #{os} " do 8 | let :facts do 9 | facts 10 | end 11 | let(:title) { 'authtest' } 12 | let(:params) do 13 | { 14 | source: 'http://localhost/source', 15 | destination: destination, 16 | user: 'myuser', 17 | password: 'mypassword' 18 | } 19 | end 20 | 21 | let(:destination) { '/tmp/dest' } 22 | 23 | context 'with default params', :compile do 24 | it { 25 | is_expected.to contain_exec('wget-authtest').with('command' => "wget --no-verbose --user=myuser --output-document=\"#{destination}\" \"http://localhost/source\"", 26 | 'environment' => ["WGETRC=#{destination}.wgetrc"]) 27 | } 28 | it { is_expected.to contain_file("#{destination}.wgetrc").with_content('password=mypassword') } 29 | end 30 | 31 | context 'with user', :compile do 32 | let(:params) do 33 | super().merge(execuser: 'testuser') 34 | end 35 | 36 | it { 37 | is_expected.to contain_exec('wget-authtest').with('command' => "wget --no-verbose --user=myuser --output-document=\"#{destination}\" \"http://localhost/source\"", 38 | 'user' => 'testuser') 39 | } 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /spec/defines/fetch_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe 'wget::fetch' do 4 | on_supported_os.each do |os, facts| 5 | next if %w[windows SunOS].include? facts[:kernel] 6 | 7 | context "on #{os} " do 8 | let :facts do 9 | facts 10 | end 11 | let(:title) { 'test' } 12 | 13 | let(:params) do 14 | { 15 | source: 'http://localhost/source', 16 | destination: destination 17 | } 18 | end 19 | 20 | let(:destination) { '/tmp/dest' } 21 | 22 | context 'with default params', :compile do 23 | it { 24 | is_expected.to contain_exec('wget-test').with('command' => "wget --no-verbose --output-document=\"#{destination}\" \"http://localhost/source\"", 25 | 'environment' => []) 26 | } 27 | end 28 | 29 | context 'with user', :compile do 30 | let(:params) do 31 | super().merge(execuser: 'testuser') 32 | end 33 | 34 | it { 35 | is_expected.to contain_exec('wget-test').with('command' => "wget --no-verbose --output-document=\"#{destination}\" \"http://localhost/source\"", 36 | 'user' => 'testuser', 37 | 'environment' => []) 38 | } 39 | end 40 | 41 | context 'with authentication', :compile do 42 | let(:params) do 43 | super().merge(user: 'myuser', 44 | password: 'mypassword') 45 | end 46 | 47 | context 'with default params' do 48 | it { 49 | is_expected.to contain_exec('wget-test').with('command' => "wget --no-verbose --user=myuser --output-document=\"#{destination}\" \"http://localhost/source\"", 50 | 'environment' => ["WGETRC=#{destination}.wgetrc"]) 51 | } 52 | it { is_expected.to contain_file("#{destination}.wgetrc").with_content('password=mypassword') } 53 | end 54 | 55 | context 'with user', :compile do 56 | let(:params) do 57 | super().merge(execuser: 'testuser') 58 | end 59 | 60 | it { 61 | is_expected.to contain_exec('wget-test').with('command' => "wget --no-verbose --user=myuser --output-document=\"#{destination}\" \"http://localhost/source\"", 62 | 'user' => 'testuser', 63 | 'environment' => ["WGETRC=#{destination}.wgetrc"]) 64 | } 65 | end 66 | 67 | context 'using proxy', :compile do 68 | let(:facts) do 69 | super().merge(http_proxy: 'http://proxy:1000', 70 | https_proxy: 'http://proxy:1000') 71 | end 72 | 73 | it { 74 | is_expected.to contain_exec('wget-test').with('command' => "wget --no-verbose --user=myuser --output-document=\"#{destination}\" \"http://localhost/source\"", 75 | 'environment' => ['HTTP_PROXY=http://proxy:1000', 'http_proxy=http://proxy:1000', 'HTTPS_PROXY=http://proxy:1000', 'https_proxy=http://proxy:1000', "WGETRC=#{destination}.wgetrc"]) 76 | } 77 | it { is_expected.to contain_file("#{destination}.wgetrc").with_content('password=mypassword') } 78 | end 79 | end 80 | 81 | context 'with cache', :compile do 82 | let(:params) do 83 | super().merge(cache_dir: '/tmp/cache', 84 | execuser: 'testuser') 85 | end 86 | 87 | it { 88 | is_expected.to contain_exec('wget-test').with('command' => 'wget --no-verbose -N -P "/tmp/cache" "http://localhost/source"', 89 | 'environment' => []) 90 | } 91 | 92 | it { 93 | is_expected.to contain_file(destination.to_s).with('ensure' => 'file', 94 | 'source' => '/tmp/cache/source', 95 | 'owner' => 'testuser') 96 | } 97 | end 98 | 99 | context 'with cache file', :compile do 100 | let(:params) do 101 | super().merge(cache_dir: '/tmp/cache', 102 | cache_file: 'newsource', 103 | execuser: 'testuser') 104 | end 105 | 106 | it { 107 | is_expected.to contain_exec('wget-test').with('command' => 'wget --no-verbose -N -P "/tmp/cache" "http://localhost/source"', 108 | 'environment' => []) 109 | } 110 | 111 | it { 112 | is_expected.to contain_file(destination.to_s).with('ensure' => 'file', 113 | 'source' => '/tmp/cache/newsource', 114 | 'owner' => 'testuser') 115 | } 116 | end 117 | 118 | context 'with multiple headers', :compile do 119 | let(:params) do 120 | super().merge(headers: %w[header1 header2]) 121 | end 122 | 123 | it { 124 | is_expected.to contain_exec('wget-test').with('command' => "wget --no-verbose --header \"header1\" --header \"header2\" --output-document=\"#{destination}\" \"http://localhost/source\"", 125 | 'environment' => []) 126 | } 127 | end 128 | 129 | context 'with no-cookies', :compile do 130 | let(:params) do 131 | super().merge(no_cookies: true) 132 | end 133 | 134 | it { 135 | is_expected.to contain_exec('wget-test').with('command' => "wget --no-verbose --no-cookies --output-document=\"#{destination}\" \"http://localhost/source\"", 136 | 'environment' => []) 137 | } 138 | end 139 | 140 | context 'with flags', :compile do 141 | let(:params) do 142 | super().merge(flags: ['--flag1', '--flag2']) 143 | end 144 | 145 | it { 146 | is_expected.to contain_exec('wget-test').with('command' => "wget --no-verbose --output-document=\"#{destination}\" --flag1 --flag2 \"http://localhost/source\"", 147 | 'environment' => []) 148 | } 149 | end 150 | 151 | context 'with source_hash', :compile do 152 | let(:params) do 153 | super().merge(source_hash: 'd41d8cd98f00b204e9800998ecf8427e') 154 | end 155 | 156 | it { 157 | is_expected.to contain_exec('wget-test').with('command' => "wget --no-verbose --output-document=\"#{destination}\" \"http://localhost/source\" && echo 'd41d8cd98f00b204e9800998ecf8427e #{destination}' | md5sum -c --quiet", 158 | 'environment' => []) 159 | } 160 | 161 | it { 162 | is_expected.to contain_exec('wget-source_hash-check-test').with('command' => "test ! -e '#{destination}' || rm #{destination}", 163 | 'unless' => "echo 'd41d8cd98f00b204e9800998ecf8427e #{destination}' | md5sum -c --quiet") 164 | } 165 | end 166 | 167 | context 'download to dir', :compile do 168 | let(:params) do 169 | super().merge(destination: '/tmp/dest/') 170 | end 171 | 172 | it { 173 | is_expected.to contain_exec('wget-test').with('command' => "wget --no-verbose --output-document=\"#{destination}//source\" \"http://localhost/source\"", 174 | 'environment' => []) 175 | } 176 | end 177 | 178 | context 'with unless', :compile do 179 | let(:params) do 180 | super().merge(unless: "test $(ls -A #{destination} | head -1 2>/dev/null)") 181 | end 182 | 183 | it { 184 | is_expected.to contain_exec('wget-test').with('command' => "wget --no-verbose --output-document=\"#{destination}\" \"http://localhost/source\"", 185 | 'unless' => "test $(ls -A #{destination} | head -1 2>/dev/null)") 186 | } 187 | end 188 | end 189 | end 190 | end 191 | -------------------------------------------------------------------------------- /spec/fixtures/hiera.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # This file is managed centrally by modulesync 3 | # https://github.com/maestrodev/puppet-modulesync 4 | :backends: 5 | - rspec 6 | - yaml 7 | :yaml: 8 | :datadir: './spec/fixtures/hieradata' 9 | :hierarchy: 10 | - '%{::clientcert}' 11 | - 'default' 12 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # This file is managed via modulesync 2 | # https://github.com/voxpupuli/modulesync 3 | # https://github.com/voxpupuli/modulesync_config 4 | 5 | # puppetlabs_spec_helper will set up coverage if the env variable is set. 6 | # We want to do this if lib exists and it hasn't been explicitly set. 7 | ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__)) 8 | 9 | require 'voxpupuli/test/spec_helper' 10 | 11 | if File.exist?(File.join(__dir__, 'default_module_facts.yml')) 12 | facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml'))) 13 | if facts 14 | facts.each do |name, value| 15 | add_custom_fact name.to_sym, value 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /spec/spec_helper_acceptance.rb: -------------------------------------------------------------------------------- 1 | require 'voxpupuli/acceptance/spec_helper_acceptance' 2 | 3 | configure_beaker 4 | --------------------------------------------------------------------------------