Repository: chef/vagrant-omnibus
Branch: master
Commit: 0345dd5438e9
Files: 27
Total size: 56.0 KB
Directory structure:
gitextract_njy126on/
├── .gitignore
├── .rspec
├── .travis.yml
├── .yardopts
├── CHANGELOG.md
├── Gemfile
├── LICENSE
├── README.md
├── Rakefile
├── lib/
│ ├── vagrant-omnibus/
│ │ ├── action/
│ │ │ └── install_chef.rb
│ │ ├── config.rb
│ │ ├── plugin.rb
│ │ └── version.rb
│ └── vagrant-omnibus.rb
├── locales/
│ └── en.yml
├── test/
│ ├── acceptance/
│ │ ├── aws/
│ │ │ └── Vagrantfile
│ │ ├── digital_ocean/
│ │ │ └── Vagrantfile
│ │ ├── linode/
│ │ │ └── Vagrantfile
│ │ ├── rackspace/
│ │ │ └── Vagrantfile
│ │ └── virtualbox/
│ │ └── Vagrantfile
│ ├── support/
│ │ └── cookbooks/
│ │ └── chef-inator/
│ │ ├── README.md
│ │ ├── metadata.rb
│ │ └── recipes/
│ │ └── default.rb
│ └── unit/
│ ├── spec_helper.rb
│ └── vagrant-omnibus/
│ ├── config_spec.rb
│ └── plugin_spec.rb
└── vagrant-omnibus.gemspec
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
*.gem
*.rbc
.bundle
.config
.yardoc
Gemfile.lock
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
bin/
.vagrant/
================================================
FILE: .rspec
================================================
--default-path test/unit
================================================
FILE: .travis.yml
================================================
rvm:
- 2.2.10
- 2.3.7
- 2.4.4
- 2.5.1
branches:
only:
- master
bundler_args: --jobs 7 --without=acceptance
script:
- bundle exec rake travis:ci
================================================
FILE: .yardopts
================================================
--markup=markdown
--markup-provider=redcarpet
--readme=README.md
-
CHANGELOG.md
LICENSE
TODO.md
================================================
FILE: CHANGELOG.md
================================================
# Change Log
## [1.5.0](https://github.com/chef/vagrant-omnibus/tree/1.5.0) (2016-08-31)
[Full Changelog](https://github.com/chef/vagrant-omnibus/compare/v1.4.1...1.5.0)
**Merged pull requests:**
- Convert specs to rspec 3 format [\#138](https://github.com/chef/vagrant-omnibus/pull/138) ([tas50](https://github.com/tas50))
- Testing improvements, dep bumps, and fixes [\#137](https://github.com/chef/vagrant-omnibus/pull/137) ([tas50](https://github.com/tas50))
- Fix installing chef on windows in vagrant 1.8.3 and up [\#135](https://github.com/chef/vagrant-omnibus/pull/135) ([mwrock](https://github.com/mwrock))
- Fixed Travis CI image and link. [\#115](https://github.com/chef/vagrant-omnibus/pull/115) ([mbrukman](https://github.com/mbrukman))
- Update README.md to point to current Travis location [\#101](https://github.com/chef/vagrant-omnibus/pull/101) ([petems](https://github.com/petems))
- Change :latest to not hit rubygems [\#97](https://github.com/chef/vagrant-omnibus/pull/97) ([lamont-granquist](https://github.com/lamont-granquist))
- README: added info about Windows support [\#94](https://github.com/chef/vagrant-omnibus/pull/94) ([docwhat](https://github.com/docwhat))
- Fix string to use Ruby variables in tests [\#93](https://github.com/chef/vagrant-omnibus/pull/93) ([petems](https://github.com/petems))
- Add plugin spec [\#92](https://github.com/chef/vagrant-omnibus/pull/92) ([petems](https://github.com/petems))
## [v1.4.1](https://github.com/chef/vagrant-omnibus/tree/v1.4.1) (2014-04-26)
[Full Changelog](https://github.com/chef/vagrant-omnibus/compare/v1.4.0...v1.4.1)
## [v1.4.0](https://github.com/chef/vagrant-omnibus/tree/v1.4.0) (2014-04-25)
[Full Changelog](https://github.com/chef/vagrant-omnibus/compare/v1.3.1...v1.4.0)
**Merged pull requests:**
- Cache omnibus download, expose config options [\#73](https://github.com/chef/vagrant-omnibus/pull/73) ([tknerr](https://github.com/tknerr))
- Fix not specified chef version without internet connection [\#67](https://github.com/chef/vagrant-omnibus/pull/67) ([skv-headless](https://github.com/skv-headless))
## [v1.3.1](https://github.com/chef/vagrant-omnibus/tree/v1.3.1) (2014-03-12)
[Full Changelog](https://github.com/chef/vagrant-omnibus/compare/v1.3.0...v1.3.1)
**Merged pull requests:**
- run install.sh with `sh` rather than `bash`... [\#66](https://github.com/chef/vagrant-omnibus/pull/66) ([tknerr](https://github.com/tknerr))
- make unlinking the install.sh reliably work on windows hosts [\#65](https://github.com/chef/vagrant-omnibus/pull/65) ([tknerr](https://github.com/tknerr))
## [v1.3.0](https://github.com/chef/vagrant-omnibus/tree/v1.3.0) (2014-02-24)
[Full Changelog](https://github.com/chef/vagrant-omnibus/compare/v1.2.1...v1.3.0)
**Merged pull requests:**
- Make detection of currently installed Chef version more robust [\#61](https://github.com/chef/vagrant-omnibus/pull/61) ([ampedandwired](https://github.com/ampedandwired))
- Windows Support Part Deux [\#60](https://github.com/chef/vagrant-omnibus/pull/60) ([schisamo](https://github.com/schisamo))
## [v1.2.1](https://github.com/chef/vagrant-omnibus/tree/v1.2.1) (2013-12-18)
[Full Changelog](https://github.com/chef/vagrant-omnibus/compare/v1.2.0...v1.2.1)
**Merged pull requests:**
- filder 'stdin is not a tty' when trying to figure installed Chef version [\#57](https://github.com/chef/vagrant-omnibus/pull/57) ([scalp42](https://github.com/scalp42))
## [v1.2.0](https://github.com/chef/vagrant-omnibus/tree/v1.2.0) (2013-12-17)
[Full Changelog](https://github.com/chef/vagrant-omnibus/compare/v1.1.2...v1.2.0)
**Merged pull requests:**
- Ruby linting with Rubocop [\#56](https://github.com/chef/vagrant-omnibus/pull/56) ([schisamo](https://github.com/schisamo))
- Fix installed version check to be more robust [\#53](https://github.com/chef/vagrant-omnibus/pull/53) ([comutt](https://github.com/comutt))
- Change plugin name to correspond gem name [\#52](https://github.com/chef/vagrant-omnibus/pull/52) ([tmatilai](https://github.com/tmatilai))
- Update README.md with vagrant-parallels compatibility [\#50](https://github.com/chef/vagrant-omnibus/pull/50) ([wizonesolutions](https://github.com/wizonesolutions))
- Don't install Chef if `--no-provision` is specified [\#48](https://github.com/chef/vagrant-omnibus/pull/48) ([tmatilai](https://github.com/tmatilai))
## [v1.1.2](https://github.com/chef/vagrant-omnibus/tree/v1.1.2) (2013-10-17)
[Full Changelog](https://github.com/chef/vagrant-omnibus/compare/v1.1.1...v1.1.2)
**Merged pull requests:**
- Compatibility with vagrant-aws v0.4.0 [\#45](https://github.com/chef/vagrant-omnibus/pull/45) ([tmatilai](https://github.com/tmatilai))
- Fix development dependencies and Travis tests [\#43](https://github.com/chef/vagrant-omnibus/pull/43) ([tmatilai](https://github.com/tmatilai))
- Add vagrant-digitalocean to the list of supported providers [\#41](https://github.com/chef/vagrant-omnibus/pull/41) ([tmatilai](https://github.com/tmatilai))
## [v1.1.1](https://github.com/chef/vagrant-omnibus/tree/v1.1.1) (2013-09-04)
[Full Changelog](https://github.com/chef/vagrant-omnibus/compare/v1.1.0...v1.1.1)
**Merged pull requests:**
- Document that newer than v1.1.x Vagrant is fine, too [\#37](https://github.com/chef/vagrant-omnibus/pull/37) ([tmatilai](https://github.com/tmatilai))
- Fix the curl line to install the requested Chef version [\#32](https://github.com/chef/vagrant-omnibus/pull/32) ([tmatilai](https://github.com/tmatilai))
- no need to do sudo in sudo [\#31](https://github.com/chef/vagrant-omnibus/pull/31) ([matsu911](https://github.com/matsu911))
- include OpenStack provider into the list of working providers [\#28](https://github.com/chef/vagrant-omnibus/pull/28) ([srenatus](https://github.com/srenatus))
## [v1.1.0](https://github.com/chef/vagrant-omnibus/tree/v1.1.0) (2013-06-21)
[Full Changelog](https://github.com/chef/vagrant-omnibus/compare/v1.0.2...v1.1.0)
**Merged pull requests:**
- add support for vmware\_fusion [\#17](https://github.com/chef/vagrant-omnibus/pull/17) ([rjocoleman](https://github.com/rjocoleman))
## [v1.0.2](https://github.com/chef/vagrant-omnibus/tree/v1.0.2) (2013-04-20)
[Full Changelog](https://github.com/chef/vagrant-omnibus/compare/v1.0.1...v1.0.2)
## [v1.0.1](https://github.com/chef/vagrant-omnibus/tree/v1.0.1) (2013-04-18)
[Full Changelog](https://github.com/chef/vagrant-omnibus/compare/v1.0.0...v1.0.1)
## [v1.0.0](https://github.com/chef/vagrant-omnibus/tree/v1.0.0) (2013-04-02)
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
================================================
FILE: Gemfile
================================================
source "https://rubygems.org"
gemspec
group :development do
# We depend on Vagrant for development, but we don't add it as a
# gem dependency because we expect to be installed within the
# Vagrant environment itself using `vagrant plugin`.
gem "vagrant", git: "https://github.com/hashicorp/vagrant.git", tag: "v2.1.1"
end
group :acceptance do
gem "vagrant-digitalocean", "~> 0.5"
gem "vagrant-aws", "~> 0.4"
gem "vagrant-rackspace", "~> 0.1"
gem "vagrant-linode", "~> 0.4"
end
group :docs do
gem "yard", "~> 0.9.11"
gem "redcarpet", "~> 2.2"
gem "github-markup", "~> 0.7"
end
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
# vagrant-omnibus
## Deprecation Warning
This is no longer an actively maintained Chef project. We believe that Test Kitchen offers a far superior development and testing experience as it allows fine grained control of versions, better platform support, and and overall better experience. If this project works for you that's great, but we'd highly suggest using https://kitchen.ci/ instead.
---
[](https://rubygems.org/gems/vagrant-omnibus) [](https://travis-ci.org/chef/vagrant-omnibus) [](https://codeclimate.com/github/chef/vagrant-omnibus)
A Vagrant plugin that ensures the desired version of Chef is installed via the platform-specific Omnibus packages. This proves very useful when using Vagrant with provisioner-less baseboxes OR cloud images.
The plugin should work correctly with most all providers that hook into `Vagrant::Action::Builtin::Provision` for provisioning and is known to work with the following [Vagrant providers](https://www.vagrantup.com/docs/providers/index.html):
- VirtualBox (part of core)
- AWS (ships in [vagrant-aws](https://github.com/mitchellh/vagrant-aws) plugin)
- Rackspace (ships in [vagrant-rackspace](https://github.com/mitchellh/vagrant-rackspace) plugin)
- VMWare Fusion (can be [purchased from Hashicorp](https://www.vagrantup.com/vmware/))
- LXC (ships in [vagrant-lxc](https://github.com/fgrehm/vagrant-lxc))
- OpenStack (ships in [vagrant-openstack-plugin](https://github.com/cloudbau/vagrant-openstack-plugin))
- DigitalOcean (ships in [vagrant-digitalocean](https://github.com/smdahlen/vagrant-digitalocean))
- Parallels Desktop (ships in [vagrant-parallels](https://github.com/yshahin/vagrant-parallels))
- Linode (ships in [vagrant-linode](https://github.com/displague/vagrant-linode))
## Installation
Ensure you have downloaded and installed Vagrant 1.1 or newer from the [Vagrant downloads page](https://www.vagrantup.com/downloads.html). If you require Windows support then Vagrant 1.6.1 or newer is needed.
Installation is performed in the prescribed manner for Vagrant 1.1 plugins.
```
$ vagrant plugin install vagrant-omnibus
```
## Usage
The Omnibus Vagrant plugin automatically hooks into the Vagrant provisioning middleware. You specify the version of the Chef Omnibus package you want installed using the `omnibus.chef_version` config key. The version string should be a valid Chef release version or `:latest`.
Install the latest version of Chef:
```ruby
Vagrant.configure("2") do |config|
config.omnibus.chef_version = :latest
...
end
```
Install a specific version of Chef:
```ruby
Vagrant.configure("2") do |config|
config.omnibus.chef_version = "14.2.0"
...
end
```
Specify a custom install script:
```ruby
Vagrant.configure("2") do |config|
config.omnibus.install_url = 'http://acme.com/install.sh'
# config.omnibus.install_url = 'http://acme.com/install.msi'
# config.omnibus.install_url = '/some/path/on/the/host'
...
end
```
If [vagrant-cachier](https://github.com/fgrehm/vagrant-cachier) is present and `config.cache.auto_detect` enabled the downloaded omnibus packages will be cached by vagrant-cachier. In case you want to turn caching off:
```ruby
Vagrant.configure("2") do |config|
config.omnibus.cache_packages = false
...
end
```
This plugin is also multi-vm aware so it would possible to say install a different version of Chef on each VM:
```ruby
Vagrant.configure("2") do |config|
config.vm.define :new_chef do |new_chef_config|
...
new_chef_config.omnibus.chef_version = :latest
...
end
config.vm.define :old_chef do |old_chef_config|
...
old_chef_config.omnibus.chef_version = "13.9.1"
...
end
end
```
## Tests
### Unit
The unit tests can be run with:
```
rake test:unit
```
The test are also executed by Travis CI every time code is pushed to GitHub.
### Acceptance
Currently this repo ships with a set of basic acceptance tests that will:
- Provision a Vagrant instance.
- Attempt to install Chef using this plugin.
- Perform a very basic chef-solo run to ensure Chef is in fact installed.
The acceptance tests can be run against a subset of the Vagrant providers listed above. The acceptance tests can be run with:
```
rake test:acceptance:PROVIDER_NAME
```
And as expected, all acceptance tests only uses provisioner-less baseboxes and cloud images!
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## Authors
Seth Chisamore (schisamo@chef.io)
================================================
FILE: Rakefile
================================================
require "bundler/setup"
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "chefstyle"
require "rubocop/rake_task"
require "yard"
# rubocop:disable LineLength
def run_acceptance_tests(provider = "virtualbox")
puts "=================================================================="
puts "Running acceptance tests against '#{provider}' provider..."
puts "=================================================================="
Dir.chdir("test/acceptance/#{provider}") do
system("vagrant destroy -f")
system("vagrant up --provider=#{provider}")
system("vagrant destroy -f")
end
end
YARD::Rake::YardocTask.new
namespace :style do
desc "Run Ruby style checks"
RuboCop::RakeTask.new(:ruby) do |task|
task.patterns = [
"**/*.rb",
"**/Vagrantfile",
"*.gemspec",
"Gemfile",
"Rakefile",
]
end
end
namespace :test do
RSpec::Core::RakeTask.new(:unit) do |t|
t.pattern = "test/unit/**/*_spec.rb"
end
namespace :acceptance do
desc "Run acceptance tests with AWS provider"
task :aws do
unless system("vagrant box list | grep 'dummy\s*(aws)' &>/dev/null")
system("vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box")
end
run_acceptance_tests("aws")
end
desc "Run acceptance tests with Digital Ocean provider"
task "digital_ocean" do
unless system("vagrant box list | grep 'digital_ocean' &>/dev/null")
system("vagrant box add digital_ocean https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box")
end
run_acceptance_tests("digital_ocean")
end
desc "Run acceptance tests with Rackspace provider"
task :rackspace do
unless system("vagrant box list | grep 'dummy\s*(rackspace)' &>/dev/null")
system("vagrant box add dummy https://github.com/mitchellh/vagrant-rackspace/raw/master/dummy.box")
end
run_acceptance_tests("rackspace")
end
desc "Run acceptance tests with Linode provider"
task ":linode" do
unless system("vagrant box list | grep 'linode' &>/dev/null")
system("vagrant box add linode https://github.com/displague/vagrant-linode/raw/master/box/linode.box")
end
run_acceptance_tests("linode")
end
desc "Run acceptance tests with VirtualBox provider"
task :virtualbox do
run_acceptance_tests("virtualbox")
end
desc "Run acceptance tests with VMware provider"
task :vmware_fusion do
run_acceptance_tests("vmware_fusion")
end
end
end
# We cannot run Test Kitchen on Travis CI yet...
namespace :travis do
desc "Run tests on Travis"
task ci: ["style:ruby", "test:unit"]
end
require "vagrant-omnibus/version"
# The default rake task should just run it all
task default: ["style:ruby", "test:unit", "test:acceptance:virtualbox"]
================================================
FILE: lib/vagrant-omnibus/action/install_chef.rb
================================================
#
# Copyright (c) 2013, Seth Chisamore
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require "log4r"
require "shellwords"
require "vagrant/util/downloader"
module VagrantPlugins
module Omnibus
module Action
# @author Seth Chisamore <schisamo@chef.io>
#
# This action installs Chef Omnibus packages at the desired version.
class InstallChef
def initialize(app, env)
@app = app
@logger =
Log4r::Logger.new("vagrantplugins::omnibus::action::installchef")
@machine = env[:machine]
@install_script = find_install_script
end
def call(env)
@app.call(env)
return unless @machine.communicate.ready? && provision_enabled?(env)
# Perform delayed validation
@machine.config.omnibus.validate!(@machine)
desired_version = @machine.config.omnibus.chef_version
unless desired_version.nil?
if installed_version == desired_version
env[:ui].info I18n.t(
"vagrant-omnibus.action.installed",
version: desired_version
)
else
fetch_or_create_install_script(env)
env[:ui].info I18n.t(
"vagrant-omnibus.action.installing",
version: desired_version
)
install(desired_version, env)
recover(env)
end
end
end
private
# Determines which install script should be used to install the
# Omnibus Chef package. Order of precedence:
# 1. from config
# 2. from env var
# 3. default
def find_install_script
config_install_url || env_install_url || default_install_url
end
def default_install_url
if windows_guest?
"http://www.chef.io/chef/install.msi"
else
"https://www.chef.io/chef/install.sh"
end
end
def config_install_url
@machine.config.omnibus.install_url
end
def env_install_url
ENV["OMNIBUS_INSTALL_URL"]
end
def cached_omnibus_download_dir
"/tmp/vagrant-cache/vagrant_omnibus"
end
def cache_packages?
@machine.config.omnibus.cache_packages
end
def cachier_present?
defined?(VagrantPlugins::Cachier::Plugin)
end
def cachier_autodetect_enabled?
@machine.config.cache.auto_detect
end
def download_to_cached_dir?
cache_packages? && cachier_present? && cachier_autodetect_enabled?
end
def install_script_name
if windows_guest?
"install.bat"
else
"install.sh"
end
end
def install_script_folder
if windows_guest?
"$env:temp/vagrant-omnibus"
else
"/tmp/vagrant-omnibus"
end
end
def install_script_path
File.join(install_script_folder, install_script_name)
end
def windows_guest?
@machine.config.vm.guest.eql?(:windows)
end
def provision_enabled?(env)
env.fetch(:provision_enabled, true)
end
def communication_opts
if windows_guest?
{ shell: "powershell" }
else
{ shell: "sh" }
end
end
def installed_version
version = nil
opts = communication_opts
opts[:error_check] = false if windows_guest?
command = "echo $(chef-solo -v)"
@machine.communicate.sudo(command, opts) do |type, data|
if [:stderr, :stdout].include?(type)
version_match = data.match(/^Chef: (.+)/)
version = version_match.captures[0].strip if version_match
end
end
version
end
#
# Upload install script from Host's Vagrant TMP directory to guest
# and executes.
#
def install(version, env)
shell_escaped_version = Shellwords.escape(version)
@machine.communicate.tap do |comm|
unless windows_guest?
comm.execute("mkdir -p #{install_script_folder}")
end
comm.upload(@script_tmp_path, install_script_path)
if windows_guest?
install_cmd = "& #{install_script_path} #{version}"
else
install_cmd = "sh #{install_script_path}"
install_cmd << " -v #{shell_escaped_version}"
if download_to_cached_dir?
install_cmd << " -d #{cached_omnibus_download_dir}"
end
install_cmd << " 2>&1"
end
comm.sudo(install_cmd, communication_opts) do |type, data|
if [:stderr, :stdout].include?(type)
next if data =~ /stdin: is not a tty/
env[:ui].info(data)
end
end
end
end
#
# Fetches or creates a platform specific install script to the Host's
# Vagrant TMP directory.
#
def fetch_or_create_install_script(env)
@script_tmp_path = env[:tmp_path].join(
"#{Time.now.to_i}-#{install_script_name}"
).to_s
@logger.info("Generating install script at: #{@script_tmp_path}")
url = @install_script
if File.file?(url) || url !~ /^[a-z0-9]+:.*$/i
@logger.info("Assuming URL is a file.")
file_path = File.expand_path(url)
file_path = Vagrant::Util::Platform.cygwin_windows_path(file_path)
url = "file:#{file_path}"
end
# Download the install.sh or create install.bat file to a temporary
# path. We store the temporary path as an instance variable so that
# the `#recover` method can access it.
begin
if windows_guest?
# generate a install.bat file at the `@script_tmp_path` location
#
# We'll also disable Rubocop for this embedded PowerShell code:
#
# rubocop:disable LineLength, SpaceAroundBlockBraces
#
File.open(@script_tmp_path, "w") do |f|
f.puts <<-EOH.gsub(/^\s{18}/, "")
@echo off
set version=%1
set dest=%~dp0chef-client-%version%-1.windows.msi
echo Downloading Chef %version% for Windows...
powershell -command "(New-Object System.Net.WebClient).DownloadFile('#{url}?v=%version%', '%dest%')"
echo Installing Chef %version%
msiexec /q /i "%dest%"
EOH
end
# rubocop:enable LineLength, SpaceAroundBlockBraces
else
downloader = Vagrant::Util::Downloader.new(
url,
@script_tmp_path,
{}
)
downloader.download!
end
rescue Vagrant::Errors::DownloaderInterrupted
# The downloader was interrupted, so just return, because that
# means we were interrupted as well.
env[:ui].info(I18n.t("vagrant-omnibus.download.interrupted"))
return
end
end
def recover(env)
if @script_tmp_path && File.exist?(@script_tmp_path)
# Try extra hard to unlink the file so that it reliably works
# on Windows hosts as well, see:
# http://alx.github.io/2009/01/27/ruby-wundows-unlink.html
file_deleted = false
until file_deleted
begin
File.unlink(@script_tmp_path)
file_deleted = true
rescue Errno::EACCES
@logger.debug("failed to unlink #{@script_tmp_path}. retry...")
end
end
end
end
end
end
end
end
================================================
FILE: lib/vagrant-omnibus/config.rb
================================================
#
# Copyright (c) 2013, Seth Chisamore
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require "rubygems/dependency"
require "rubygems/dependency_installer"
require "vagrant"
require "vagrant/errors"
require "vagrant/util/template_renderer"
module VagrantPlugins
#
module Omnibus
# @author Seth Chisamore <schisamo@chef.io>
class Config < Vagrant.plugin("2", :config)
# @return [String]
# The version of Chef to install.
attr_accessor :chef_version, :install_url, :cache_packages
def initialize
@chef_version = UNSET_VALUE
@install_url = UNSET_VALUE
@cache_packages = UNSET_VALUE
@logger = Log4r::Logger.new("vagrantplugins::omnibus::config")
end
def finalize!
if @chef_version == UNSET_VALUE
@chef_version = nil
end
# enable caching by default
@cache_packages = true if @cache_packages == UNSET_VALUE
# nil means default install.sh|msi
@install_url = nil if @install_url == UNSET_VALUE
end
#
# Performs validation and immediately raises an exception for any
# detected errors.
#
# @raise [Vagrant::Errors::ConfigInvalid]
# if validation fails
#
def validate!(machine)
finalize!
errors = []
if !chef_version.nil? && !valid_chef_version?(chef_version)
msg = <<-EOH
'#{chef_version}' is not a valid version of Chef.
A list of valid versions can be found at: https://downloads.chef.io/chef-client/
EOH
errors << msg
end
if errors.any?
rendered_errors = Vagrant::Util::TemplateRenderer.render(
"config/validation_failed",
errors: { "vagrant-omnibus" => errors }
)
raise Vagrant::Errors::ConfigInvalid, errors: rendered_errors
end
end
private
# Query RubyGems.org's Ruby API to see if the user-provided Chef version
# is in fact a real Chef version!
def valid_chef_version?(version)
return true if version.to_s == "latest"
begin
available = dependency_installer.find_gems_with_sources(
chef_gem_dependency(version)
)
rescue ArgumentError => e
@logger.debug("#{version} is not a valid Chef version: #{e}")
return false
end
!available.empty?
end
def dependency_installer
@dependency_installer ||= Gem::DependencyInstaller.new
end
def chef_gem_dependency(version = nil)
Gem::Dependency.new("chef", version)
end
end
end
end
================================================
FILE: lib/vagrant-omnibus/plugin.rb
================================================
#
# Copyright (c) 2013, Seth Chisamore
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
module VagrantPlugins
#
module Omnibus
# @author Seth Chisamore <schisamo@chef.io>
class Plugin < Vagrant.plugin("2")
name "vagrant-omnibus"
description <<-DESC
This plugin ensures the desired version of Chef is installed
via the platform-specific Omnibus packages.
DESC
VAGRANT_VERSION_REQUIREMENT = ">= 1.1.0"
# Returns true if the Vagrant version fulfills the requirements
#
# @param requirements [String, Array<String>] the version requirement
# @return [Boolean]
def self.check_vagrant_version(*requirements)
Gem::Requirement.new(*requirements).satisfied_by?(
Gem::Version.new(Vagrant::VERSION)
)
end
# Verifies that the Vagrant version fulfills the requirements
#
# @raise [VagrantPlugins::Omnibus::VagrantVersionError] if this plugin
# is incompatible with the Vagrant version
def self.check_vagrant_version!
unless check_vagrant_version(VAGRANT_VERSION_REQUIREMENT)
msg = I18n.t(
"vagrant-omnibus.errors.vagrant_version",
requirement: VAGRANT_VERSION_REQUIREMENT.inspect
)
$stderr.puts(msg)
raise msg
end
end
action_hook(:install_chef, Plugin::ALL_ACTIONS) do |hook|
require_relative "action/install_chef"
hook.after(Vagrant::Action::Builtin::Provision, Action::InstallChef)
# The AWS provider < v0.4.0 uses a non-standard Provision action
# on initial creation:
#
# mitchellh/vagrant-aws/blob/v0.3.0/lib/vagrant-aws/action.rb#L105
#
if defined? VagrantPlugins::AWS::Action::TimedProvision
hook.after(
VagrantPlugins::AWS::Action::TimedProvision,
Action::InstallChef
)
end
end
config(:omnibus) do
require_relative "config"
Config
end
end
end
end
================================================
FILE: lib/vagrant-omnibus/version.rb
================================================
#
# Copyright (c) 2013, Seth Chisamore
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
module VagrantPlugins
#
module Omnibus
VERSION = "1.5.0"
end
end
================================================
FILE: lib/vagrant-omnibus.rb
================================================
#
# Copyright (c) 2013, Seth Chisamore
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require "vagrant"
require "vagrant-omnibus/plugin"
require "vagrant-omnibus/config"
module VagrantPlugins
#
module Omnibus
def self.source_root
@source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
end
I18n.load_path << File.expand_path("locales/en.yml", source_root)
I18n.reload!
end
end
================================================
FILE: locales/en.yml
================================================
en:
vagrant-omnibus:
action:
installed: "Chef %{version} Omnibus package is already installed."
installing: "Installing Chef %{version} Omnibus package..."
download:
downloading: "Downloading or copying install.sh..."
interrupted: "Install.sh download was interrupted. Exiting."
errors:
vagrant_version: |-
vagrant-omnibus plugin requires Vagrant version %{requirement}
================================================
FILE: test/acceptance/aws/Vagrantfile
================================================
# -*- mode: ruby -*-
# vi: set ft=ruby :
# plugins don't seem to be auto-loaded from the bundle
require "vagrant-omnibus"
require "vagrant-aws"
Vagrant.configure("2") do |config|
config.omnibus.chef_version = "11.4.0"
config.vm.box = "dummy"
config.vm.provider :aws do |aws, override|
aws.access_key_id = ENV["DEV_AWS_ACCESS_KEY_ID"]
aws.secret_access_key = ENV["DEV_AWS_SECRET_ACCESS_KEY"]
aws.keypair_name = ENV["USER"]
aws.instance_type = "m1.large"
aws.ami = "ami-2efa9d47" # Ubuntu 12.04 LTS 64-bit instance root store
override.ssh.username = "ubuntu"
override.ssh.private_key_path = "~/.ssh/id_rsa"
end
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path =
File.expand_path("../../../support/cookbooks", __FILE__)
chef.add_recipe "chef-inator"
end
end
================================================
FILE: test/acceptance/digital_ocean/Vagrantfile
================================================
Vagrant.require_plugin("vagrant-omnibus")
Vagrant.require_plugin("vagrant-digitalocean")
Vagrant.configure("2") do |config|
config.omnibus.chef_version = :latest
config.vm.box = "digital_ocean"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider :digital_ocean do |provider, override|
provider.client_id = ENV["DO_CLIENT_ID"]
provider.api_key = ENV["DO_API_KEY"]
provider.region = "New York 1"
provider.size = "512MB"
provider.image = "Ubuntu 12.04 x64 Server"
override.ssh.private_key_path = "~/.ssh/id_rsa"
end
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path =
File.expand_path("../../../support/cookbooks", __FILE__)
chef.add_recipe "chef-inator"
end
end
================================================
FILE: test/acceptance/linode/Vagrantfile
================================================
Vagrant.require_plugin("vagrant-omnibus")
Vagrant.require_plugin("vagrant-linode")
Vagrant.configure("2") do |config|
config.omnibus.chef_version = :latest
config.vm.box = "linode"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider :linode do |provider, override|
provider.token = ENV["LINODE_API_KEY"]
provider.datacenter = "newark"
provider.planid = 1
provider.distribution = "Ubuntu 18.04 LTS"
override.ssh.private_key_path = "~/.ssh/id_rsa"
end
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path =
File.expand_path("../../../support/cookbooks", __FILE__)
chef.add_recipe "chef-inator"
end
end
================================================
FILE: test/acceptance/rackspace/Vagrantfile
================================================
# -*- mode: ruby -*-
# vi: set ft=ruby :
# plugins don't seem to be auto-loaded from the bundle
require "vagrant-omnibus"
require "vagrant-rackspace"
Vagrant.configure("2") do |config|
config.omnibus.chef_version = "11.4.0"
config.vm.box = "dummy"
config.vm.provider :rackspace do |rackspace|
rackspace.username = ENV["DEV_RACKSPACE_USERNAME"]
rackspace.api_key = ENV["DEV_RACKSPACE_API_KEY"]
rackspace.flavor = /512MB/
rackspace.image = /Ubuntu 12.04/
rackspace.public_key_path = "~/.ssh/id_rsa.pub"
# TODO: switch this to the `override.ssh.private_key_path` syntax once
# `vagrant-rackspace` is updated.
config.ssh.private_key_path = "~/.ssh/id_rsa"
end
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path =
File.expand_path("../../../support/cookbooks", __FILE__)
chef.add_recipe "chef-inator"
end
end
================================================
FILE: test/acceptance/virtualbox/Vagrantfile
================================================
# -*- mode: ruby -*-
# vi: set ft=ruby :
# rubocop:disable LineLength
# plugins don't seem to be auto-loaded from the bundle
require "vagrant-omnibus"
def box_type
@box_type ||= begin
# Returns `/Users/schisamo/dev/code/schisamo/vagrant-omnibus/test/acceptance/vmware_fusion`
full_dir = File.dirname(File.expand_path(__FILE__))
# Returns `vmware_fusion`
base_dir = full_dir.split("/").last
base_dir.split("_").first
end
end
Vagrant.configure("2") do |config|
config.vm.define :new_chef do |new_chef_config|
new_chef_config.vm.box = "opscode-ubuntu-12.04"
new_chef_config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/#{box_type}/opscode_ubuntu-12.04_chef-provisionerless.box"
new_chef_config.omnibus.chef_version = :latest
new_chef_config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = File.expand_path("../../../support/cookbooks", __FILE__)
chef.add_recipe "chef-inator"
end
end
config.vm.define :old_chef do |old_chef_config|
old_chef_config.vm.box = "opscode-centos-6.5"
old_chef_config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/#{box_type}/opscode_centos-6.5_chef-provisionerless.box"
old_chef_config.omnibus.chef_version = "10.24.0"
old_chef_config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = File.expand_path("../../../support/cookbooks", __FILE__)
chef.add_recipe "chef-inator"
end
end
# We don't have legacy VMware boxes
unless box_type == "vmware"
config.vm.define :chef_already_installed do |installed_config|
installed_config.vm.box = "opscode-ubuntu-12.04-chef-11.4.4"
installed_config.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_chef-11.4.4.box"
installed_config.omnibus.chef_version = "11.4.4"
installed_config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = File.expand_path("../../../support/cookbooks", __FILE__)
chef.add_recipe "chef-inator"
end
end
end
config.vm.define :chef_on_windows do |win_config|
# win_config.vm.guest = :windows
win_config.vm.box = "win7x64-pro"
# build this yourself https://github.com/misheska/basebox-packer
# win_config.vm.box_url = ''
win_config.vm.boot_timeout = 500
win_config.omnibus.chef_version = :latest
win_config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = File.expand_path("../../../support/cookbooks", __FILE__)
chef.add_recipe "chef-inator"
end
end
config.vm.define :no_bash do |c|
c.vm.box = "opscode-freebsd-9.2"
c.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/#{box_type}/opscode_freebsd-9.2_chef-provisionerless.box"
c.omnibus.chef_version = :latest
c.vm.synced_folder ".", "/vagrant", type: "rsync", id: "vagrant-root"
# This forces all remote commands to execute under `sh`. If we don't
# add this config then all `chef` related commands will execute
# with `bash` (which might not be installed).
c.ssh.shell = "sh"
c.vm.provision :chef_solo do |chef|
chef.synced_folder_type = "rsync"
chef.cookbooks_path = File.expand_path("../../../support/cookbooks", __FILE__)
chef.add_recipe "chef-inator"
end
end
end
================================================
FILE: test/support/cookbooks/chef-inator/README.md
================================================
# super-tester cookbook
# Requirements
# Usage
# Attributes
# Recipes
# Author
Author:: YOUR_NAME (<YOUR_EMAIL>)
================================================
FILE: test/support/cookbooks/chef-inator/metadata.rb
================================================
name "chef-inator"
maintainer "Dr. Heinz Doofenshmirtz"
maintainer_email "heinz@doofenshmirtz-evil-inc.com"
license "All rights reserved"
description "Uses Chef to take over the Tri-State Area!"
long_description IO.read(File.join(File.dirname(__FILE__), "README.md"))
version "0.1.0"
================================================
FILE: test/support/cookbooks/chef-inator/recipes/default.rb
================================================
Chef::Log.info "CURSE YOU...Perry the Platypus!!!!"
================================================
FILE: test/unit/spec_helper.rb
================================================
$LOAD_PATH.unshift File.expand_path("../../../lib", __FILE__)
require "rspec/core"
require "vagrant-omnibus"
RSpec.configure do |config|
config.formatter = :documentation
# a little syntactic sugar
config.alias_it_should_behave_like_to :it_has_behavior, "has behavior:"
# Use color in STDOUT
config.color = true
# Use color not only in STDOUT but also in pagers and files
config.tty = true
# run the examples in random order
config.order = :rand
config.filter_run focus: true
config.run_all_when_everything_filtered = true
end
================================================
FILE: test/unit/vagrant-omnibus/config_spec.rb
================================================
require "spec_helper"
# rubocop:disable LineLength
describe VagrantPlugins::Omnibus::Config do
let(:machine) { double("machine") }
let(:instance) { described_class.new }
subject(:config) do
instance.tap do |o|
o.chef_version = chef_version if defined?(chef_version)
o.install_url = install_url if defined?(install_url)
o.cache_packages = cache_packages if defined?(cache_packages)
o.finalize!
end
end
context "default values" do
describe "#chef_version" do
subject { super().chef_version }
it { is_expected.to be_nil }
end
describe "#install_url" do
subject { super().install_url }
it { is_expected.to be_nil }
end
describe "#cache_packages" do
subject { super().cache_packages }
it { is_expected.to be_truthy }
end
end
describe "no longer resolves :latest to a Chef version" do
let(:chef_version) { :latest }
describe "#chef_version" do
subject { super().chef_version }
it { is_expected.to eql(:latest) }
end
end
describe "setting a custom `install_url`" do
let(:install_url) { "http://some_path.com/install.sh" }
describe "#install_url" do
subject { super().install_url }
it { is_expected.to eq("http://some_path.com/install.sh") }
end
end
describe "the `cache_packages` config option behaves truthy" do
[true, "something", :cachier].each do |obj|
describe "when `#{obj}` (#{obj.class})" do
let(:cache_packages) { obj }
describe "#cache_packages" do
subject { super().cache_packages }
it { is_expected.to be_truthy }
end
end
end
[nil, false].each do |obj|
describe "when `#{obj}` (#{obj.class})" do
let(:cache_packages) { obj }
describe "#cache_packages" do
subject { super().cache_packages }
it { is_expected.to be_falsey }
end
end
end
end
describe "validate" do
it "is a be no-op" do
expect(subject.validate(machine)).to eq("VagrantPlugins::Omnibus::Config" => [])
end
end
describe "#validate!" do
describe "chef_version validation" do
{
"11.4.0" => {
description: "valid Chef version string",
valid: true,
},
"10.99.99" => {
description: "invalid Chef version string",
valid: false,
},
"FUFUFU" => {
description: "invalid RubyGems version string",
valid: false,
},
}.each_pair do |version_string, opts|
context "#{opts[:description]}: #{version_string}" do
let(:chef_version) { version_string }
if opts[:valid]
it "passes" do
expect { subject.validate!(machine) }.to_not raise_error
end
else
it "fails" do
expect { subject.validate!(machine) }.to raise_error(Vagrant::Errors::ConfigInvalid)
end
end
end
end
end # describe chef_version
describe "not specified chef_version validation" do
it "passes" do
allow_any_instance_of(Gem::DependencyInstaller).to receive(:find_gems_with_sources).and_return([])
expect { subject.validate!(machine) }.to_not raise_error
end
end # describe not specified chef_version validation
end # describe #validate
end
================================================
FILE: test/unit/vagrant-omnibus/plugin_spec.rb
================================================
require "spec_helper"
describe VagrantPlugins::Omnibus::Plugin do
context "action hooks" do
let(:hook) { double(append: true, prepend: true) }
let(:fake_class) { Class.new }
it "should hook InstallChef before Provision" do
stub_const("VagrantPlugins::Omnibus::Action::InstallChef", fake_class)
hook_proc = described_class.components.action_hooks[:__all_actions__][0]
hook = double
expect(hook).to receive(:after).with(Vagrant::Action::Builtin::Provision, VagrantPlugins::Omnibus::Action::InstallChef)
hook_proc.call(hook)
end
end
it "should define a config of type :omnibus" do
default_config = described_class.components.configs[:top].to_hash[:omnibus]
expect(default_config).to be(VagrantPlugins::Omnibus::Config)
end
describe ".check_vagrant_version" do
before :each do
stub_const("Vagrant::VERSION", "1.2.3")
end
it "accepts single String argument" do
expect(described_class.check_vagrant_version("~> 1.1")).to be_truthy
expect(described_class.check_vagrant_version("1.2")).to be_falsey
end
it "accepts an Array argument" do
expect(described_class.check_vagrant_version([">= 1.1", "< 1.3.0.beta"])).to be_truthy
expect(described_class.check_vagrant_version([">= 1.3"])).to be_falsey
end
it "accepts multiple arguments" do
expect(described_class.check_vagrant_version(">= 1.0", "<= 1.3")).to be_truthy
expect(described_class.check_vagrant_version("~> 1.2", ">= 1.2.5")).to be_falsey
end
end
describe ".check_vagrant_version!" do
subject { described_class.check_vagrant_version! }
let(:requirement) { ">= 1.1.0" }
let(:err_msg) { /requires Vagrant version #{Regexp.escape(requirement.inspect)}/ }
before :each do
stub_const(
"VagrantPlugins::ProxyConf::Plugin::VAGRANT_VERSION_REQUIREMENT",
requirement
)
stub_const("Vagrant::VERSION", vagrant_version)
allow($stderr).to receive(:puts)
end
context "on too old Vagrant version" do
let(:vagrant_version) { "1.0.9" }
it "raises error" do
expect { subject }.to raise_error(err_msg)
end
it "warns as stderr" do
expect($stderr).to receive(:puts).with(err_msg)
expect { subject }.to raise_error(err_msg)
end
end
context "on exact required Vagrant version" do
let(:vagrant_version) { "1.1.0" }
it "does not raise" do
expect { subject }.not_to raise_error
end
end
context "on newer Vagrant version" do
let(:vagrant_version) { "1.3.5" }
it "does not raise" do
expect { subject }.not_to raise_error
end
end
end
end
================================================
FILE: vagrant-omnibus.gemspec
================================================
# coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "vagrant-omnibus/version"
Gem::Specification.new do |spec|
spec.name = "vagrant-omnibus"
spec.version = VagrantPlugins::Omnibus::VERSION
spec.authors = ["Seth Chisamore"]
spec.email = ["schisamo@chef.io"]
spec.description = "A Vagrant plugin that ensures the desired version of" \
" Chef is installed via the platform-specific Omnibus" \
" packages."
spec.summary = spec.description
spec.homepage = "https://github.com/chef/vagrant-omnibus"
spec.license = "Apache 2.0"
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake", "~> 11.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "chefstyle", "~> 0.10.0"
end
gitextract_njy126on/ ├── .gitignore ├── .rspec ├── .travis.yml ├── .yardopts ├── CHANGELOG.md ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── lib/ │ ├── vagrant-omnibus/ │ │ ├── action/ │ │ │ └── install_chef.rb │ │ ├── config.rb │ │ ├── plugin.rb │ │ └── version.rb │ └── vagrant-omnibus.rb ├── locales/ │ └── en.yml ├── test/ │ ├── acceptance/ │ │ ├── aws/ │ │ │ └── Vagrantfile │ │ ├── digital_ocean/ │ │ │ └── Vagrantfile │ │ ├── linode/ │ │ │ └── Vagrantfile │ │ ├── rackspace/ │ │ │ └── Vagrantfile │ │ └── virtualbox/ │ │ └── Vagrantfile │ ├── support/ │ │ └── cookbooks/ │ │ └── chef-inator/ │ │ ├── README.md │ │ ├── metadata.rb │ │ └── recipes/ │ │ └── default.rb │ └── unit/ │ ├── spec_helper.rb │ └── vagrant-omnibus/ │ ├── config_spec.rb │ └── plugin_spec.rb └── vagrant-omnibus.gemspec
SYMBOL INDEX (44 symbols across 5 files)
FILE: lib/vagrant-omnibus.rb
type VagrantPlugins (line 21) | module VagrantPlugins
type Omnibus (line 23) | module Omnibus
function source_root (line 24) | def self.source_root
FILE: lib/vagrant-omnibus/action/install_chef.rb
type VagrantPlugins (line 22) | module VagrantPlugins
type Omnibus (line 23) | module Omnibus
type Action (line 24) | module Action
class InstallChef (line 28) | class InstallChef
method initialize (line 29) | def initialize(app, env)
method call (line 37) | def call(env)
method find_install_script (line 71) | def find_install_script
method default_install_url (line 75) | def default_install_url
method config_install_url (line 83) | def config_install_url
method env_install_url (line 87) | def env_install_url
method cached_omnibus_download_dir (line 91) | def cached_omnibus_download_dir
method cache_packages? (line 95) | def cache_packages?
method cachier_present? (line 99) | def cachier_present?
method cachier_autodetect_enabled? (line 103) | def cachier_autodetect_enabled?
method download_to_cached_dir? (line 107) | def download_to_cached_dir?
method install_script_name (line 111) | def install_script_name
method install_script_folder (line 119) | def install_script_folder
method install_script_path (line 127) | def install_script_path
method windows_guest? (line 131) | def windows_guest?
method provision_enabled? (line 135) | def provision_enabled?(env)
method communication_opts (line 139) | def communication_opts
method installed_version (line 147) | def installed_version
method install (line 165) | def install(version, env)
method fetch_or_create_install_script (line 198) | def fetch_or_create_install_script(env)
method recover (line 253) | def recover(env)
FILE: lib/vagrant-omnibus/config.rb
type VagrantPlugins (line 23) | module VagrantPlugins
type Omnibus (line 25) | module Omnibus
class Config (line 27) | class Config < Vagrant.plugin("2", :config)
method initialize (line 32) | def initialize
method finalize! (line 39) | def finalize!
method validate! (line 56) | def validate!(machine)
method valid_chef_version? (line 82) | def valid_chef_version?(version)
method dependency_installer (line 95) | def dependency_installer
method chef_gem_dependency (line 99) | def chef_gem_dependency(version = nil)
FILE: lib/vagrant-omnibus/plugin.rb
type VagrantPlugins (line 17) | module VagrantPlugins
type Omnibus (line 19) | module Omnibus
class Plugin (line 21) | class Plugin < Vagrant.plugin("2")
method check_vagrant_version (line 34) | def self.check_vagrant_version(*requirements)
method check_vagrant_version! (line 44) | def self.check_vagrant_version!
FILE: lib/vagrant-omnibus/version.rb
type VagrantPlugins (line 17) | module VagrantPlugins
type Omnibus (line 19) | module Omnibus
Condensed preview — 27 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (61K chars).
[
{
"path": ".gitignore",
"chars": 169,
"preview": "*.gem\n*.rbc\n.bundle\n.config\n.yardoc\nGemfile.lock\nInstalledFiles\n_yardoc\ncoverage\ndoc/\nlib/bundler/man\npkg\nrdoc\nspec/repo"
},
{
"path": ".rspec",
"chars": 25,
"preview": "--default-path test/unit\n"
},
{
"path": ".travis.yml",
"chars": 163,
"preview": "rvm:\n - 2.2.10\n - 2.3.7\n - 2.4.4\n - 2.5.1\n\nbranches:\n only:\n - master\n\nbundler_args: --jobs 7 --without=acceptan"
},
{
"path": ".yardopts",
"chars": 96,
"preview": "--markup=markdown\n--markup-provider=redcarpet\n--readme=README.md\n-\nCHANGELOG.md\nLICENSE\nTODO.md\n"
},
{
"path": "CHANGELOG.md",
"chars": 6643,
"preview": "# Change Log\n\n## [1.5.0](https://github.com/chef/vagrant-omnibus/tree/1.5.0) (2016-08-31)\n[Full Changelog](https://githu"
},
{
"path": "Gemfile",
"chars": 602,
"preview": "source \"https://rubygems.org\"\n\ngemspec\n\ngroup :development do\n # We depend on Vagrant for development, but we don't add"
},
{
"path": "LICENSE",
"chars": 10850,
"preview": " Apache License\n Version 2.0, January 2004\n http"
},
{
"path": "README.md",
"chars": 4840,
"preview": "# vagrant-omnibus\n\n## Deprecation Warning\n\nThis is no longer an actively maintained Chef project. We believe that Test K"
},
{
"path": "Rakefile",
"chars": 2871,
"preview": "require \"bundler/setup\"\nrequire \"bundler/gem_tasks\"\nrequire \"rspec/core/rake_task\"\nrequire \"chefstyle\"\nrequire \"rubocop/"
},
{
"path": "lib/vagrant-omnibus/action/install_chef.rb",
"chars": 8580,
"preview": "#\n# Copyright (c) 2013, Seth Chisamore\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not"
},
{
"path": "lib/vagrant-omnibus/config.rb",
"chars": 3183,
"preview": "#\n# Copyright (c) 2013, Seth Chisamore\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not"
},
{
"path": "lib/vagrant-omnibus/plugin.rb",
"chars": 2536,
"preview": "#\n# Copyright (c) 2013, Seth Chisamore\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not"
},
{
"path": "lib/vagrant-omnibus/version.rb",
"chars": 663,
"preview": "#\n# Copyright (c) 2013, Seth Chisamore\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not"
},
{
"path": "lib/vagrant-omnibus.rb",
"chars": 921,
"preview": "#\n# Copyright (c) 2013, Seth Chisamore\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not"
},
{
"path": "locales/en.yml",
"chars": 422,
"preview": "en:\n vagrant-omnibus:\n action:\n installed: \"Chef %{version} Omnibus package is already installed.\"\n instal"
},
{
"path": "test/acceptance/aws/Vagrantfile",
"chars": 827,
"preview": "# -*- mode: ruby -*-\n# vi: set ft=ruby :\n\n# plugins don't seem to be auto-loaded from the bundle\nrequire \"vagrant-omnibu"
},
{
"path": "test/acceptance/digital_ocean/Vagrantfile",
"chars": 750,
"preview": "Vagrant.require_plugin(\"vagrant-omnibus\")\nVagrant.require_plugin(\"vagrant-digitalocean\")\n\nVagrant.configure(\"2\") do |con"
},
{
"path": "test/acceptance/linode/Vagrantfile",
"chars": 683,
"preview": "Vagrant.require_plugin(\"vagrant-omnibus\")\nVagrant.require_plugin(\"vagrant-linode\")\n\nVagrant.configure(\"2\") do |config|\n "
},
{
"path": "test/acceptance/rackspace/Vagrantfile",
"chars": 876,
"preview": "# -*- mode: ruby -*-\n# vi: set ft=ruby :\n\n# plugins don't seem to be auto-loaded from the bundle\nrequire \"vagrant-omnibu"
},
{
"path": "test/acceptance/virtualbox/Vagrantfile",
"chars": 3337,
"preview": "# -*- mode: ruby -*-\n# vi: set ft=ruby :\n\n# rubocop:disable LineLength\n\n# plugins don't seem to be auto-loaded from the "
},
{
"path": "test/support/cookbooks/chef-inator/README.md",
"chars": 119,
"preview": "# super-tester cookbook\n\n# Requirements\n\n# Usage\n\n# Attributes\n\n# Recipes\n\n# Author\n\nAuthor:: YOUR_NAME (<YOUR_EMAIL>)\n"
},
{
"path": "test/support/cookbooks/chef-inator/metadata.rb",
"chars": 325,
"preview": "name \"chef-inator\"\nmaintainer \"Dr. Heinz Doofenshmirtz\"\nmaintainer_email \"heinz@doofenshmirtz-evil-inc"
},
{
"path": "test/support/cookbooks/chef-inator/recipes/default.rb",
"chars": 53,
"preview": "\nChef::Log.info \"CURSE YOU...Perry the Platypus!!!!\"\n"
},
{
"path": "test/unit/spec_helper.rb",
"chars": 556,
"preview": "$LOAD_PATH.unshift File.expand_path(\"../../../lib\", __FILE__)\n\nrequire \"rspec/core\"\nrequire \"vagrant-omnibus\"\n\nRSpec.con"
},
{
"path": "test/unit/vagrant-omnibus/config_spec.rb",
"chars": 3382,
"preview": "require \"spec_helper\"\n\n# rubocop:disable LineLength\n\ndescribe VagrantPlugins::Omnibus::Config do\n let(:machine) { doubl"
},
{
"path": "test/unit/vagrant-omnibus/plugin_spec.rb",
"chars": 2703,
"preview": "require \"spec_helper\"\n\ndescribe VagrantPlugins::Omnibus::Plugin do\n\n context \"action hooks\" do\n let(:hook) { double("
},
{
"path": "vagrant-omnibus.gemspec",
"chars": 1166,
"preview": "# coding: utf-8\nlib = File.expand_path(\"../lib\", __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequi"
}
]
About this extraction
This page contains the full source code of the chef/vagrant-omnibus GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 27 files (56.0 KB), approximately 15.3k tokens, and a symbol index with 44 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.