chef-provisioning-vagrant 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +201 -201
- data/README.md +63 -60
- data/Rakefile +6 -6
- data/lib/chef/provider/vagrant_box.rb +58 -58
- data/lib/chef/provider/vagrant_cluster.rb +40 -40
- data/lib/chef/provisioning/driver_init/vagrant.rb +3 -3
- data/lib/chef/provisioning/vagrant_driver.rb +36 -36
- data/lib/chef/provisioning/vagrant_driver/driver.rb +470 -470
- data/lib/chef/provisioning/vagrant_driver/version.rb +7 -7
- data/lib/chef/resource/vagrant_box.rb +24 -24
- data/lib/chef/resource/vagrant_cluster.rb +21 -21
- data/spec/spec_helper.rb +21 -21
- data/spec/vagrant_spec.rb +13 -13
- data/spec/vagrant_support.rb +53 -53
- metadata +6 -6
@@ -1,7 +1,7 @@
|
|
1
|
-
class Chef
|
2
|
-
module Provisioning
|
3
|
-
module VagrantDriver
|
4
|
-
VERSION = '0.
|
5
|
-
end
|
6
|
-
end
|
7
|
-
end
|
1
|
+
class Chef
|
2
|
+
module Provisioning
|
3
|
+
module VagrantDriver
|
4
|
+
VERSION = '0.10.0'
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
@@ -1,24 +1,24 @@
|
|
1
|
-
require 'chef/resource/lwrp_base'
|
2
|
-
require 'chef/provisioning/vagrant_driver'
|
3
|
-
|
4
|
-
class Chef::Resource::VagrantBox < Chef::Resource::LWRPBase
|
5
|
-
self.resource_name = 'vagrant_box'
|
6
|
-
|
7
|
-
actions :create, :delete, :nothing
|
8
|
-
default_action :create
|
9
|
-
|
10
|
-
attribute :name, :kind_of => String, :name_attribute => true
|
11
|
-
attribute :url, :kind_of => String
|
12
|
-
attribute :vagrant_provider, :kind_of => String, :default => 'virtualbox'
|
13
|
-
attribute :driver_options, :kind_of => Hash
|
14
|
-
|
15
|
-
def after_created
|
16
|
-
super
|
17
|
-
Chef::Provisioning::VagrantDriver.with_vagrant_box run_context, self
|
18
|
-
end
|
19
|
-
|
20
|
-
# We are not interested in Chef's cloning behavior here.
|
21
|
-
def load_prior_resource(*args)
|
22
|
-
Chef::Log.debug("Overloading #{resource_name}.load_prior_resource with NOOP")
|
23
|
-
end
|
24
|
-
end
|
1
|
+
require 'chef/resource/lwrp_base'
|
2
|
+
require 'chef/provisioning/vagrant_driver'
|
3
|
+
|
4
|
+
class Chef::Resource::VagrantBox < Chef::Resource::LWRPBase
|
5
|
+
self.resource_name = 'vagrant_box'
|
6
|
+
|
7
|
+
actions :create, :delete, :nothing
|
8
|
+
default_action :create
|
9
|
+
|
10
|
+
attribute :name, :kind_of => String, :name_attribute => true
|
11
|
+
attribute :url, :kind_of => String
|
12
|
+
attribute :vagrant_provider, :kind_of => String, :default => 'virtualbox'
|
13
|
+
attribute :driver_options, :kind_of => Hash
|
14
|
+
|
15
|
+
def after_created
|
16
|
+
super
|
17
|
+
Chef::Provisioning::VagrantDriver.with_vagrant_box run_context, self
|
18
|
+
end
|
19
|
+
|
20
|
+
# We are not interested in Chef's cloning behavior here.
|
21
|
+
def load_prior_resource(*args)
|
22
|
+
Chef::Log.debug("Overloading #{resource_name}.load_prior_resource with NOOP")
|
23
|
+
end
|
24
|
+
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
require 'chef/resource/lwrp_base'
|
2
|
-
require 'chef/provisioning/vagrant_driver'
|
3
|
-
|
4
|
-
class Chef::Resource::VagrantCluster < Chef::Resource::LWRPBase
|
5
|
-
self.resource_name = 'vagrant_cluster'
|
6
|
-
|
7
|
-
actions :create, :delete, :nothing
|
8
|
-
default_action :create
|
9
|
-
|
10
|
-
attribute :path, :kind_of => String, :name_attribute => true
|
11
|
-
|
12
|
-
def after_created
|
13
|
-
super
|
14
|
-
run_context.chef_provisioning.with_driver "vagrant:#{path}"
|
15
|
-
end
|
16
|
-
|
17
|
-
# We are not interested in Chef's cloning behavior here.
|
18
|
-
def load_prior_resource(*args)
|
19
|
-
Chef::Log.debug("Overloading #{resource_name}.load_prior_resource with NOOP")
|
20
|
-
end
|
21
|
-
end
|
1
|
+
require 'chef/resource/lwrp_base'
|
2
|
+
require 'chef/provisioning/vagrant_driver'
|
3
|
+
|
4
|
+
class Chef::Resource::VagrantCluster < Chef::Resource::LWRPBase
|
5
|
+
self.resource_name = 'vagrant_cluster'
|
6
|
+
|
7
|
+
actions :create, :delete, :nothing
|
8
|
+
default_action :create
|
9
|
+
|
10
|
+
attribute :path, :kind_of => String, :name_attribute => true
|
11
|
+
|
12
|
+
def after_created
|
13
|
+
super
|
14
|
+
run_context.chef_provisioning.with_driver "vagrant:#{path}"
|
15
|
+
end
|
16
|
+
|
17
|
+
# We are not interested in Chef's cloning behavior here.
|
18
|
+
def load_prior_resource(*args)
|
19
|
+
Chef::Log.debug("Overloading #{resource_name}.load_prior_resource with NOOP")
|
20
|
+
end
|
21
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
require 'vagrant_support'
|
2
|
-
|
3
|
-
RSpec.configure do |config|
|
4
|
-
config.expect_with :rspec do |expectations|
|
5
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
6
|
-
# and `failure_message` of custom matchers include text for helper methods
|
7
|
-
# defined using `chain`, e.g.:
|
8
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
9
|
-
# # => "be bigger than 2 and smaller than 4"
|
10
|
-
# ...rather than:
|
11
|
-
# # => "be bigger than 2"
|
12
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
13
|
-
end
|
14
|
-
|
15
|
-
config.mock_with :rspec do |mocks|
|
16
|
-
mocks.verify_partial_doubles = true
|
17
|
-
end
|
18
|
-
|
19
|
-
config.filter_run :focus
|
20
|
-
config.run_all_when_everything_filtered = true
|
21
|
-
end
|
1
|
+
require 'vagrant_support'
|
2
|
+
|
3
|
+
RSpec.configure do |config|
|
4
|
+
config.expect_with :rspec do |expectations|
|
5
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
6
|
+
# and `failure_message` of custom matchers include text for helper methods
|
7
|
+
# defined using `chain`, e.g.:
|
8
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
9
|
+
# # => "be bigger than 2 and smaller than 4"
|
10
|
+
# ...rather than:
|
11
|
+
# # => "be bigger than 2"
|
12
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
13
|
+
end
|
14
|
+
|
15
|
+
config.mock_with :rspec do |mocks|
|
16
|
+
mocks.verify_partial_doubles = true
|
17
|
+
end
|
18
|
+
|
19
|
+
config.filter_run :focus
|
20
|
+
config.run_all_when_everything_filtered = true
|
21
|
+
end
|
data/spec/vagrant_spec.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
describe "Chef::Provisioning::Vagrant" do
|
2
|
-
extend VagrantSupport
|
3
|
-
# include VagrantConfig # uncomment to get `chef_config` or to mix in code.
|
4
|
-
|
5
|
-
when_the_chef_12_server "exists", server_scope: :context, port: 8900..9000 do
|
6
|
-
with_vagrant "integration tests" do
|
7
|
-
context "machine resource" do
|
8
|
-
it "doesn't run any tests" do
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
1
|
+
describe "Chef::Provisioning::Vagrant" do
|
2
|
+
extend VagrantSupport
|
3
|
+
# include VagrantConfig # uncomment to get `chef_config` or to mix in code.
|
4
|
+
|
5
|
+
when_the_chef_12_server "exists", server_scope: :context, port: 8900..9000 do
|
6
|
+
with_vagrant "integration tests" do
|
7
|
+
context "machine resource" do
|
8
|
+
it "doesn't run any tests" do
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/spec/vagrant_support.rb
CHANGED
@@ -1,53 +1,53 @@
|
|
1
|
-
module VagrantSupport
|
2
|
-
|
3
|
-
# your top-level context blocks will use this file like so:
|
4
|
-
# require "vagrant_support"
|
5
|
-
#
|
6
|
-
# describe "Chef::Provisioning::Vagrant" do
|
7
|
-
# extend VagrantSupport
|
8
|
-
# include VagrantConfig # optional, gives you a `chef_config` object.
|
9
|
-
|
10
|
-
require 'cheffish/rspec/chef_run_support'
|
11
|
-
|
12
|
-
# when you `extend VagrantSupport`, your RSpec-context-extending-`VagrantSupport` with then
|
13
|
-
# further `extend ChefRunSupport` to acquire all of the latter's Lucky Charms.
|
14
|
-
def self.extended(other)
|
15
|
-
other.extend Cheffish::RSpec::ChefRunSupport
|
16
|
-
end
|
17
|
-
|
18
|
-
# this creates a `with_vagrant` block method that saves you the repetition of having to load the
|
19
|
-
# driver code, and gives you a common place to put any other driver setup for your specs.
|
20
|
-
#
|
21
|
-
# subtle stuff here. it looks weird because you're taking a block and putting that inside a new block and
|
22
|
-
# then giving *that* to a Cheffish method which will run it for you in the context of a local chef-zero.
|
23
|
-
|
24
|
-
def with_vagrant(description, *tags, &block)
|
25
|
-
|
26
|
-
# take the block you just passed in, and make a new Proc that will call it after loading the driver...
|
27
|
-
context_block = proc do
|
28
|
-
vagrant_driver = Chef::Provisioning.driver_for_url("vagrant")
|
29
|
-
|
30
|
-
@@driver = vagrant_driver
|
31
|
-
def self.driver
|
32
|
-
@@driver
|
33
|
-
end
|
34
|
-
|
35
|
-
# when this Proc runs, this will run the block you just passed to `with_vagrant`...
|
36
|
-
module_eval(&block)
|
37
|
-
end
|
38
|
-
|
39
|
-
# ...now pass that Proc to `Cheffish::RSpec::ChefRunSupport#when_the_repository`, which will:
|
40
|
-
# 1. start up a chef-zero with `*tags` as the parameters, and
|
41
|
-
# 2. run your `context_block` Proc (which contains your original `&block`) using that chef-zero.
|
42
|
-
when_the_repository "exists and #{description}", *tags, &context_block
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
# optional, I'm not sure where I cargo-culted this from.
|
47
|
-
module VagrantConfig
|
48
|
-
def chef_config
|
49
|
-
@chef_config ||= {
|
50
|
-
driver: Chef::Provisioning.driver_for_url("vagrant"),
|
51
|
-
}
|
52
|
-
end
|
53
|
-
end
|
1
|
+
module VagrantSupport
|
2
|
+
|
3
|
+
# your top-level context blocks will use this file like so:
|
4
|
+
# require "vagrant_support"
|
5
|
+
#
|
6
|
+
# describe "Chef::Provisioning::Vagrant" do
|
7
|
+
# extend VagrantSupport
|
8
|
+
# include VagrantConfig # optional, gives you a `chef_config` object.
|
9
|
+
|
10
|
+
require 'cheffish/rspec/chef_run_support'
|
11
|
+
|
12
|
+
# when you `extend VagrantSupport`, your RSpec-context-extending-`VagrantSupport` with then
|
13
|
+
# further `extend ChefRunSupport` to acquire all of the latter's Lucky Charms.
|
14
|
+
def self.extended(other)
|
15
|
+
other.extend Cheffish::RSpec::ChefRunSupport
|
16
|
+
end
|
17
|
+
|
18
|
+
# this creates a `with_vagrant` block method that saves you the repetition of having to load the
|
19
|
+
# driver code, and gives you a common place to put any other driver setup for your specs.
|
20
|
+
#
|
21
|
+
# subtle stuff here. it looks weird because you're taking a block and putting that inside a new block and
|
22
|
+
# then giving *that* to a Cheffish method which will run it for you in the context of a local chef-zero.
|
23
|
+
|
24
|
+
def with_vagrant(description, *tags, &block)
|
25
|
+
|
26
|
+
# take the block you just passed in, and make a new Proc that will call it after loading the driver...
|
27
|
+
context_block = proc do
|
28
|
+
vagrant_driver = Chef::Provisioning.driver_for_url("vagrant")
|
29
|
+
|
30
|
+
@@driver = vagrant_driver
|
31
|
+
def self.driver
|
32
|
+
@@driver
|
33
|
+
end
|
34
|
+
|
35
|
+
# when this Proc runs, this will run the block you just passed to `with_vagrant`...
|
36
|
+
module_eval(&block)
|
37
|
+
end
|
38
|
+
|
39
|
+
# ...now pass that Proc to `Cheffish::RSpec::ChefRunSupport#when_the_repository`, which will:
|
40
|
+
# 1. start up a chef-zero with `*tags` as the parameters, and
|
41
|
+
# 2. run your `context_block` Proc (which contains your original `&block`) using that chef-zero.
|
42
|
+
when_the_repository "exists and #{description}", *tags, &context_block
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# optional, I'm not sure where I cargo-culted this from.
|
47
|
+
module VagrantConfig
|
48
|
+
def chef_config
|
49
|
+
@chef_config ||= {
|
50
|
+
driver: Chef::Provisioning.driver_for_url("vagrant"),
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-provisioning-vagrant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Keiser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: chef
|
14
|
+
name: chef-provisioning
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -25,13 +25,13 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: chef
|
28
|
+
name: chef
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
|
-
type: :
|
34
|
+
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.4.
|
110
|
+
rubygems_version: 2.4.8
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: Driver for creating Vagrant instances in Chef Provisioning.
|