├── .github └── workflows │ ├── datadog_ci_visibility.yml │ ├── docker_acceptance.yml │ └── rspec.yml ├── .gitignore ├── .rspec ├── .rubocop.yml ├── .yardopts ├── CHANGELOG.md ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── lib ├── vagrant-puppet-install.rb └── vagrant-puppet-install │ ├── action │ └── install_puppet.rb │ ├── config.rb │ ├── plugin.rb │ └── version.rb ├── locales └── en.yml ├── test ├── acceptance │ ├── aws │ │ └── Vagrantfile │ ├── digital_ocean │ │ └── Vagrantfile │ ├── docker │ │ └── Vagrantfile │ ├── rackspace │ │ └── Vagrantfile │ └── virtualbox │ │ └── Vagrantfile ├── support │ ├── environments │ │ └── vagrant │ │ │ └── manifests │ │ │ └── site.pp │ ├── manifests │ │ └── base.pp │ └── puppet_install_script │ │ └── shell_install.sh └── unit │ ├── spec_helper.rb │ └── vagrant-puppet-install │ ├── config_spec.rb │ └── plugin_spec.rb └── vagrant-puppet-install.gemspec /.github/workflows/datadog_ci_visibility.yml: -------------------------------------------------------------------------------- 1 | name: "Datadog CI Visibility" 2 | on: 3 | pull_request: 4 | push: 5 | schedule: 6 | - cron: '30 5,17 * * *' 7 | jobs: 8 | datadog_ci_visibility: 9 | runs-on: ubuntu-latest 10 | services: 11 | datadog-agent: 12 | image: gcr.io/datadoghq/agent:latest 13 | ports: 14 | - 8126:8126 15 | env: 16 | DD_API_KEY: ${{ secrets.DD_API_KEY }} 17 | DD_INSIDE_CI: "true" 18 | DD_HOSTNAME: "none" 19 | steps: 20 | - uses: actions/checkout@v2 21 | - uses: ruby/setup-ruby@v1 22 | with: 23 | ruby-version: "2.7" 24 | bundler-cache: true # runs 'bundle install' and caches installed gems automatically 25 | - run: bundle exec rake test:unit 26 | -------------------------------------------------------------------------------- /.github/workflows/docker_acceptance.yml: -------------------------------------------------------------------------------- 1 | name: "Docker Acceptance Tests" 2 | on: [push, pull_request] 3 | jobs: 4 | docker_acceptance: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v2 8 | - uses: ruby/setup-ruby@v1 9 | with: 10 | ruby-version: "2.7" 11 | bundler-cache: true # runs 'bundle install' and caches installed gems automatically 12 | - run: bundle exec rake test:docker_acceptance -------------------------------------------------------------------------------- /.github/workflows/rspec.yml: -------------------------------------------------------------------------------- 1 | name: "Rspec Unit Tests" 2 | on: [push, pull_request] 3 | jobs: 4 | rspec: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v2 8 | - uses: ruby/setup-ruby@v1 9 | with: 10 | ruby-version: "2.7" 11 | bundler-cache: true # runs 'bundle install' and caches installed gems automatically 12 | - run: bundle exec rake test:unit 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Gemfile.lock 2 | *.gem 3 | *.rbc 4 | .bundle 5 | .config 6 | .yardoc 7 | InstalledFiles 8 | _yardoc 9 | coverage 10 | doc/ 11 | lib/bundler/man 12 | pkg 13 | rdoc 14 | spec/reports 15 | test/tmp 16 | test/version_tmp 17 | tmp 18 | bin/ 19 | .vagrant/ 20 | .idea/ 21 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --default_path test/unit 2 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | Excludes: 3 | - vendor/** 4 | - bin/** 5 | Encoding: 6 | Enabled: false 7 | ClassLength: 8 | Enabled: false 9 | MethodLength: 10 | Enabled: false -------------------------------------------------------------------------------- /.yardopts: -------------------------------------------------------------------------------- 1 | --markup=markdown 2 | --markup-provider=redcarpet 3 | --readme=README.md 4 | - 5 | CHANGELOG.md 6 | LICENSE 7 | TODO.md 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | 6 | ## [v6.0.1](https://github.com/petems/vagrant-puppet-install/tree/v6.0.1) (2019-04-10) 7 | [Full Changelog](https://github.com/petems/vagrant-puppet-install/compare/v6.0.1...v6.0.1) 8 | 9 | **Fixed bugs:** 10 | 11 | - Syntax error since Puppet 6 support added [\#64](https://github.com/petems/vagrant-puppet-install/issues/64) 12 | 13 | ## [v6.0.1](https://github.com/petems/vagrant-puppet-install/tree/v6.0.1) (2019-04-10) 14 | [Full Changelog](https://github.com/petems/vagrant-puppet-install/compare/v6.0.0...v6.0.1) 15 | 16 | **Closed issues:** 17 | 18 | - Issues with Ubuntu 17.10? [\#60](https://github.com/petems/vagrant-puppet-install/issues/60) 19 | 20 | ## [v6.0.0](https://github.com/petems/vagrant-puppet-install/tree/v6.0.0) (2019-04-07) 21 | [Full Changelog](https://github.com/petems/vagrant-puppet-install/compare/v5.0.0...v6.0.0) 22 | 23 | **Closed issues:** 24 | 25 | - '4.9.10' is not a valid version of Puppet [\#56](https://github.com/petems/vagrant-puppet-install/issues/56) 26 | - Incorrect install script used for default\_install\_url when version is latest [\#55](https://github.com/petems/vagrant-puppet-install/issues/55) 27 | 28 | **Merged pull requests:** 29 | 30 | - Add support for Puppet 6 [\#61](https://github.com/petems/vagrant-puppet-install/pull/61) ([dhoppe](https://github.com/dhoppe)) 31 | - Bump version to 5.0.1 [\#59](https://github.com/petems/vagrant-puppet-install/pull/59) ([petems](https://github.com/petems)) 32 | - Fixes Travis config [\#58](https://github.com/petems/vagrant-puppet-install/pull/58) ([petems](https://github.com/petems)) 33 | - Fixes security issues detected by Github [\#57](https://github.com/petems/vagrant-puppet-install/pull/57) ([petems](https://github.com/petems)) 34 | 35 | ## [v5.0.0](https://github.com/petems/vagrant-puppet-install/tree/v5.0.0) (2017-07-11) 36 | [Full Changelog](https://github.com/petems/vagrant-puppet-install/compare/v4.1.0...v5.0.0) 37 | 38 | **Closed issues:** 39 | 40 | - Please document the config.puppet\_install.install\_url parameter [\#53](https://github.com/petems/vagrant-puppet-install/issues/53) 41 | - PuppetLabs repository install is skipped [\#52](https://github.com/petems/vagrant-puppet-install/issues/52) 42 | - Ubuntu 16.04 [\#51](https://github.com/petems/vagrant-puppet-install/issues/51) 43 | - \[Debian\] Version '3.7.2-1puppetlabs1' for 'puppet-common' was not found [\#48](https://github.com/petems/vagrant-puppet-install/issues/48) 44 | 45 | **Merged pull requests:** 46 | 47 | - Adding puppet5 support [\#54](https://github.com/petems/vagrant-puppet-install/pull/54) ([attachmentgenie](https://github.com/attachmentgenie)) 48 | - Update vagrant examples [\#50](https://github.com/petems/vagrant-puppet-install/pull/50) ([petems](https://github.com/petems)) 49 | 50 | ## [v4.1.0](https://github.com/petems/vagrant-puppet-install/tree/v4.1.0) (2016-04-23) 51 | [Full Changelog](https://github.com/petems/vagrant-puppet-install/compare/v4.0.1...v4.1.0) 52 | 53 | **Closed issues:** 54 | 55 | - "offline" mode? [\#37](https://github.com/petems/vagrant-puppet-install/issues/37) 56 | 57 | **Merged pull requests:** 58 | 59 | - Update Vagrantfile [\#49](https://github.com/petems/vagrant-puppet-install/pull/49) ([gesinn-it](https://github.com/gesinn-it)) 60 | - Add validation option [\#46](https://github.com/petems/vagrant-puppet-install/pull/46) ([petems](https://github.com/petems)) 61 | 62 | ## [v4.0.1](https://github.com/petems/vagrant-puppet-install/tree/v4.0.1) (2016-04-04) 63 | [Full Changelog](https://github.com/petems/vagrant-puppet-install/compare/v4.0.0...v4.0.1) 64 | 65 | **Closed issues:** 66 | 67 | - Machine is force to shutdown and destroyed after puppet is installed [\#42](https://github.com/petems/vagrant-puppet-install/issues/42) 68 | - How to install the latest available version of puppet? [\#41](https://github.com/petems/vagrant-puppet-install/issues/41) 69 | 70 | **Merged pull requests:** 71 | 72 | - Adds acceptance test for Fedora 23 [\#47](https://github.com/petems/vagrant-puppet-install/pull/47) ([petems](https://github.com/petems)) 73 | - Fixes Vagrant on Puppet \> 4 for acceptance [\#45](https://github.com/petems/vagrant-puppet-install/pull/45) ([petems](https://github.com/petems)) 74 | - Rubocop fixes [\#44](https://github.com/petems/vagrant-puppet-install/pull/44) ([petems](https://github.com/petems)) 75 | - Fixes unlink code to work on Windows machines [\#43](https://github.com/petems/vagrant-puppet-install/pull/43) ([petems](https://github.com/petems)) 76 | 77 | ## [v4.0.0](https://github.com/petems/vagrant-puppet-install/tree/v4.0.0) (2016-01-25) 78 | [Full Changelog](https://github.com/petems/vagrant-puppet-install/compare/v3.1.0...v4.0.0) 79 | 80 | **Closed issues:** 81 | 82 | - Empty puppet\_version gives error. [\#38](https://github.com/petems/vagrant-puppet-install/issues/38) 83 | 84 | **Merged pull requests:** 85 | 86 | - Removes pessimistic reference from docs [\#40](https://github.com/petems/vagrant-puppet-install/pull/40) ([petems](https://github.com/petems)) 87 | - Fix nil errors [\#39](https://github.com/petems/vagrant-puppet-install/pull/39) ([petems](https://github.com/petems)) 88 | 89 | ## [v3.1.0](https://github.com/petems/vagrant-puppet-install/tree/v3.1.0) (2016-01-21) 90 | [Full Changelog](https://github.com/petems/vagrant-puppet-install/compare/v3.0.0...v3.1.0) 91 | 92 | **Closed issues:** 93 | 94 | - rake beaker errors with vagrant-puppet-install loaded [\#35](https://github.com/petems/vagrant-puppet-install/issues/35) 95 | - apt repo issue \(no puppet-agent found\) trying to install puppet 4.3.1 [\#32](https://github.com/petems/vagrant-puppet-install/issues/32) 96 | - The package is just called puppet-agent [\#31](https://github.com/petems/vagrant-puppet-install/issues/31) 97 | - Vagrant Puppet Install does not work on Puppet \>= 4 [\#29](https://github.com/petems/vagrant-puppet-install/issues/29) 98 | - Cannot install 'vagrant-puppet-install' on Windows 7 [\#25](https://github.com/petems/vagrant-puppet-install/issues/25) 99 | - Allow installing Facter [\#17](https://github.com/petems/vagrant-puppet-install/issues/17) 100 | 101 | **Merged pull requests:** 102 | 103 | - Don't do anything with puppet\_version is not set. [\#36](https://github.com/petems/vagrant-puppet-install/pull/36) ([glenjamin](https://github.com/glenjamin)) 104 | - .idea folder exclude \(all jetbrains IDEs\). [\#34](https://github.com/petems/vagrant-puppet-install/pull/34) ([MikeCaspar](https://github.com/MikeCaspar)) 105 | - Add a new Vagrant box to test Ubuntu machines [\#33](https://github.com/petems/vagrant-puppet-install/pull/33) ([petems](https://github.com/petems)) 106 | 107 | ## [v3.0.0](https://github.com/petems/vagrant-puppet-install/tree/v3.0.0) (2015-12-15) 108 | [Full Changelog](https://github.com/petems/vagrant-puppet-install/compare/v2.7.0...v3.0.0) 109 | 110 | **Closed issues:** 111 | 112 | - pessimistic version constraint [\#26](https://github.com/petems/vagrant-puppet-install/issues/26) 113 | - 2.7.\* is not a valid version of puppet [\#23](https://github.com/petems/vagrant-puppet-install/issues/23) 114 | - Puppet installation@Centos7.0@Parallels10.1.1@OS X 10.10.1 cannot find the rpm file [\#20](https://github.com/petems/vagrant-puppet-install/issues/20) 115 | - Fails on Utopic Unicorn [\#16](https://github.com/petems/vagrant-puppet-install/issues/16) 116 | - https://raw2.github.com/petems/puppet-install-shell/master/install\_puppet.sh Not found [\#15](https://github.com/petems/vagrant-puppet-install/issues/15) 117 | - Works on CentOS with VMware Fusion [\#8](https://github.com/petems/vagrant-puppet-install/issues/8) 118 | - Doesn't work on Ubuntu 12.04 Baseboxes :-\( [\#6](https://github.com/petems/vagrant-puppet-install/issues/6) 119 | 120 | **Merged pull requests:** 121 | 122 | - Fix to allow Puppet 4 install [\#30](https://github.com/petems/vagrant-puppet-install/pull/30) ([petems](https://github.com/petems)) 123 | - Corrects \#26 pessimistic version constraint and passes unit tests [\#28](https://github.com/petems/vagrant-puppet-install/pull/28) ([srhopkins](https://github.com/srhopkins)) 124 | - Adds spec to check using ~\> resolution for version [\#24](https://github.com/petems/vagrant-puppet-install/pull/24) ([petems](https://github.com/petems)) 125 | - New test for \#6 [\#22](https://github.com/petems/vagrant-puppet-install/pull/22) ([petems](https://github.com/petems)) 126 | - Add plugin spec [\#19](https://github.com/petems/vagrant-puppet-install/pull/19) ([petems](https://github.com/petems)) 127 | - Bump Vagrant to v1.7.0 [\#18](https://github.com/petems/vagrant-puppet-install/pull/18) ([scottsuch](https://github.com/scottsuch)) 128 | - Make badges pretty [\#12](https://github.com/petems/vagrant-puppet-install/pull/12) ([scottsuch](https://github.com/scottsuch)) 129 | 130 | ## [v2.7.0](https://github.com/petems/vagrant-puppet-install/tree/v2.7.0) (2014-11-21) 131 | [Full Changelog](https://github.com/petems/vagrant-puppet-install/compare/v2.6.0...v2.7.0) 132 | 133 | **Closed issues:** 134 | 135 | - Github url for puppet-install-shell has changed [\#10](https://github.com/petems/vagrant-puppet-install/issues/10) 136 | 137 | **Merged pull requests:** 138 | 139 | - Close \#10 Updates location for installer script [\#14](https://github.com/petems/vagrant-puppet-install/pull/14) ([petems](https://github.com/petems)) 140 | - Need Vagrant to be ok with bundler 1.7 [\#13](https://github.com/petems/vagrant-puppet-install/pull/13) ([petems](https://github.com/petems)) 141 | 142 | ## [v2.6.0](https://github.com/petems/vagrant-puppet-install/tree/v2.6.0) (2014-08-04) 143 | [Full Changelog](https://github.com/petems/vagrant-puppet-install/compare/v2.5.0...v2.6.0) 144 | 145 | **Closed issues:** 146 | 147 | - Plugin should be disabled if `config.puppet\_install.puppet\_version` is not present [\#7](https://github.com/petems/vagrant-puppet-install/issues/7) 148 | - Does not work on CentOS 32-bit BaseBox [\#5](https://github.com/petems/vagrant-puppet-install/issues/5) 149 | 150 | ## [v2.5.0](https://github.com/petems/vagrant-puppet-install/tree/v2.5.0) (2014-08-03) 151 | **Closed issues:** 152 | 153 | - "Not a valid version of Puppet" error [\#3](https://github.com/petems/vagrant-puppet-install/issues/3) 154 | - 1.4 / 1.5 vagrant compatibility [\#1](https://github.com/petems/vagrant-puppet-install/issues/1) 155 | 156 | **Merged pull requests:** 157 | 158 | - Install url tests and readme [\#4](https://github.com/petems/vagrant-puppet-install/pull/4) ([petems](https://github.com/petems)) 159 | - Pulling from omnibus [\#2](https://github.com/petems/vagrant-puppet-install/pull/2) ([petems](https://github.com/petems)) 160 | 161 | 162 | 163 | \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gemspec 4 | 5 | group :development do 6 | # We depend on Vagrant for development, but we don't add it as a 7 | # gem dependency because we expect to be installed within the 8 | # Vagrant environment itself using `vagrant plugin`. 9 | gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git', tag: 'v2.2.14' 10 | end -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vagrant-puppet-install 2 | 3 | [![Gem Version](http://img.shields.io/gem/v/vagrant-puppet-install.svg)][gem] 4 | [![Build Status](http://img.shields.io/travis/petems/vagrant-puppet-install.svg)][travis] 5 | 6 | [gem]: https://rubygems.org/gems/vagrant-puppet-install 7 | [travis]: http://travis-ci.org/petems/vagrant-puppet-install 8 | 9 | A Vagrant plugin that ensures the desired version of Puppet is installed via the 10 | Puppet Labs package repo. This proves very useful when using Vagrant 11 | with provisioner-less baseboxes OR cloud images. 12 | 13 | This plugin has been verified to work with the following 14 | [Vagrant providers](http://docs.vagrantup.com/v2/providers/index.html): 15 | 16 | * VirtualBox (part of core) 17 | * AWS (ships in [vagrant-aws](https://github.com/mitchellh/vagrant-aws) plugin) 18 | * Rackspace (ships in [vagrant-rackspace](https://github.com/mitchellh/vagrant-rackspace) plugin) 19 | * DigitalOcean (ships in [vagrant-digital_ocean](https://github.com/smdahlen/vagrant-digitalocean) plugin) 20 | 21 | It may work with other Vagrant providers but is not guaranteed to! 22 | 23 | ## Installation 24 | 25 | Ensure you have downloaded and installed Vagrant 1.1.x from the 26 | [Vagrant downloads page](http://downloads.vagrantup.com/). 27 | 28 | Installation is performed in the prescribed manner for Vagrant 1.1 plugins. 29 | 30 | ``` 31 | $ vagrant plugin install vagrant-puppet-install 32 | ``` 33 | 34 | ## Usage 35 | 36 | The Puppet Install Vagrant plugin automatically hooks into the Vagrant provisioning 37 | middleware. You specify the version of the `puppet-common` package you want 38 | installed using the `puppet_install.puppet_version` config key. The version string 39 | should be a valid Puppet release (ie. `2.7.11`, `3.7.4`, etc.). 40 | 41 | The Puppet version is validated against the RubyGems API. So as long as the version you give is [listed there](https://rubygems.org/gems/puppet/versions/), it will allow you to install. 42 | 43 | You may wish to disable this validation. This could be useful if you've got limited bandwidth on a bad internet connection or you're on a proxy, or your specifying a version that won't match against the RubyGems API (such as a custom patched version of Puppet). 44 | 45 | If you wish to disable this validation you can disable it like so: 46 | 47 | ```ruby 48 | Vagrant.configure("2") do |config| 49 | 50 | config.puppet_install.validate_version = false 51 | 52 | ... 53 | 54 | end 55 | ``` 56 | 57 | Install the latest version of Puppet: 58 | 59 | ```ruby 60 | Vagrant.configure("2") do |config| 61 | 62 | config.puppet_install.puppet_version = :latest 63 | 64 | ... 65 | 66 | end 67 | ``` 68 | 69 | Install a specific version of Puppet: 70 | 71 | ```ruby 72 | Vagrant.configure("2") do |config| 73 | 74 | config.puppet_install.puppet_version = "2.7.11" 75 | 76 | ... 77 | 78 | end 79 | ``` 80 | 81 | Specify a custom install script: 82 | 83 | ```ruby 84 | Vagrant.configure("2") do |config| 85 | 86 | config.puppet_install.install_url = 'http://acme.com/install.sh' 87 | # config.puppet_install.install_url = 'http://acme.com/install.msi' 88 | # config.puppet_install.install_url = '/some/path/on/the/host' 89 | 90 | ... 91 | 92 | end 93 | ``` 94 | 95 | ## Tests 96 | 97 | ### Unit 98 | 99 | The unit tests can be run with: 100 | 101 | ``` 102 | bundle exec rake 103 | #or 104 | bundle exec rake test:unit 105 | ``` 106 | 107 | The test are also executed by Travis CI every time code is pushed to GitHub. 108 | 109 | ### Acceptance 110 | 111 | The acceptance tests will be run against the Vagrant providers mentioned above. 112 | 113 | The acceptance tests can be run with: 114 | 115 | ``` 116 | # to run them all 117 | rake test:acceptance 118 | # or specify a provider 119 | rake test:acceptance['virtualbox'] 120 | ``` 121 | 122 | And as expected, all acceptance tests only uses provisioner-less baseboxes and 123 | cloud images! 124 | 125 | ## Contributing 126 | 127 | 1. Fork it 128 | 2. Create your feature branch (`git checkout -b my-new-feature`) 129 | 3. Commit your changes (`git commit -am 'Add some feature'`) 130 | 4. Push to the branch (`git push origin my-new-feature`) 131 | 5. Create new Pull Request 132 | 133 | ## Authors 134 | 135 | Patrick Connolly 136 | Martin Lazarov 137 | Peter Souter 138 | 139 | ### Adapted from original code by 140 | 141 | Seth Chisamore 142 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler/setup' 2 | require 'rubygems/tasks' 3 | require 'rspec/core/rake_task' 4 | require 'rubocop/rake_task' 5 | require 'yard' 6 | 7 | YARD::Rake::YardocTask.new 8 | 9 | Gem::Tasks.new 10 | 11 | begin 12 | require 'github_changelog_generator/task' 13 | require 'vagrant-puppet-install/version' 14 | GitHubChangelogGenerator::RakeTask.new :changelog do |config| 15 | version = VagrantPlugins::PuppetInstall::VERSION 16 | config.future_release = "v#{version}" 17 | config.header = "# Change Log\n\nAll notable changes to this project will be documented in this file.\n" 18 | config.exclude_labels = %w{duplicate question invalid wontfix modulesync} 19 | end 20 | rescue LoadError 21 | end 22 | 23 | desc 'Validate ruby files' 24 | task :validate do 25 | Dir['test/**/*.rb', 'lib/**/*.rb'].each do |ruby_file| 26 | sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec/fixtures} 27 | end 28 | end 29 | 30 | namespace :test do 31 | RSpec::Core::RakeTask.new(:unit) do |t| 32 | t.pattern = 'test/unit/**/*_spec.rb' 33 | end 34 | 35 | desc 'Run acceptance tests..these actually launch Vagrant sessions.' 36 | task :acceptance, :provider do |_t, args| 37 | # ensure all required dummy boxen are installed 38 | %w( aws rackspace ).each do |provider| 39 | unless system("vagrant box list | grep 'dummy\s*(#{provider})' &>/dev/null") 40 | system("vagrant box add dummy https://github.com/mitchellh/vagrant-#{provider}/raw/master/dummy.box") 41 | end 42 | end 43 | 44 | unless system("vagrant box list | grep 'digital_ocean' &>/dev/null") 45 | system('vagrant box add digital_ocean https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box') 46 | end 47 | 48 | all_providers = Dir['test/acceptance/*'].map { |dir| File.basename(File.expand_path(dir)) } 49 | 50 | # If a provider wasn't passed to the task run acceptance tests against 51 | # ALL THE PROVIDERS! 52 | providers = if args[:provider] && all_providers.include?(args[:provider]) 53 | [args[:provider]] 54 | else 55 | all_providers 56 | end 57 | 58 | providers.each do |provider| 59 | puts '==================================================================' 60 | puts "Running acceptance tests against '#{provider}' provider..." 61 | puts '==================================================================' 62 | 63 | Dir.chdir("test/acceptance/#{provider}") do 64 | system('vagrant destroy -f') 65 | system("vagrant up --provider=#{provider} --provision") 66 | system('vagrant destroy -f') 67 | end 68 | end 69 | end 70 | 71 | desc 'Run docker acceptance test - Used in CI' 72 | task :docker_acceptance do |_t, args| 73 | puts '==================================================================' 74 | puts "Running acceptance tests against Docker provider..." 75 | puts '==================================================================' 76 | 77 | Dir.chdir("test/acceptance/docker") do 78 | system('vagrant destroy -f') 79 | system("vagrant up --provider=docker --provision") 80 | system('vagrant destroy -f') 81 | end 82 | end 83 | end 84 | 85 | task default: 'test:unit' 86 | -------------------------------------------------------------------------------- /lib/vagrant-puppet-install.rb: -------------------------------------------------------------------------------- 1 | require 'vagrant' 2 | require 'vagrant-puppet-install/plugin' 3 | require 'vagrant-puppet-install/config' 4 | 5 | module VagrantPlugins 6 | # 7 | module PuppetInstall 8 | def self.source_root 9 | @source_root ||= Pathname.new(File.expand_path('../../', __FILE__)) 10 | end 11 | 12 | I18n.load_path << File.expand_path('locales/en.yml', source_root) 13 | I18n.reload! 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /lib/vagrant-puppet-install/action/install_puppet.rb: -------------------------------------------------------------------------------- 1 | require 'log4r' 2 | require 'shellwords' 3 | 4 | require 'vagrant/util/downloader' 5 | 6 | module VagrantPlugins 7 | module PuppetInstall 8 | module Action 9 | class InstallPuppet 10 | def initialize(app, env) 11 | @app = app 12 | @logger = 13 | Log4r::Logger.new('vagrantplugins::puppet_install::action::installpuppet') 14 | @machine = env[:machine] 15 | @install_script = find_install_script 16 | @machine.config.puppet_install.finalize! 17 | end 18 | 19 | def call(env) 20 | @app.call(env) 21 | 22 | return unless @machine.communicate.ready? && provision_enabled?(env) 23 | 24 | # Perform delayed validation 25 | @machine.config.puppet_install.validate!(@machine) 26 | 27 | desired_version = @machine.config.puppet_install.puppet_version 28 | unless desired_version.nil? 29 | if installed_version == desired_version 30 | env[:ui].info I18n.t( 31 | 'vagrant-puppet_install.action.installed', 32 | version: desired_version 33 | ) 34 | else 35 | fetch_or_create_install_script(env) 36 | env[:ui].info I18n.t( 37 | 'vagrant-puppet_install.action.installing', 38 | version: desired_version 39 | ) 40 | install(desired_version, env) 41 | recover(env) 42 | end 43 | end 44 | end 45 | 46 | private 47 | 48 | def config_install_url 49 | @machine.config.puppet_install.install_url 50 | end 51 | 52 | def env_install_url 53 | ENV['PUPPET_INSTALL_URL'] 54 | end 55 | 56 | def find_install_script 57 | config_install_url || env_install_url || default_install_url 58 | end 59 | 60 | def default_install_url 61 | if @machine.config.puppet_install.puppet_version.nil? 62 | nil 63 | elsif windows_guest? 64 | # No Windows Version yet 65 | else 66 | if @machine.config.puppet_install.puppet_version == 'latest' || @machine.config.puppet_install.puppet_version.match(/^7\..+/) 67 | 'https://raw.githubusercontent.com/petems/puppet-install-shell/master/install_puppet_7_agent.sh' 68 | elsif @machine.config.puppet_install.puppet_version.match(/^6\..+/) 69 | 'https://raw.githubusercontent.com/petems/puppet-install-shell/master/install_puppet_6_agent.sh' 70 | elsif @machine.config.puppet_install.puppet_version.match(/^5\..+/) 71 | 'https://raw.githubusercontent.com/petems/puppet-install-shell/master/install_puppet_5_agent.sh' 72 | elsif @machine.config.puppet_install.puppet_version.match(/^4\..+/) 73 | 'https://raw.githubusercontent.com/petems/puppet-install-shell/master/install_puppet_agent.sh' 74 | else 75 | 'https://raw.githubusercontent.com/petems/puppet-install-shell/master/install_puppet.sh' 76 | end 77 | end 78 | end 79 | 80 | def install_script_name 81 | if windows_guest? 82 | # No Windows Version yet 83 | else 84 | 'install.sh' 85 | end 86 | end 87 | 88 | def windows_guest? 89 | @machine.config.vm.guest.eql?(:windows) 90 | end 91 | 92 | def provision_enabled?(env) 93 | env.fetch(:provision_enabled, true) 94 | end 95 | 96 | def installed_version 97 | version = nil 98 | opts = nil 99 | if windows_guest? 100 | # Not sure how to do this yet... 101 | else 102 | command = 'echo $(puppet --version)' 103 | end 104 | @machine.communicate.sudo(command, opts) do |type, data| 105 | if [:stderr, :stdout].include?(type) 106 | version_match = data.match(/^(.+)/) 107 | version = version_match.captures[0].strip if version_match 108 | end 109 | end 110 | version 111 | end 112 | 113 | # 114 | # Upload install script from Host's Vagrant TMP directory to guest 115 | # and executes. 116 | # 117 | def install(version, env) 118 | shell_escaped_version = Shellwords.escape(version) 119 | 120 | @machine.communicate.tap do |comm| 121 | comm.upload(@script_tmp_path, install_script_name) 122 | if windows_guest? 123 | # Not sure yet... 124 | else 125 | install_cmd = "sh #{install_script_name}" 126 | install_cmd << " -v #{shell_escaped_version}" 127 | install_cmd << ' 2>&1' 128 | end 129 | comm.sudo(install_cmd) do |type, data| 130 | if [:stderr, :stdout].include?(type) 131 | next if data =~ /stdin: is not a tty/ 132 | env[:ui].info(data) 133 | end 134 | end 135 | end 136 | end 137 | 138 | # 139 | # Fetches or creates a platform specific install script to the Host's 140 | # Vagrant TMP directory. 141 | # 142 | def fetch_or_create_install_script(env) 143 | @script_tmp_path = 144 | env[:tmp_path].join("#{Time.now.to_i}-#{install_script_name}") 145 | 146 | @logger.info("Generating install script at: #{@script_tmp_path}") 147 | 148 | url = @install_script 149 | 150 | if File.file?(url) || url !~ /^[a-z0-9]+:.*$/i 151 | @logger.info('Assuming URL is a file.') 152 | file_path = File.expand_path(url) 153 | file_path = Vagrant::Util::Platform.cygwin_windows_path(file_path) 154 | url = "file:#{file_path}" 155 | end 156 | 157 | # Download the install.sh or create install.bat file to a temporary 158 | # path. We store the temporary path as an instance variable so that 159 | # the `#recover` method can access it. 160 | begin 161 | if windows_guest? 162 | # Not sure how to do this in Windows yet... 163 | else 164 | downloader = Vagrant::Util::Downloader.new( 165 | url, 166 | @script_tmp_path, 167 | {} 168 | ) 169 | downloader.download! 170 | end 171 | rescue Vagrant::Errors::DownloaderInterrupted 172 | # The downloader was interrupted, so just return, because that 173 | # means we were interrupted as well. 174 | env[:ui].info(I18n.t('vagrant-puppet_install.download.interrupted')) 175 | return 176 | end 177 | end 178 | 179 | def recover(_env) 180 | if @script_tmp_path && File.exist?(@script_tmp_path) 181 | # Try extra hard to unlink the file so that it reliably works 182 | # on Windows hosts as well, see: 183 | # http://alx.github.io/2009/01/27/ruby-wundows-unlink.html 184 | file_deleted = false 185 | until file_deleted 186 | begin 187 | File.unlink(@script_tmp_path) 188 | file_deleted = true 189 | rescue Errno::EACCES 190 | @logger.debug("failed to unlink #{@script_tmp_path}. retry...") 191 | end 192 | end 193 | end 194 | end 195 | end 196 | end 197 | end 198 | end 199 | -------------------------------------------------------------------------------- /lib/vagrant-puppet-install/config.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems/dependency' 2 | require 'rubygems/dependency_installer' 3 | require 'vagrant' 4 | 5 | module VagrantPlugins 6 | module PuppetInstall 7 | class Config < Vagrant.plugin('2', :config) 8 | attr_accessor :puppet_version, :install_url, :validate_version 9 | 10 | def initialize 11 | @puppet_version = UNSET_VALUE 12 | @install_url = UNSET_VALUE 13 | @validate_version = UNSET_VALUE 14 | @logger = Log4r::Logger.new('vagrantplugins::puppet_install::config') 15 | end 16 | 17 | def finalize! 18 | if @puppet_version == UNSET_VALUE 19 | @puppet_version = nil 20 | elsif @puppet_version.to_s == 'latest' 21 | # resolve `latest` to a real version 22 | @puppet_version = retrieve_latest_puppet_version 23 | end 24 | @validate_version = nil if @validate_version == UNSET_VALUE 25 | @install_url = nil if @install_url == UNSET_VALUE 26 | end 27 | 28 | def validate!(_machine) 29 | finalize! 30 | errors = [] 31 | 32 | if falsey?(validate_version) 33 | @logger.debug("Not validating version due to validate_version being false") 34 | else 35 | if !puppet_version.nil? && !valid_puppet_version?(puppet_version) 36 | msg = <<-EOH 37 | '#{ puppet_version }' is not a valid version of Puppet. 38 | 39 | A list of valid versions can be found at: http://docs.puppetlabs.com/release_notes/ 40 | EOH 41 | errors << msg 42 | end 43 | end 44 | 45 | if errors.any? 46 | rendered_errors = Vagrant::Util::TemplateRenderer.render( 47 | 'config/validation_failed', 48 | errors: { 'vagrant-puppet-install' => errors } 49 | ) 50 | raise Vagrant::Errors::ConfigInvalid, errors: rendered_errors 51 | end 52 | end 53 | 54 | private 55 | 56 | # Query RubyGems.org's Ruby API and retrive the latest version of Puppet. 57 | def retrieve_latest_puppet_version 58 | available_gems = 59 | dependency_installer.find_gems_with_sources(puppet_gem_dependency) 60 | spec, _source = 61 | if available_gems.respond_to?(:last) 62 | # DependencyInstaller sorts the results such that the last one is 63 | # always the one it considers best. 64 | spec_with_source = available_gems.last 65 | spec_with_source 66 | else 67 | # Rubygems 2.0 returns a Gem::Available set, which is a 68 | # collection of AvailableSet::Tuple structs 69 | available_gems.pick_best! 70 | best_gem = available_gems.set.first 71 | best_gem && [best_gem.spec, best_gem.source] 72 | end 73 | 74 | spec && spec.version.to_s 75 | end 76 | 77 | # Query RubyGems.org's Ruby API to see if the user-provided Puppet version 78 | # is in fact a real Puppet version! 79 | def valid_puppet_version?(version) 80 | is_valid = false 81 | begin 82 | available = dependency_installer.find_gems_with_sources( 83 | puppet_gem_dependency(version) 84 | ) 85 | is_valid = true unless available.empty? 86 | rescue ArgumentError => e 87 | @logger.debug("#{version} is not a valid Puppet version: #{e}") 88 | end 89 | is_valid 90 | end 91 | 92 | def dependency_installer 93 | @dependency_installer ||= Gem::DependencyInstaller.new 94 | end 95 | 96 | def puppet_gem_dependency(version = nil) 97 | Gem::Dependency.new('puppet', version) 98 | end 99 | 100 | def falsey?(falsey_value) 101 | true if [false,:false,'false'].include?(falsey_value) 102 | end 103 | end 104 | end 105 | end 106 | -------------------------------------------------------------------------------- /lib/vagrant-puppet-install/plugin.rb: -------------------------------------------------------------------------------- 1 | module VagrantPlugins 2 | module PuppetInstall 3 | class Plugin < Vagrant.plugin('2') 4 | name 'vagrant-puppet-install' 5 | description <<-DESC 6 | This plugin ensures the desired version of Puppet is installed 7 | via the Puppet Labs package repos. 8 | DESC 9 | 10 | VAGRANT_VERSION_REQUIREMENT = '>= 1.1.0'.freeze 11 | 12 | # Returns true if the Vagrant version fulfills the requirements 13 | # 14 | # @param requirements [String, Array] the version requirement 15 | # @return [Boolean] 16 | def self.check_vagrant_version(*requirements) 17 | Gem::Requirement.new(*requirements).satisfied_by?( 18 | Gem::Version.new(Vagrant::VERSION)) 19 | end 20 | 21 | # Verifies that the Vagrant version fulfills the requirements 22 | # 23 | # @raise [VagrantPlugins::ProxyConf::VagrantVersionError] if this plugin 24 | # is incompatible with the Vagrant version 25 | def self.check_vagrant_version! 26 | unless check_vagrant_version(VAGRANT_VERSION_REQUIREMENT) 27 | msg = I18n.t( 28 | 'vagrant-puppet_install.errors.vagrant_version', 29 | requirement: VAGRANT_VERSION_REQUIREMENT.inspect) 30 | $stderr.puts msg 31 | raise msg 32 | end 33 | end 34 | 35 | action_hook(:install_puppet, Plugin::ALL_ACTIONS) do |hook| 36 | require_relative 'action/install_puppet' 37 | hook.after(Vagrant::Action::Builtin::Provision, Action::InstallPuppet) 38 | 39 | # The AWS provider < v0.4.0 uses a non-standard Provision action 40 | # on initial creation: 41 | # 42 | # mitchellh/vagrant-aws/blob/v0.3.0/lib/vagrant-aws/action.rb#L105 43 | # 44 | if defined? VagrantPlugins::AWS::Action::TimedProvision 45 | hook.after(VagrantPlugins::AWS::Action::TimedProvision, 46 | Action::InstallPuppet) 47 | end 48 | end 49 | 50 | config(:puppet_install) do 51 | require_relative 'config' 52 | Config 53 | end 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /lib/vagrant-puppet-install/version.rb: -------------------------------------------------------------------------------- 1 | module VagrantPlugins 2 | module PuppetInstall 3 | VERSION = '7.0.0'.freeze 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /locales/en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | vagrant-puppet_install: 3 | action: 4 | installed: "Puppet %{version} package is already installed." 5 | installing: "Installing Puppet %{version} package..." 6 | download: 7 | downloading: "Downloading or copying install.sh..." 8 | interrupted: "Install.sh download was interrupted. Exiting." 9 | errors: 10 | vagrant_version: |- 11 | vagrant-omnibus plugin requires Vagrant version %{requirement} 12 | -------------------------------------------------------------------------------- /test/acceptance/aws/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # plugins don't seem to be auto-loaded from the bundle 5 | require 'vagrant-puppet-install' 6 | require 'vagrant-aws' 7 | 8 | Vagrant.configure('2') do |config| 9 | config.puppet_install.puppet_version = '3.4.2' 10 | 11 | config.vm.box = 'dummy' 12 | config.vm.provider :aws do |aws, override| 13 | aws.access_key_id = ENV['DEV_AWS_ACCESS_KEY_ID'] 14 | aws.secret_access_key = ENV['DEV_AWS_SECRET_ACCESS_KEY'] 15 | aws.keypair_name = ENV['USER'] 16 | 17 | aws.instance_type = 'm1.large' 18 | aws.ami = 'ami-2efa9d47' # Ubuntu 12.04 LTS 64-bit instance root store 19 | aws.ssh_username = 'ubuntu' 20 | 21 | override.ssh.username = 'ubuntu' 22 | override.ssh.private_key_path = '~/.ssh/id_rsa' 23 | end 24 | 25 | config.vm.provision :puppet do |puppet| 26 | puppet.manifests_path = File.expand_path('../../../support/manifests', __FILE__) 27 | puppet.manifest_file = 'base.pp' 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /test/acceptance/digital_ocean/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.require_plugin('vagrant-puppet-install') 2 | Vagrant.require_plugin('vagrant-digitalocean') 3 | 4 | Vagrant.configure('2') do |config| 5 | config.puppet_install.puppet_version = :latest 6 | 7 | config.vm.box = 'digital_ocean' 8 | config.vm.synced_folder '.', '/vagrant', disabled: true 9 | 10 | config.vm.provider :digital_ocean do |provider, override| 11 | provider.client_id = ENV['DO_CLIENT_ID'] 12 | provider.api_key = ENV['DO_API_KEY'] 13 | provider.region = 'Amsterdam 1' 14 | provider.size = '512MB' 15 | provider.image = 'Ubuntu 12.04.4 x32' 16 | override.ssh.private_key_path = '~/.ssh/id_rsa' 17 | end 18 | 19 | config.vm.provision :puppet do |puppet| 20 | puppet.manifests_path = File.expand_path('../../../support/manifests', __FILE__) 21 | puppet.manifest_file = 'base.pp' 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /test/acceptance/docker/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # plugins don't seem to be auto-loaded from the bundle 5 | require 'vagrant-puppet-install' 6 | 7 | Vagrant.configure('2') do |config| 8 | config.puppet_install.puppet_version = :latest 9 | 10 | config.vm.provider "docker" do |d| 11 | d.image = "petems/centos-7-docker-vagrant-insecure-key" 12 | d.name = "vagrant-puppet-install-centos-7" 13 | d.has_ssh = true 14 | end 15 | 16 | config.ssh.username = "vagrant" 17 | 18 | config.vm.provision :puppet do |puppet| 19 | puppet.manifests_path = File.expand_path('../../../support/manifests', __FILE__) 20 | puppet.manifest_file = 'base.pp' 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /test/acceptance/rackspace/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # plugins don't seem to be auto-loaded from the bundle 5 | require 'vagrant-puppet-install' 6 | require 'vagrant-rackspace' 7 | 8 | Vagrant.configure('2') do |config| 9 | config.puppet_install.puppet_version = '3.4.2' 10 | 11 | config.vm.box = 'dummy' 12 | config.vm.provider :rackspace do |rackspace| 13 | rackspace.username = ENV['DEV_RACKSPACE_USERNAME'] 14 | rackspace.api_key = ENV['DEV_RACKSPACE_API_KEY'] 15 | rackspace.flavor = /512MB/ 16 | rackspace.image = /Ubuntu 12.04/ 17 | rackspace.public_key_path = '~/.ssh/id_rsa.pub' 18 | # TODO: - switch this to the `override.ssh.private_key_path` syntax once 19 | # `vagrant-rackspace` is updated. 20 | config.ssh.private_key_path = '~/.ssh/id_rsa' 21 | end 22 | 23 | config.vm.provision :puppet do |puppet| 24 | puppet.manifests_path = File.expand_path('../../../support/manifests', __FILE__) 25 | puppet.manifest_file = 'base.pp' 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /test/acceptance/virtualbox/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # plugins don't seem to be auto-loaded from the bundle 5 | require 'vagrant-puppet-install' 6 | require 'vagrant-vbguest' 7 | 8 | Vagrant.configure('2') do |config| 9 | config.vm.define :no_config_set do |no_config_set| 10 | no_config_set.vm.box = 'ubuntu/trusty64' 11 | no_config_set.vm.provision 'shell', inline: "echo 'Should still work with no puppet plugin enabled'" 12 | end 13 | 14 | config.vm.define :trusty_latest do |trusty_latest| 15 | trusty_latest.puppet_install.puppet_version = :latest 16 | 17 | trusty_latest.vm.box = 'ubuntu/trusty64' 18 | 19 | trusty_latest.vm.provision :puppet do |puppet| 20 | puppet.environment_path = File.expand_path('../../../support/environments', __FILE__) 21 | puppet.environment = 'vagrant' 22 | end 23 | 24 | trusty_latest.vm.provision 'shell', inline: 'puppet --version' 25 | end 26 | 27 | config.vm.define :trusty_361 do |trusty_361| 28 | trusty_361.puppet_install.puppet_version = '3.6.1' 29 | 30 | trusty_361.vm.box = 'ubuntu/trusty64' 31 | 32 | trusty_361.vm.provision :puppet do |puppet| 33 | puppet.environment_path = File.expand_path('../../../support/environments', __FILE__) 34 | puppet.environment = 'vagrant' 35 | end 36 | 37 | trusty_361.vm.provision 'shell', inline: 'puppet --version' 38 | end 39 | 40 | config.vm.define :fedora_23 do |fedora_25| 41 | fedora_23.vm.box = "fedora/25-cloud-base" 42 | fedora_23.puppet_install.puppet_version = :latest 43 | 44 | fedora_23.vm.provision :puppet do |puppet| 45 | puppet.environment_path = File.expand_path('../../../support/environments', __FILE__) 46 | puppet.environment = "vagrant" 47 | end 48 | 49 | fedora_23.vm.provision 'shell', inline: 'puppet --version' 50 | end 51 | 52 | config.vm.define :fedora_384 do |fedora_384| 53 | fedora_384.vm.box = "fedora/23-cloud-base" 54 | fedora_384.puppet_install.puppet_version = '3.8.1' 55 | 56 | fedora_384.vm.provision :puppet do |puppet| 57 | puppet.environment_path = File.expand_path('../../../support/environments', __FILE__) 58 | puppet.environment = "vagrant" 59 | end 60 | 61 | fedora_384.vm.provision 'shell', inline: 'puppet --version' 62 | end 63 | 64 | config.vm.define :debian_jessie_372 do |debian_jessie_372| 65 | debian_jessie_372.vm.box = "debian/jessie64" 66 | debian_jessie_372.puppet_install.puppet_version = '3.7.2-4' 67 | debian_jessie_372.puppet_install.validate_version = false 68 | 69 | debian_jessie_372.vm.provision :puppet do |puppet| 70 | puppet.environment_path = File.expand_path('../../../support/environments', __FILE__) 71 | puppet.environment = "vagrant" 72 | end 73 | 74 | debian_jessie_372.vm.provision 'shell', inline: 'puppet --version' 75 | end 76 | 77 | config.vm.define :validate_version_false do |validate_version_false| 78 | validate_version_false.puppet_install.puppet_version = '9.9.9' 79 | validate_version_false.puppet_install.validate_version = false 80 | 81 | validate_version_false.puppet_install.install_url = File.expand_path('../../support/puppet_install_script/shell_install.sh') 82 | validate_version_false.vm.box = "puppetlabs/centos-6.6-64-nocm" 83 | 84 | validate_version_false.vm.provision :puppet do |puppet| 85 | puppet.manifests_path = File.expand_path('../../../support/manifests', __FILE__) 86 | puppet.manifest_file = "base.pp" 87 | end 88 | 89 | validate_version_false.vm.provision "shell", inline: "puppet --version" 90 | end 91 | 92 | config.vm.define :trusty_ubuntu_box do |trusty_ubuntu_box| 93 | trusty_ubuntu_box.puppet_install.puppet_version = :latest 94 | trusty_ubuntu_box.puppet_install.install_url = 'https://gist.githubusercontent.com/petems/6723c2eedb9d32d7ad97/raw/990ff448f6430aa015e208668a3cecb3f1db0d4b/purge_old_install_new.sh' 95 | 96 | trusty_ubuntu_box.vm.box = 'ubuntu/trusty64' 97 | 98 | trusty_ubuntu_box.vm.provision :puppet do |puppet| 99 | puppet.environment_path = File.expand_path('../../../support/environments', __FILE__) 100 | puppet.environment = 'vagrant' 101 | end 102 | 103 | trusty_ubuntu_box.vm.provision 'shell', inline: 'puppet --version' 104 | end 105 | 106 | config.vm.define :ubuntu do |ubuntu| 107 | ubuntu.puppet_install.puppet_version = '3.6.1' 108 | 109 | ubuntu.vm.box = 'puppetlabs/ubuntu-12.04-64-nocm' 110 | 111 | ubuntu.vm.provision :puppet do |puppet| 112 | puppet.manifests_path = File.expand_path('../../../support/manifests', __FILE__) 113 | puppet.manifest_file = 'base.pp' 114 | end 115 | 116 | ubuntu.vm.provision 'shell', inline: 'puppet --version' 117 | end 118 | 119 | config.vm.define :gh6 do |gh6| 120 | gh6.puppet_install.puppet_version = '2.7.23' 121 | 122 | gh6.vm.box = 'puppetlabs/ubuntu-12.04-64-nocm' 123 | gh6.vm.provision 'shell', inline: 'puppet --version' 124 | 125 | gh6.vm.provision :puppet do |puppet| 126 | puppet.manifests_path = File.expand_path('../../../support/manifests', __FILE__) 127 | puppet.manifest_file = 'base.pp' 128 | end 129 | 130 | gh6.vm.provision 'shell', inline: 'puppet --version' 131 | end 132 | 133 | config.vm.define :centos do |centos| 134 | centos.puppet_install.puppet_version = :latest 135 | centos.vm.box = 'puppetlabs/centos-6.6-64-nocm' 136 | 137 | centos.vm.provision :puppet do |puppet| 138 | puppet.environment_path = File.expand_path('../../../support/environments', __FILE__) 139 | puppet.environment = "vagrant" 140 | end 141 | 142 | centos.vm.provision 'shell', inline: 'puppet --version' 143 | end 144 | 145 | config.vm.define :new_install_url do |new_install_url| 146 | new_install_url.puppet_install.puppet_version = :latest 147 | new_install_url.puppet_install.install_url = 'https://raw.githubusercontent.com/hashicorp/puppet-bootstrap/master/centos_6_x.sh' 148 | new_install_url.vm.box = 'puppetlabs/centos-6.6-64-nocm' 149 | 150 | new_install_url.vm.provision :puppet do |puppet| 151 | puppet.environment_path = File.expand_path('../../../support/environments', __FILE__) 152 | puppet.environment = "vagrant" 153 | end 154 | 155 | new_install_url.vm.provision 'shell', inline: 'puppet --version' 156 | end 157 | 158 | config.vm.define :new_install_path do |new_install_path| 159 | new_install_path.puppet_install.puppet_version = :latest 160 | new_install_path.puppet_install.install_url = File.expand_path('../../support/puppet_install_script/shell_install.sh') 161 | new_install_path.vm.box = 'puppetlabs/centos-6.6-64-nocm' 162 | 163 | new_install_path.vm.provision :puppet do |puppet| 164 | puppet.manifests_path = File.expand_path('../../../support/manifests', __FILE__) 165 | puppet.manifest_file = 'base.pp' 166 | end 167 | 168 | new_install_path.vm.provision 'shell', inline: 'puppet --version' 169 | end 170 | end 171 | -------------------------------------------------------------------------------- /test/support/environments/vagrant/manifests/site.pp: -------------------------------------------------------------------------------- 1 | notify {"Puppet Installed: $puppetversion":} 2 | -------------------------------------------------------------------------------- /test/support/manifests/base.pp: -------------------------------------------------------------------------------- 1 | notify {"Puppet Installed: $puppetversion":} -------------------------------------------------------------------------------- /test/support/puppet_install_script/shell_install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | echo "Spec test running now!" 6 | 7 | REPO_URL="http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-7.noarch.rpm" 8 | 9 | # Install puppet labs repo 10 | echo "Configuring PuppetLabs repo..." 11 | repo_path=$(mktemp) 12 | wget --output-document="${repo_path}" "${REPO_URL}" 2>/dev/null 13 | rpm -i "${repo_path}" >/dev/null 14 | 15 | # Install Puppet... 16 | echo "Installing puppet" 17 | yum install -y puppet > /dev/null 18 | 19 | echo "Puppet installed!" -------------------------------------------------------------------------------- /test/unit/spec_helper.rb: -------------------------------------------------------------------------------- 1 | $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__) 2 | 3 | require 'rspec/its' 4 | require 'rspec/core' 5 | require 'vagrant-puppet-install' 6 | require 'datadog/ci' 7 | 8 | RSpec.configure do |config| 9 | config.formatter = :documentation 10 | 11 | # a little syntactic sugar 12 | config.alias_it_should_behave_like_to :it_has_behavior, 'has behavior:' 13 | 14 | # Use color in STDOUT 15 | config.color = true 16 | 17 | # Use color not only in STDOUT but also in pagers and files 18 | config.tty = true 19 | 20 | # run the examples in random order 21 | config.order = :rand 22 | 23 | # specify metadata with symobls only (ie no '=> true' required) 24 | config.filter_run focus: true 25 | config.run_all_when_everything_filtered = true 26 | end 27 | 28 | Datadog.configure do |c| 29 | c.ci_mode.enabled = true 30 | c.service = 'vagrant-puppet-install' 31 | c.use :rspec 32 | end -------------------------------------------------------------------------------- /test/unit/vagrant-puppet-install/config_spec.rb: -------------------------------------------------------------------------------- 1 | require_relative '../spec_helper' 2 | 3 | describe VagrantPlugins::PuppetInstall::Config do 4 | let(:machine) { double('machine') } 5 | let(:instance) { described_class.new } 6 | 7 | subject(:config) do 8 | instance.tap do |o| 9 | o.puppet_version = puppet_version if defined?(puppet_version) 10 | o.install_url = install_url if defined?(install_url) 11 | o.validate_version = validate_version if defined?(validate_version) 12 | o.finalize! 13 | end 14 | end 15 | 16 | describe 'defaults' do 17 | its(:puppet_version) { should be_nil } 18 | its(:install_url) { should be_nil } 19 | its(:validate_version) { should be_nil} 20 | end 21 | 22 | describe 'resolving `:latest` to a real Puppet version' do 23 | let(:puppet_version) { :latest } 24 | its(:puppet_version) { should be_a(String) } 25 | its(:puppet_version) { should match(/\d*\.\d*\.\d*/) } 26 | end 27 | 28 | describe 'validate' do 29 | it 'should be no-op' do 30 | expect(subject.validate(machine)).to eq('VagrantPlugins::PuppetInstall::Config' => []) 31 | end 32 | end 33 | 34 | describe '#validate!' do 35 | describe 'puppet_version validation' do 36 | { 37 | '3.4.0' => { 38 | description: 'valid puppet version string', 39 | valid: true 40 | }, 41 | '~> 2.7' => { 42 | description: 'valid puppet version string', 43 | valid: true 44 | }, 45 | '9.9.9' => { 46 | description: 'invalid puppet version string', 47 | valid: false 48 | }, 49 | 'FUFUFU' => { 50 | description: 'invalid RubyGems version string', 51 | valid: false 52 | } 53 | }.each_pair do |version_string, opts| 54 | context "#{opts[:description]}: #{version_string}" do 55 | let(:puppet_version) { version_string } 56 | if opts[:valid] 57 | it 'passes' do 58 | expect { subject.validate!(machine) }.to_not raise_error 59 | end 60 | else 61 | it 'fails' do 62 | expect { subject.validate!(machine) }.to raise_error(Vagrant::Errors::ConfigInvalid) 63 | end 64 | end 65 | end 66 | end 67 | end # describe puppet_version 68 | 69 | describe 'not specified puppet_version validation' do 70 | it 'passes' do 71 | Gem::DependencyInstaller.any_instance.stub(:find_gems_with_sources).and_return([]) 72 | expect { subject.validate!(machine) }.to_not raise_error 73 | end 74 | end # describe not specified puppet_version validation 75 | 76 | describe 'validate_version set to false should not raise error' do 77 | { 78 | false => { 79 | description: 'Boolean false' 80 | }, 81 | 'false' => { 82 | description: 'String false' 83 | }, 84 | :false => { 85 | description: ':false' 86 | }, 87 | }.each_pair do |falsey, opts| 88 | context "#{opts[:description]}" do 89 | let(:validate_version) { falsey } 90 | let(:puppet_version) { '9.9.9' } 91 | 92 | it 'passes' do 93 | expect { subject.validate!(machine) }.to_not raise_error 94 | end 95 | end 96 | end 97 | end # describe validate_version set to false should not raise error 98 | 99 | describe 'validate_version set to true with an invalid version should not raise error' do 100 | let(:validate_version) { true } 101 | let(:puppet_version) { '9.9.9' } 102 | 103 | it 'fails' do 104 | expect { subject.validate!(machine) }.to raise_error(Vagrant::Errors::ConfigInvalid) 105 | end 106 | end # validate_version set to true with an invalid version should not raise error 107 | end 108 | end 109 | -------------------------------------------------------------------------------- /test/unit/vagrant-puppet-install/plugin_spec.rb: -------------------------------------------------------------------------------- 1 | require_relative '../spec_helper' 2 | 3 | describe VagrantPlugins::PuppetInstall::Plugin do 4 | context 'action hooks' do 5 | let(:hook) { double(append: true, prepend: true) } 6 | let(:fake_class) { Class.new } 7 | 8 | it 'should hook InstallPuppet before Provision' do 9 | stub_const('VagrantPlugins::PuppetInstall::Action::InstallPuppet', fake_class) 10 | hook_proc = described_class.components.action_hooks[:__all_actions__][0] 11 | hook = double 12 | expect(hook).to receive(:after).with(Vagrant::Action::Builtin::Provision, VagrantPlugins::PuppetInstall::Action::InstallPuppet) 13 | hook_proc.call(hook) 14 | end 15 | end 16 | 17 | it 'should define a config of type :puppet' do 18 | default_config = described_class.components.configs[:top].to_hash[:puppet_install] 19 | expect(default_config).to be(VagrantPlugins::PuppetInstall::Config) 20 | end 21 | 22 | describe '.check_vagrant_version' do 23 | before :each do 24 | stub_const('Vagrant::VERSION', '1.2.3') 25 | end 26 | 27 | it 'accepts single String argument' do 28 | expect(described_class.check_vagrant_version('~> 1.1')).to be_truthy 29 | expect(described_class.check_vagrant_version('1.2')).to be_falsey 30 | end 31 | 32 | it 'accepts an Array argument' do 33 | expect(described_class.check_vagrant_version(['>= 1.1', '< 1.3.0.beta'])).to be_truthy 34 | expect(described_class.check_vagrant_version(['>= 1.3'])).to be_falsey 35 | end 36 | 37 | it 'accepts multiple arguments' do 38 | expect(described_class.check_vagrant_version('>= 1.0', '<= 1.3')).to be_truthy 39 | expect(described_class.check_vagrant_version('~> 1.2', '>= 1.2.5')).to be_falsey 40 | end 41 | end 42 | 43 | describe '.check_vagrant_version!' do 44 | subject { described_class.check_vagrant_version! } 45 | let(:requirement) { '>= 1.1.0' } 46 | let(:err_msg) { /requires Vagrant version #{Regexp.escape(requirement.inspect)}/ } 47 | 48 | before :each do 49 | stub_const( 50 | 'VagrantPlugins::ProxyConf::Plugin::VAGRANT_VERSION_REQUIREMENT', 51 | requirement) 52 | stub_const('Vagrant::VERSION', vagrant_version) 53 | $stderr.stub(:puts) 54 | end 55 | 56 | context 'on too old Vagrant version' do 57 | let(:vagrant_version) { '1.0.9' } 58 | it 'raises error' do 59 | expect { subject }.to raise_error(err_msg) 60 | end 61 | it 'warns as stderr' do 62 | $stderr.should_receive(:puts).with(err_msg) 63 | expect { subject }.to raise_error(err_msg) 64 | end 65 | end 66 | 67 | context 'on exact required Vagrant version' do 68 | let(:vagrant_version) { '1.1.0' } 69 | it 'does not raise' do 70 | expect { subject }.not_to raise_error 71 | end 72 | end 73 | 74 | context 'on newer Vagrant version' do 75 | let(:vagrant_version) { '1.3.5' } 76 | it 'does not raise' do 77 | expect { subject }.not_to raise_error 78 | end 79 | end 80 | end 81 | end 82 | -------------------------------------------------------------------------------- /vagrant-puppet-install.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'vagrant-puppet-install/version' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = 'vagrant-puppet-install' 8 | spec.version = VagrantPlugins::PuppetInstall::VERSION 9 | spec.authors = ['Seth Chisamore', 'Patrick Connolly', 'Peter Souter'] 10 | spec.email = ['schisamo@opscode.com', 'patrick@myplanetdigital.com', 'p.morsou@gmail.com'] 11 | spec.description = 'A Vagrant plugin that ensures the desired version of Puppet is installed via the Puppet Labs package repos.' 12 | spec.summary = spec.description 13 | spec.homepage = 'https://github.com/patcon/vagrant-puppet-install' 14 | spec.license = 'Apache 2.0' 15 | 16 | spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) 17 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } 18 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) 19 | spec.require_paths = ['lib'] 20 | 21 | spec.add_development_dependency 'rake', '~> 13.0.1' 22 | spec.add_development_dependency 'rspec', '~> 3' 23 | spec.add_development_dependency 'rspec-its', '~> 1.3' 24 | spec.add_development_dependency 'rubocop', '~> 0.49.0' 25 | spec.add_development_dependency 'pry', '~> 0.11.3' 26 | spec.add_development_dependency 'github_changelog_generator', '~> 1.13.1' 27 | spec.add_development_dependency 'yard' 28 | spec.add_development_dependency 'ddtrace', ">=0.51.0" 29 | spec.add_development_dependency 'rubygems-tasks' 30 | end 31 | --------------------------------------------------------------------------------