vagrant-omnibus 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzQxYmJiN2Q2YzI1NGYyMTg4Njk5NmEyNzMwNmZiOTlmMGMyY2QzNw==
4
+ MzNiOTFhOWM4OGRiODViMjA2Zjc5NzY0ZjFiMTIyZGFmMWFmOWJlYg==
5
5
  data.tar.gz: !binary |-
6
- NzVlNTBhMmI0ZGI0ODkyYzc0MjA3YzA2NDdiNGQ2NWJjZjAzMTUyYg==
6
+ N2Y5NTYwODVmODc0YmQwMjRjYjM4YmQ0YjE2Y2JhMGJlOTcwYTc1NQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MDEyMTRjZDlmMzQ4YWQ5MGZiMzliMjk4Mzk5NzQ0NzhhNGI3Yzc3YmU1ZDZi
10
- MmQ2MWIxNDM2NjI0M2Q0YjcxZjE3NDNlMGY5N2Q5ZDE1NTRmNTQwNjIzNTEy
11
- MWU3ZDA5MjdhODEzMjQwNTcxMTFjN2VlZGM1ZTA4ZDE2NGVmOWM=
9
+ ODYyNjY0ZDZmM2YxMmMzZTdlYjQyOTk4YzhiY2VmNWNjNzg3ZTAxYmVkZmZh
10
+ MzdjZDRiNjI3ZGMzMThhODhmNDMyNjNlZjliZTk2NjJjNGU5NGIzYzY5ZDEy
11
+ ODU0Y2ViMzU1ZWZjMTkxOWVkY2ZhMDU5YzlkMWViNjRjZmNhNGQ=
12
12
  data.tar.gz: !binary |-
