chef-provisioning-vagrant 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/LICENSE +201 -201
- data/README.md +63 -63
- data/Rakefile +6 -6
- data/chef-provisioning-vagrant.gemspec +27 -0
- 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 +474 -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 +5 -3
@@ -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.11.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,14 +1,14 @@
|
|
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.11.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-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-provisioning
|
@@ -74,9 +74,11 @@ extra_rdoc_files:
|
|
74
74
|
- README.md
|
75
75
|
- LICENSE
|
76
76
|
files:
|
77
|
+
- Gemfile
|
77
78
|
- LICENSE
|
78
79
|
- README.md
|
79
80
|
- Rakefile
|
81
|
+
- chef-provisioning-vagrant.gemspec
|
80
82
|
- lib/chef/provider/vagrant_box.rb
|
81
83
|
- lib/chef/provider/vagrant_cluster.rb
|
82
84
|
- lib/chef/provisioning/driver_init/vagrant.rb
|
@@ -107,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
109
|
version: '0'
|
108
110
|
requirements: []
|
109
111
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.4.
|
112
|
+
rubygems_version: 2.4.7
|
111
113
|
signing_key:
|
112
114
|
specification_version: 4
|
113
115
|
summary: Driver for creating Vagrant instances in Chef Provisioning.
|