13
- YjQ4NWI5NTQwMzc2MmE4YjA0ZTQ5NjI0OTg0ZDBlYzNmZjViMmI1NGJhZGU1
14
- ZTM2OGE2MzMzZGQ1ZDc5YzI1YjgxMjFjZTljZTI4NGU2NjM0NjUxY2Y3YTZm
15
- MGU3OThiMWY1MjFhNzY0ZDk4YjNmOTA3Zjg5NGY2OWJmNTkwMDk=
13
+ MGYzYmJjY2IwNDYyNjNlMDVkOWFlOThlNTVhYWI3NjAyODk4NDczMDM0Y2Ux
14
+ YzBmODQ4YTc5NDJjNjdhYTcyMjVkMTAyZjAzYWVjMjM0YzQxNGExZjIxMzkw
15
+ ZjU0ZTE1OGQ4YjM3YmM2M2ZlZjM2NzllZDE4MjI2ZTU5NzE4YmI=
data/CHANGELOG.md CHANGED
@@ -1,38 +1,58 @@
1
+ ## 1.1.0 (June 21, 2013)
2
+
3
+ FEATURES:
4
+
5
+ * PR [#23][], Issues [#17][], [#19][], [#21][], [#23][]: Support for all Vagrant providers that hook into `Vagrant::Action::Builtin::Provision` for provisioning. ([@smdahlen][], [@michfield][], [@rjocoleman][])
6
+ * Issue [#15][]: Multi-VM Vagrantfiles are now fully supported. A global `omnibus.chef_version` will install the same version of Chef on all VMs OR declare a separate Chef version in the config block for each individual VM! ([@smdahlen][], [@schisamo][])
7
+ * PR [#10][]: Optionally change the location of `install.sh` via the `OMNIBUS_INSTALL_URL` environment variable. Default is still https://www.opscode.com/chef/install.sh. , ([@petecheslock][])
8
+
1
9
  ## 1.0.2 (April 20, 2013)
2
10
 
3
11
  IMPROVEMENTS:
4
12
 
5
- * unit test coverage for `VagrantPlugins::Omnibus::Config`
6
- * Add Rackspace provider acceptance test.
7
- * Parameterize the acceptance test Rake task, this allows you test run
8
- acceptance tests against a single provider.
13
+ * Unit test coverage for `VagrantPlugins::Omnibus::Config` ([@schisamo][])
14
+ * Add Rackspace provider acceptance test. ([@schisamo][])
15
+ * Parameterize the acceptance test Rake task, this allows you test run acceptance tests against a single provider. ([@schisamo][])
9
16
 
10
17
  BUG FIXES:
11
18
 
12
- * convert `Gem::Version` returned by `#retrieve_latest_chef_version` to a
13
- string. fixes [GH-2] for realz.
14
- * RubyGems 2.0 compat: use #empty? to check for results. fixes [GH-6]
15
- * Ensure 'vagrant-rackspace/action' is loaded. fixes [GH-7]
16
- * Trigger plugin if machine state is `:active`. fixes [GH-8]
19
+ * Fixes [#2][]: Convert `Gem::Version` returned by `#retrieve_latest_chef_version` to a string. ([@schisamo][])
20
+ * Fixes [#6][]: RubyGems 2.0 compat: use #empty? to check for results. ([@schisamo][])
21
+ * Fixes [#7][]: Ensure 'vagrant-rackspace/action' is loaded. ([@schisamo][])
22
+ * Fixes [#8][]: Trigger plugin if machine state is `:active`. ([@schisamo][])
17
23
 
18
24
  ## 1.0.1 (April 17, 2013)
19
25
 
20
26
  IMPROVEMENTS:
21
27
 
22
- * Resolve `latest` to a real Chef version. This ensures the plugin does not
23
- attempt to re-install Chef on subsequent provisions. [GH-2]
24
- * Validate user provided value for omnibus.chef_version is in fact a real Chef
25
- version. [GH-4]
26
- * Retrieve omnibus.chef_version directly from global config.
27
- * Update development depdendencies to vagrant (1.2.1) and vagrant-aws
28
- (0.2.1).
28
+ * Issue [#2][]: Resolve `latest` to a real Chef version. This ensures the plugin does not attempt to re-install Chef on subsequent provisions. ([@schisamo][])
29
+ * Issue [#4][]: Validate user provided value for omnibus.chef_version is in fact a real Chef version. ([@schisamo][])
30
+ * Retrieve omnibus.chef_version directly from global config. ([@schisamo][])
31
+ * Update development dependencies to vagrant (1.2.1) and vagrant-aws (0.2.1). ([@schisamo][])
29
32
 
30
33
  BUG FIXES:
31
34
 
32
- * Plugin now correctly operates in "no-op" node if now "omnibus.chef_version"
33
- is not present in the Vagrantfile. [GH-3]
34
- * Use Ubuntu 12.04 release AMI for acceptance testing.
35
+ * Issue [#3][]: Plugin now correctly operates in "no-op" node if now `omnibus.chef_version` is not present in the Vagrantfile. ([@schisamo][])
36
+ * Use Ubuntu 12.04 release AMI for acceptance testing. ([@schisamo][])
35
37
 
36
38
  ## 1.0.0 (April 1, 2013)
37
39
 
38
40
  * The initial release.
41
+ <!--- The following link definition list is generated by PimpMyChangelog --->
42
+ [#2]: https://github.com/schisamo/vagrant/issues/2
43
+ [#3]: https://github.com/schisamo/vagrant/issues/3
44
+ [#4]: https://github.com/schisamo/vagrant/issues/4
45
+ [#6]: https://github.com/schisamo/vagrant/issues/6
46
+ [#7]: https://github.com/schisamo/vagrant/issues/7
47
+ [#8]: https://github.com/schisamo/vagrant/issues/8
48
+ [#10]: https://github.com/schisamo/vagrant/issues/10
49
+ [#15]: https://github.com/schisamo/vagrant/issues/15
50
+ [#17]: https://github.com/schisamo/vagrant/issues/17
51
+ [#19]: https://github.com/schisamo/vagrant/issues/19
52
+ [#21]: https://github.com/schisamo/vagrant/issues/21
53
+ [#23]: https://github.com/schisamo/vagrant/issues/23
54
+ [@michfield]: https://github.com/michfield
55
+ [@petecheslock]: https://github.com/petecheslock
56
+ [@rjocoleman]: https://github.com/rjocoleman
57
+ [@schisamo]: https://github.com/schisamo
58
+ [@smdahlen]: https://github.com/smdahlen
data/Gemfile CHANGED
@@ -10,6 +10,7 @@ group :development do
10
10
  end
11
11
 
12
12
  group :test do
13
+ gem "vagrant-digitalocean", "~> 0.2.0"
13
14
  gem "vagrant-aws", "~> 0.2.2"
14
15
  gem "vagrant-rackspace", "~> 0.1.1"
15
16
  end
data/README.md CHANGED
@@ -9,15 +9,17 @@ A Vagrant plugin that ensures the desired version of Chef is installed via the
9
9
  platform-specific Omnibus packages. This proves very useful when using Vagrant
10
10
  with provisioner-less baseboxes OR cloud images.
11
11
 
12
- This plugin has been verified to work with the following
12
+ The plugin should work correctly with most all providers that hook into
13
+ `Vagrant::Action::Builtin::Provision` for provisioning and is
14
+ known to work with the following
13
15
  [Vagrant providers](http://docs.vagrantup.com/v2/providers/index.html):
14
16
 
15
17
  * VirtualBox (part of core)
16
18
  * AWS (ships in [vagrant-aws](https://github.com/mitchellh/vagrant-aws) plugin)
17
19
  * Rackspace (ships in [vagrant-rackspace](https://github.com/mitchellh/vagrant-rackspace)
18
20
  plugin)
19
-
20
- It may work with other Vagrant providers but is not guaranteed to!
21
+ * VMWare Fusion (can be [purchased from Hashicorp](http://www.vagrantup.com/vmware))
22
+ * LXC (ships in [vagrant-lxc](https://github.com/fgrehm/vagrant-lxc))
21
23
 
22
24
  ## Installation
23
25
 
@@ -61,6 +63,35 @@ Vagrant.configure("2") do |config|
61
63
  end
62
64
  ```
63
65
 
66
+ This plugin is also multi-vm aware so it would possible to say install a
67
+ different version of Chef on each VM:
68
+
69
+ ```ruby
70
+ Vagrant.configure("2") do |config|
71
+
72
+ config.vm.define :new_chef do |new_chef_config|
73
+
74
+ ...
75
+
76
+ new_chef_config.omnibus.chef_version = :latest
77
+
78
+ ...
79
+
80
+ end
81
+
82
+ config.vm.define :old_chef do |old_chef_config|
83
+
84
+ ...
85
+
86
+ old_chef_config.omnibus.chef_version = "10.24.0"
87
+
88
+ ...
89
+
90
+ end
91
+ end
92
+
93
+ ```
94
+
64
95
  ## Tests
65
96
 
66
97
  ### Unit
data/Rakefile CHANGED
@@ -21,6 +21,10 @@ namespace :test do
21
21
  end
22
22
  end
23
23
 
24
+ unless system("vagrant box list | grep 'digital_ocean' &>/dev/null")
25
+ system("vagrant box add digital_ocean https://github.com/smdahlen/vagrant-digitalocean/raw/master/box/digital_ocean.box")
26
+ end
27
+
24
28
  all_providers = Dir["test/acceptance/*"].map{|dir| File.basename(File.expand_path(dir))}
25
29
 
26
30
  # If a provider wasn't passed to the task run acceptance tests against
@@ -14,12 +14,17 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "pathname"
18
- require "vagrant-omnibus/plugin"
17
+ require 'vagrant'
18
+ require 'vagrant-omnibus/plugin'
19
+ require 'vagrant-omnibus/config'
19
20
 
20
21
  module VagrantPlugins
21
22
  module Omnibus
22
- autoload :Action, 'vagrant-omnibus/action'
23
- autoload :Config, 'vagrant-omnibus/config'
23
+ def self.source_root
24
+ @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
25
+ end
26
+
27
+ I18n.load_path << File.expand_path('locales/en.yml', source_root)
28
+ I18n.reload!
24
29
  end
25
30
  end
@@ -14,30 +14,15 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "vagrant/action/builder"
17
+ require "vagrant-omnibus/action/install_chef"
18
18
 
19
19
  module VagrantPlugins
20
20
  module Omnibus
21
21
  module Action
22
- autoload :InstallChef, File.expand_path("../action/install_chef", __FILE__)
23
- autoload :IsRunningOrActive, File.expand_path("../action/is_running_or_active", __FILE__)
24
- autoload :ReadChefVersion, File.expand_path("../action/read_chef_version", __FILE__)
25
-
26
- # Include the built-in modules so that we can use them as top-level
27
- # things.
28
- include Vagrant::Action::Builtin
29
-
30
- # @return [::Vagrant::Action::Builder]
31
22
  def self.install_chef
32
23
  @install_chef ||= ::Vagrant::Action::Builder.new.tap do |b|
33
- b.use ConfigValidate
34
- b.use Call, IsRunningOrActive do |env1, b2|
35
- if env1[:result]
36
- b2.use ReadChefVersion
37
- b2.use InstallChef
38
- b2.use SSHRun
39
- end
40
- end
24
+ b.use ::Vagrant::Action::Builtin::ConfigValidate
25
+ b.use InstallChef
41
26
  end
42
27
  end
43
28
  end
@@ -22,43 +22,58 @@ module VagrantPlugins
22
22
  # This action installs Chef Omnibus packages at the desired version.
23
23
  class InstallChef
24
24
 
25
- INSTALL_SH = "https://www.opscode.com/chef/install.sh".freeze
25
+ INSTALL_SH = "#{ENV['OMNIBUS_INSTALL_URL'] || 'https://www.opscode.com/chef/install.sh'}"
26
26
 
27
27
  def initialize(app, env)
28
28
  @app = app
29
+ @machine = env[:machine]
29
30
  # Config#finalize! SHOULD be called automatically
30
- env[:global_config].omnibus.finalize!
31
+ @machine.config.omnibus.finalize!
31
32
  end
32
33
 
33
34
  def call(env)
34
- desired_chef_version = env[:global_config].omnibus.chef_version
35
+ @app.call(env)
36
+
37
+ return unless @machine.communicate.ready?
35
38
 
36
- unless desired_chef_version.nil?
37
- env[:ui].info("Ensuring Chef is installed at requested version of #{desired_chef_version}.")
38
- if env[:installed_chef_version] == desired_chef_version
39
- env[:ui].info("Chef #{desired_chef_version} Omnibus package is already installed...skipping installation.")
39
+ desired_version = @machine.config.omnibus.chef_version
40
+ unless desired_version.nil?
41
+ if installed_version == desired_version
42
+ env[:ui].info I18n.t('vagrant-omnibus.action.installed', {
43
+ :version => desired_version
44
+ })
40
45
  else
41
- env[:ui].info("Chef #{desired_chef_version} Omnibus package is not installed...installing now.")
42
- env[:ssh_run_command] = install_chef_command(desired_chef_version)
46
+ env[:ui].info I18n.t('vagrant-omnibus.action.installing', {
47
+ :version => desired_version
48
+ })
49
+ install(desired_version)
43
50
  end
44
51
  end
45
-
46
- @app.call(env)
47
52
  end
48
53
 
49
54
  private
50
55
 
51
- def install_chef_command(version=latest)
52
- <<-INSTALL_OMNIBUS
53
- if command -v wget &>/dev/null; then
54
- wget -qO- #{INSTALL_SH} | sudo bash -s -- -v #{version}
55
- elif command -v curl &>/dev/null; then
56
- curl -L #{INSTALL_SH} -v #{version} | sudo bash
57
- else
58
- echo "Neither wget nor curl found. Please install one and try again." >&2
59
- exit 1
60
- fi
61
- INSTALL_OMNIBUS
56
+ def installed_version
57
+ version = nil
58
+ command = 'echo $(chef-solo --v | awk "{print \\$2}" || "")'
59
+ @machine.communicate.sudo(command) do |type, data|
60
+ version = data.chomp if [:stderr, :stdout].include?(type)
61
+ end
62
+ version
63
+ end
64
+
65
+ def install(version)
66
+ command = <<-INSTALL_OMNIBUS
67
+ if command -v wget &>/dev/null; then
68
+ wget -qO- #{INSTALL_SH} | sudo bash -s -- -v #{version}
69
+ elif command -v curl &>/dev/null; then
70
+ curl -L #{INSTALL_SH} -v #{version} | sudo bash
71
+ else
72
+ echo "Neither wget nor curl found. Please install one." >&2
73
+ exit 1
74
+ fi
75
+ INSTALL_OMNIBUS
76
+ @machine.communicate.sudo(command)
62
77
  end
63
78
  end
64
79
  end
@@ -14,12 +14,6 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- begin
18
- require "vagrant"
19
- rescue LoadError
20
- raise "The Vagrant Omnibus plugin must be run within Vagrant."
21
- end
22
-
23
17
  # This is a sanity check to make sure no one is attempting to install
24
18
  # this into an early Vagrant version.
25
19
  if Vagrant::VERSION < "1.1.0"
@@ -36,37 +30,20 @@ module VagrantPlugins
36
30
  via the platform-specific Omnibus packages.
37
31
  DESC
38
32
 
39
- def self.provision(hook)
40
-
33
+ action_hook(:install_chef, Plugin::ALL_ACTIONS) do |hook|
34
+ require_relative "action"
41
35
  hook.after(Vagrant::Action::Builtin::Provision, Action.install_chef)
42
36
 
43
- # BEGIN workaround
37
+ # The AWS provider uses a non-standard Provision action on initial
38
+ # creation:
39
+ #
40
+ # https://github.com/mitchellh/vagrant-aws/blob/master/lib/vagrant-aws/action.rb#L105
44
41
  #
45
- # Currently hooks attached to {Vagrant::Action::Builtin::Provision} are
46
- # not wired into the middleware return path. My current workaround is to
47
- # fire after anything boot related which wedges in right before the
48
- # actual real run of the provisioner.
49
-
50
- hook.after(VagrantPlugins::ProviderVirtualBox::Action::Boot, Action.install_chef)
51
-
52
42
  if VagrantPlugins.const_defined?("AWS")
53
- hook.after(VagrantPlugins::AWS::Action::RunInstance, Action.install_chef)
54
- end
55
-
56
- if VagrantPlugins.const_defined?("Rackspace")
57
- # The `VagrantPlugins::Rackspace` module is missing the autoload for
58
- # `VagrantPlugins::Rackspace::Action` so we need to ensure it is
59
- # loaded before accessing the module in the after hook below.
60
- require 'vagrant-rackspace/action'
61
- hook.after(VagrantPlugins::Rackspace::Action::CreateServer, Action.install_chef)
43
+ hook.after(VagrantPlugins::AWS::Action::TimedProvision, Action.install_chef)
62
44
  end
63
-
64
- # END workaround
65
45
  end
66
46
 
67
- action_hook(:install_chef, :machine_action_up, &method(:provision))
68
- action_hook(:install_chef, :machine_action_provision, &method(:provision))
69
-
70
47
  config(:omnibus) do
71
48
  require_relative "config"
72
49
  Config
@@ -16,6 +16,6 @@
16
16
 
17
17
  module VagrantPlugins
18
18
  module Omnibus
19
- VERSION = "1.0.2"
19
+ VERSION = "1.1.0"
20
20
  end
21
21
  end
data/locales/en.yml ADDED
@@ -0,0 +1,5 @@
1
+ en:
2
+ vagrant-omnibus:
3
+ action:
4
+ installed: "Chef %{version} Omnibus package is already installed."
5
+ installing: "Installing Chef %{version} Omnibus package..."
@@ -0,0 +1,23 @@
1
+ Vagrant.require_plugin('vagrant-omnibus')
2
+ Vagrant.require_plugin('vagrant-digitalocean')
3
+
4
+ Vagrant.configure('2') do |config|
5
+ config.omnibus.chef_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 = 'New York 1'
14
+ provider.size = '512MB'
15
+ provider.image = 'Ubuntu 12.04 x64 Server'
16
+ override.ssh.private_key_path = '~/.ssh/id_rsa'
17
+ end
18
+
19
+ config.vm.provision :chef_solo do |chef|
20
+ chef.cookbooks_path = File.expand_path("../../../support/cookbooks", __FILE__)
21
+ chef.add_recipe "chef-inator"
22
+ end
23
+ end
@@ -5,13 +5,28 @@
5
5
  require 'vagrant-omnibus'
6
6
 
7
7
  Vagrant.configure("2") do |config|
8
- config.omnibus.chef_version = :latest
9
8
 
10
- config.vm.box = "canonical-ubuntu-12.04"
11
- config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
9
+ config.vm.define :new_chef do |new_chef_config|
10
+ new_chef_config.vm.box = "canonical-ubuntu-12.04"
11
+ new_chef_config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
12
12
 
13
- config.vm.provision :chef_solo do |chef|
14
- chef.cookbooks_path = File.expand_path("../../../support/cookbooks", __FILE__)
15
- chef.add_recipe "chef-inator"
13
+ new_chef_config.omnibus.chef_version = :latest
14
+
15
+ new_chef_config.vm.provision :chef_solo do |chef|
16
+ chef.cookbooks_path = File.expand_path("../../../support/cookbooks", __FILE__)
17
+ chef.add_recipe "chef-inator"
18
+ end
19
+ end
20
+
21
+ config.vm.define :old_chef do |old_chef_config|
22
+ old_chef_config.vm.box = "opscode-centos-6.4"
23
+ old_chef_config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box"
24
+
25
+ old_chef_config.omnibus.chef_version = "10.24.0"
26
+
27
+ old_chef_config.vm.provision :chef_solo do |chef|
28
+ chef.cookbooks_path = File.expand_path("../../../support/cookbooks", __FILE__)
29
+ chef.add_recipe "chef-inator"
30
+ end
16
31
  end
17
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-omnibus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Chisamore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-20 00:00:00.000000000 Z
11
+ date: 2013-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,12 +73,12 @@ files:
73
73
  - lib/vagrant-omnibus.rb
74
74
  - lib/vagrant-omnibus/action.rb
75
75
  - lib/vagrant-omnibus/action/install_chef.rb
76
- - lib/vagrant-omnibus/action/is_running_or_active.rb
77
- - lib/vagrant-omnibus/action/read_chef_version.rb
78
76
  - lib/vagrant-omnibus/config.rb
79
77
  - lib/vagrant-omnibus/plugin.rb
80
78
  - lib/vagrant-omnibus/version.rb
79
+ - locales/en.yml
81
80
  - test/acceptance/aws/Vagrantfile
81
+ - test/acceptance/digital_ocean/Vagrantfile
82
82
  - test/acceptance/rackspace/Vagrantfile
83
83
  - test/acceptance/virtualbox/Vagrantfile
84
84
  - test/support/cookbooks/chef-inator/README.md
@@ -114,6 +114,7 @@ summary: A Vagrant plugin that ensures the desired version of Chef is installed
114
114
  the platform-specific Omnibus packages.
115
115
  test_files:
116
116
  - test/acceptance/aws/Vagrantfile
117
+ - test/acceptance/digital_ocean/Vagrantfile
117
118
  - test/acceptance/rackspace/Vagrantfile
118
119
  - test/acceptance/virtualbox/Vagrantfile
119
120
  - test/support/cookbooks/chef-inator/README.md
@@ -1,47 +0,0 @@
1
- #
2
- # Copyright (c) 2013, Seth Chisamore
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- module VagrantPlugins
18
- module Omnibus
19
- module Action
20
- # @author Seth Chisamore <schisamo@opscode.com>
21
- #
22
- # This action checks if the machine is running (virtualbox) or active
23
- # (aws, rackspace).
24
- #
25
- class IsRunningOrActive
26
- def initialize(app, env)
27
- @app = app
28
- end
29
-
30
- def call(env)
31
- # Set the result to be true if the machine is :running or :active.
32
- if (env[:machine].state.id == :running) ||
33
- (env[:machine].state.id == :active)
34
-
35
- env[:result] = true
36
- else
37
- env[:result] = false
38
- end
39
-
40
- # Call the next if we have one (but we shouldn't, since this
41
- # middleware is built to run with the Call-type middlewares)
42
- @app.call(env)
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,53 +0,0 @@
1
- #
2
- # Copyright (c) 2013, Seth Chisamore
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
-
17
- module VagrantPlugins
18
- module Omnibus
19
- module Action
20
- # @author Seth Chisamore <schisamo@opscode.com>
21
- #
22
- # This action will extract the installed version of Chef installed on the
23
- # guest. The resulting version will exist in the `:installed_chef_version`
24
- # key in the environment.
25
- class ReadChefVersion
26
- def initialize(app, env)
27
- @app = app
28
- end
29
-
30
- def call(env)
31
- env[:installed_chef_version] = nil
32
- env[:machine].communicate.tap do |comm|
33
- # Execute it with sudo
34
- comm.sudo(chef_version_command) do |type, data|
35
- if [:stderr, :stdout].include?(type)
36
- env[:installed_chef_version] = data.chomp
37
- end
38
- end
39
- end
40
- @app.call(env)
41
- end
42
-
43
- private
44
-
45
- def chef_version_command
46
- <<-CHEF_VERSION
47
- echo $(chef-solo --v | awk "{print \\$2}" || "")
48
- CHEF_VERSION
49
- end
50
- end
51
- end
52
- end
53
- end