vagrant-config_builder 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +2 -0
- data/.rspec +2 -0
- data/.travis.yml +12 -0
- data/CHANGELOG +19 -0
- data/Gemfile +21 -9
- data/README.markdown +3 -0
- data/Rakefile +5 -0
- data/lib/config_builder.rb +13 -0
- data/lib/config_builder/filter/roles.rb +20 -22
- data/lib/config_builder/model.rb +1 -0
- data/lib/config_builder/model/provider/aws.rb +70 -0
- data/lib/config_builder/model/provisioner/puppet.rb +17 -5
- data/lib/config_builder/model/vm.rb +6 -0
- data/lib/config_builder/version.rb +1 -1
- data/spec/config_builder/filter/roles_spec.rb +69 -50
- data/tasks/spec.rake +3 -0
- data/templates/locales/en.yml +4 -0
- data/vagrant-config_builder.gemspec +2 -0
- metadata +24 -5
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NWNiOTliNWQ5OGY0MTVlNjgxMDhhNDA5ZTg4OWU3NzlkZjE3YmNmYg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d53eab1334c50f0eccc2a30de20a9d785d46ef74
|
4
|
+
data.tar.gz: 82124ae8e8c9a5e74d57f037893b6bdf51bfb9a3
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
OWEwNjRkYTkyMDA3ZGVkZDJiODUxNjJmNGIzYTk2YWRhZDA2NjZhNTFkNTVh
|
11
|
-
ZWM1YmYzYjc3YzQ1N2Q1ZmM2YzQ4MjdiYjFiZjA4ZGZjYTgzM2I=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZTdhNmNlNjAzOTY3ZTc4NDg5ZTMwYjhmNGFmYzkwNDA5ZDYwMjI0MDdiZmY3
|
14
|
-
NWU3MWFlNDJkMmE3ZTk2OWQ3NDU0N2QyODI4N2FiOTQ3NmZhYjE5YWM4ODI1
|
15
|
-
NzYxMTEwMzJjZmUyMmQxOWFhOTMyOWIzZTNjZmJhYTNiYzMyOGM=
|
6
|
+
metadata.gz: 91415ac8554fd80f0535eaab83c3fa34da9fecd3481f585fc8a4ffdb8e8c255d0887ab0bce537b8137d1319e1c40c7161cafd73e2411c377b89836fc3d285ccf
|
7
|
+
data.tar.gz: 13ade488a6f40f246339cb4246fc9a909997006b2e9068bc1b197af45e3b8812893143c5fc81465adf81ffdb611b46156aeaae2087ddd167fbb2edfdbab6ee8d
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG
CHANGED
@@ -1,6 +1,25 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
=========
|
3
3
|
|
4
|
+
0.15.0
|
5
|
+
------
|
6
|
+
|
7
|
+
2015-09-28
|
8
|
+
|
9
|
+
This is a feature release with an incompatible bugfix.
|
10
|
+
|
11
|
+
* (GH-44) Roles no longer preempt specific VM configuration. This means that
|
12
|
+
roles no longer override values explicitly set on VMs and provisioners set
|
13
|
+
by VMs run after those set by roles. This change is considered to be a bug
|
14
|
+
fix, but will break any configuration that relies on existing behavior.
|
15
|
+
|
16
|
+
* (GH-43) Add basic support for the vagrant-aws provider.
|
17
|
+
|
18
|
+
* (GH-42) The Puppet provisioner now supports Hiera configuration options.
|
19
|
+
|
20
|
+
* (GH-47) The single `provisioner` setting for VMs is now deprecated and will
|
21
|
+
be removed in version 1.0.0. Use the `provisioners` setting instead.
|
22
|
+
|
4
23
|
0.14.0
|
5
24
|
------
|
6
25
|
|
data/Gemfile
CHANGED
@@ -1,16 +1,28 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
+
ruby '2.0.0' # Required by Vagrant 1.4 and newer.
|
2
3
|
|
3
|
-
|
4
|
+
ENV['TEST_VAGRANT_VERSION'] ||= 'v1.7.4'
|
5
|
+
|
6
|
+
# Wrapping gemspec in the :plugins group causes Vagrant 1.5 and newer to
|
7
|
+
# automagically load this plugin during acceptance tests.
|
8
|
+
group :plugins do
|
9
|
+
gemspec
|
10
|
+
end
|
4
11
|
|
5
12
|
group :development do
|
6
|
-
|
7
|
-
|
8
|
-
# Vagrant environment itself using `vagrant plugin`.
|
9
|
-
gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
|
10
|
-
gem "yard"
|
11
|
-
gem "redcarpet"
|
13
|
+
gem 'yard', '~> 0.8.7'
|
14
|
+
gem 'redcarpet'
|
12
15
|
end
|
13
16
|
|
14
|
-
|
15
|
-
|
17
|
+
group :test do
|
18
|
+
if ENV['TEST_VAGRANT_VERSION'] == 'HEAD'
|
19
|
+
gem 'vagrant', :github => 'mitchellh/vagrant', :branch => 'master'
|
20
|
+
else
|
21
|
+
gem 'vagrant', :github => 'mitchellh/vagrant', :tag => ENV['TEST_VAGRANT_VERSION']
|
22
|
+
end
|
23
|
+
|
24
|
+
# Pinned on 12/10/2014. Compatible with Vagrant 1.5.x, 1.6.x and 1.7.x.
|
25
|
+
gem 'vagrant-spec', :github => 'mitchellh/vagrant-spec', :ref => '1df5a3a'
|
16
26
|
end
|
27
|
+
|
28
|
+
eval_gemfile "#{__FILE__}.local" if File.exists? "#{__FILE__}.local"
|
data/README.markdown
CHANGED
@@ -3,6 +3,8 @@ Vagrant Config Builder
|
|
3
3
|
|
4
4
|
Configure and manage your Vagrant environments with data.
|
5
5
|
|
6
|
+
[![Build Status](https://travis-ci.org/oscar-stack/vagrant-config_builder.svg?branch=master)](https://travis-ci.org/oscar-stack/vagrant-config_builder)
|
7
|
+
|
6
8
|
Synopsis
|
7
9
|
--------
|
8
10
|
|
@@ -59,6 +61,7 @@ roles:
|
|
59
61
|
manifests_path: 'tests'
|
60
62
|
module_path: 'spec/fixtures/modules'
|
61
63
|
manifest_file: <%= ENV['VAGRANT_MANIFEST'] || 'init.pp' %>
|
64
|
+
hiera_config_path: "hiera.yaml"
|
62
65
|
```
|
63
66
|
|
64
67
|
#### config/roles.yaml
|
data/Rakefile
ADDED
data/lib/config_builder.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'vagrant'
|
2
|
+
require 'log4r'
|
2
3
|
|
3
4
|
module ConfigBuilder
|
4
5
|
require 'config_builder/loader'
|
@@ -12,6 +13,10 @@ module ConfigBuilder
|
|
12
13
|
runner.run(identifier, method, value)
|
13
14
|
end
|
14
15
|
|
16
|
+
def self.logger
|
17
|
+
@logger ||= setup_logger
|
18
|
+
end
|
19
|
+
|
15
20
|
def self.source_root
|
16
21
|
@source_root ||= File.expand_path('..', __FILE__)
|
17
22
|
end
|
@@ -19,6 +24,14 @@ module ConfigBuilder
|
|
19
24
|
def self.template_root
|
20
25
|
@template_root ||= File.expand_path('../templates', source_root)
|
21
26
|
end
|
27
|
+
|
28
|
+
def self.setup_logger
|
29
|
+
logger = Log4r::Logger.new('config_builder')
|
30
|
+
logger.outputters = Log4r::Outputter.stderr
|
31
|
+
|
32
|
+
logger
|
33
|
+
end
|
34
|
+
private_class_method :setup_logger
|
22
35
|
end
|
23
36
|
|
24
37
|
I18n.load_path << File.join(ConfigBuilder.template_root, 'locales/en.yml')
|
@@ -57,17 +57,12 @@ class ConfigBuilder::Filter::Roles
|
|
57
57
|
# @param old_vm [Hash]
|
58
58
|
#
|
59
59
|
# @return [Hash] The filtered VM
|
60
|
-
def filter_vm(
|
61
|
-
|
62
|
-
node_stack = roles_by_name(role_list)
|
60
|
+
def filter_vm(vm)
|
61
|
+
node_stack = roles_by_name(vm.delete('roles'))
|
63
62
|
|
64
|
-
node_stack
|
65
|
-
|
66
|
-
new_vm = node_stack.inject({}) do |accumulator, role|
|
67
|
-
merge_nodes(accumulator, role)
|
63
|
+
node_stack.inject(vm) do |accumulator, role|
|
64
|
+
merge_nodes!(accumulator, role)
|
68
65
|
end
|
69
|
-
|
70
|
-
new_vm
|
71
66
|
end
|
72
67
|
|
73
68
|
# Fetch the role associated with the given name
|
@@ -110,16 +105,18 @@ class ConfigBuilder::Filter::Roles
|
|
110
105
|
|
111
106
|
private
|
112
107
|
|
113
|
-
# Merge two
|
114
|
-
#
|
108
|
+
# Merge two hashes of VM settings
|
109
|
+
#
|
110
|
+
# This function merges all settings from `right` into `left` and returns
|
111
|
+
# `left` as a mutated value. Any scalar settings, such as `box`, present in
|
112
|
+
# `left` will be preserved. Array settings, such as `provisioners` present in
|
113
|
+
# `right` will be prepended to `left` such that they are run earlier.
|
115
114
|
#
|
116
115
|
# @param left [Hash]
|
117
116
|
# @param right [Hash]
|
118
117
|
#
|
119
|
-
# @return [Hash]
|
120
|
-
def merge_nodes(left, right)
|
121
|
-
retval = right.clone
|
122
|
-
|
118
|
+
# @return [Hash] The left hash, mutated.
|
119
|
+
def merge_nodes!(left, right)
|
123
120
|
array_keys = %w[
|
124
121
|
providers
|
125
122
|
provisioners
|
@@ -131,19 +128,20 @@ class ConfigBuilder::Filter::Roles
|
|
131
128
|
]
|
132
129
|
|
133
130
|
array_keys.each do |key|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
end
|
131
|
+
next unless right.has_key?(key)
|
132
|
+
|
133
|
+
left[key] ||= []
|
134
|
+
left[key].unshift(*right[key])
|
139
135
|
end
|
140
136
|
|
141
137
|
single_keys = %w[provider box name communicator]
|
142
138
|
|
143
139
|
single_keys.each do |key|
|
144
|
-
|
140
|
+
next unless right.has_key?(key)
|
141
|
+
|
142
|
+
left[key] ||= right[key]
|
145
143
|
end
|
146
144
|
|
147
|
-
|
145
|
+
left
|
148
146
|
end
|
149
147
|
end
|
data/lib/config_builder/model.rb
CHANGED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Provider support for Vagrant-AWS
|
2
|
+
#
|
3
|
+
# @see https://github.com/mitchellh/vagrant-aws/blob/master/README.md#configuration
|
4
|
+
# @since 0.15.0
|
5
|
+
class ConfigBuilder::Model::Provider::Aws < ConfigBuilder::Model::Base
|
6
|
+
|
7
|
+
def_model_attribute :access_key_id
|
8
|
+
def_model_attribute :ami
|
9
|
+
def_model_attribute :availability_zone
|
10
|
+
def_model_attribute :instance_ready_timeout
|
11
|
+
def_model_attribute :instance_check_interval
|
12
|
+
def_model_attribute :instance_package_timeout
|
13
|
+
def_model_attribute :instance_type
|
14
|
+
def_model_attribute :keypair_name
|
15
|
+
def_model_attribute :session_token
|
16
|
+
def_model_attribute :private_ip_address
|
17
|
+
def_model_attribute :elastic_ip
|
18
|
+
def_model_attribute :region
|
19
|
+
def_model_attribute :secret_access_key
|
20
|
+
def_model_attribute :security_groups
|
21
|
+
def_model_attribute :iam_instance_profile_arn
|
22
|
+
def_model_attribute :subnet_id
|
23
|
+
def_model_attribute :associate_public_ip
|
24
|
+
def_model_attribute :ssh_host_attribute
|
25
|
+
def_model_attribute :tags
|
26
|
+
def_model_attribute :package_tags
|
27
|
+
def_model_attribute :use_iam_profile
|
28
|
+
def_model_attribute :block_device_mapping
|
29
|
+
def_model_attribute :elb
|
30
|
+
def_model_attribute :unregister_elb_from_az
|
31
|
+
def_model_attribute :terminate_on_shutdown
|
32
|
+
|
33
|
+
def initialize
|
34
|
+
@defaults = {}
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_proc
|
38
|
+
Proc.new do |vm_config|
|
39
|
+
vm_config.provider 'aws' do |config|
|
40
|
+
with_attr(:access_key_id) { |val| config.access_key_id = val }
|
41
|
+
with_attr(:ami) { |val| config.ami = val }
|
42
|
+
with_attr(:availability_zone) { |val| config.availability_zone = val }
|
43
|
+
with_attr(:instance_ready_timeout) { |val| config.instance_ready_timeout = val }
|
44
|
+
with_attr(:instance_check_interval) { |val| config.instance_check_interval = val }
|
45
|
+
with_attr(:instance_package_timeout) { |val| config.instance_package_timeout = val }
|
46
|
+
with_attr(:instance_type) { |val| config.instance_type = val }
|
47
|
+
with_attr(:keypair_name) { |val| config.keypair_name = val }
|
48
|
+
with_attr(:session_token) { |val| config.session_token = val }
|
49
|
+
with_attr(:private_ip_address) { |val| config.private_ip_address = val }
|
50
|
+
with_attr(:elastic_ip) { |val| config.elastic_ip = val }
|
51
|
+
with_attr(:region) { |val| config.region = val }
|
52
|
+
with_attr(:secret_access_key) { |val| config.secret_access_key = val }
|
53
|
+
with_attr(:security_groups) { |val| config.security_groups = val }
|
54
|
+
with_attr(:iam_instance_profile_arn) { |val| config.iam_instance_profile_arn = val }
|
55
|
+
with_attr(:subnet_id) { |val| config.subnet_id = val }
|
56
|
+
with_attr(:associate_public_ip) { |val| config.associate_public_ip = val }
|
57
|
+
with_attr(:ssh_host_attribute) { |val| config.ssh_host_attribute = val }
|
58
|
+
with_attr(:tags) { |val| config.tags = val }
|
59
|
+
with_attr(:package_tags) { |val| config.package_tags = val }
|
60
|
+
with_attr(:use_iam_profile) { |val| config.use_iam_profile = val }
|
61
|
+
with_attr(:block_device_mapping) { |val| config.block_device_mapping = val }
|
62
|
+
with_attr(:elb) { |val| config.elb = val }
|
63
|
+
with_attr(:unregister_elb_from_az) { |val| config.unregister_elb_from_az = val }
|
64
|
+
with_attr(:terminate_on_shutdown) { |val| config.terminate_on_shutdown = val }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
ConfigBuilder::Model::Provider.register('aws', self)
|
70
|
+
end
|
@@ -21,14 +21,26 @@ class ConfigBuilder::Model::Provisioner::Puppet < ConfigBuilder::Model::Base
|
|
21
21
|
# @return [String] An arbitrary set of arguments for the `puppet` command
|
22
22
|
attr_accessor :options
|
23
23
|
|
24
|
+
# @!attribute [rw] hiera_config_path
|
25
|
+
# @return [String] Path to the Hiera configuration file stored on the host
|
26
|
+
# @since 0.15.0
|
27
|
+
attr_accessor :hiera_config_path
|
28
|
+
|
29
|
+
# @!attribute [rw] working_directory
|
30
|
+
# @return [String] Path in the guest that will be the working directory when Puppet is executed
|
31
|
+
# @since 0.15.0
|
32
|
+
attr_accessor :working_directory
|
33
|
+
|
24
34
|
def to_proc
|
25
35
|
Proc.new do |vm_config|
|
26
36
|
vm_config.provision :puppet do |puppet_config|
|
27
|
-
with_attr(:manifests_path)
|
28
|
-
with_attr(:manifest_file)
|
29
|
-
with_attr(:module_path)
|
30
|
-
with_attr(:facter)
|
31
|
-
with_attr(:options)
|
37
|
+
with_attr(:manifests_path) { |val| puppet_config.manifests_path = val }
|
38
|
+
with_attr(:manifest_file) { |val| puppet_config.manifest_file = val }
|
39
|
+
with_attr(:module_path) { |val| puppet_config.module_path = val }
|
40
|
+
with_attr(:facter) { |val| puppet_config.facter = val }
|
41
|
+
with_attr(:options) { |val| puppet_config.options = val }
|
42
|
+
with_attr(:hiera_config_path) { |val| puppet_config.hiera_config_path = val }
|
43
|
+
with_attr(:working_directory) { |val| puppet_config.working_directory = val }
|
32
44
|
end
|
33
45
|
end
|
34
46
|
end
|
@@ -13,6 +13,8 @@ class ConfigBuilder::Model::VM < ConfigBuilder::Model::Base
|
|
13
13
|
# :name => 'tiny-tina',
|
14
14
|
# :gui => false,
|
15
15
|
# }
|
16
|
+
#
|
17
|
+
# @deprecated Use {#providers} instead.
|
16
18
|
def_model_delegator :provider
|
17
19
|
|
18
20
|
# @!attribute [rw] providers
|
@@ -214,6 +216,10 @@ class ConfigBuilder::Model::VM < ConfigBuilder::Model::Base
|
|
214
216
|
|
215
217
|
def eval_provider(vm_config)
|
216
218
|
if attr(:provider)
|
219
|
+
ConfigBuilder.logger.warn {
|
220
|
+
I18n.t('config_builder.model.vm.provider_is_deprecated', :name => attr(:name))
|
221
|
+
}
|
222
|
+
|
217
223
|
p = ConfigBuilder::Model::Provider.new_from_hash(attr(:provider))
|
218
224
|
p.call(vm_config)
|
219
225
|
end
|
@@ -40,7 +40,10 @@ describe ConfigBuilder::Filter::Roles do
|
|
40
40
|
'private_networks' => [
|
41
41
|
{'ip' => '1.2.3.4'}
|
42
42
|
]
|
43
|
-
}
|
43
|
+
},
|
44
|
+
'windows' => {
|
45
|
+
'communicator' => 'winrm',
|
46
|
+
},
|
44
47
|
}
|
45
48
|
end
|
46
49
|
|
@@ -70,7 +73,7 @@ describe ConfigBuilder::Filter::Roles do
|
|
70
73
|
end
|
71
74
|
end
|
72
75
|
|
73
|
-
describe '
|
76
|
+
describe 'loading configured roles' do
|
74
77
|
let(:config) do
|
75
78
|
{
|
76
79
|
'vms' => [{'name' => 'master'}],
|
@@ -82,14 +85,20 @@ describe ConfigBuilder::Filter::Roles do
|
|
82
85
|
subject.set_config(dup(config))
|
83
86
|
end
|
84
87
|
|
85
|
-
it 'strips out the roles
|
88
|
+
it 'strips out the roles from top-level configuration' do
|
86
89
|
output = subject.run
|
87
90
|
expect(output).to_not have_key 'roles'
|
88
91
|
end
|
89
92
|
end
|
90
93
|
|
91
|
-
describe '
|
92
|
-
let(:vms)
|
94
|
+
describe 'operating on a single vm' do
|
95
|
+
let(:vms) do
|
96
|
+
[{
|
97
|
+
'name' => 'master',
|
98
|
+
'foo' => 'bar',
|
99
|
+
'roles' => [ 'shell-provisioner', 'folders-12' ],
|
100
|
+
}]
|
101
|
+
end
|
93
102
|
|
94
103
|
let(:config) do
|
95
104
|
{
|
@@ -98,39 +107,34 @@ describe ConfigBuilder::Filter::Roles do
|
|
98
107
|
}
|
99
108
|
end
|
100
109
|
|
110
|
+
let(:filtered_vm) do
|
111
|
+
output = subject.run
|
112
|
+
output['vms'][0]
|
113
|
+
end
|
114
|
+
|
101
115
|
before do
|
102
116
|
subject.set_config(dup(config))
|
103
117
|
end
|
104
118
|
|
105
|
-
it "
|
106
|
-
|
107
|
-
expect(output['vms']).to eq vms
|
119
|
+
it "removes the 'roles' key if present" do
|
120
|
+
expect(filtered_vm).to_not have_key 'roles'
|
108
121
|
end
|
109
|
-
end
|
110
|
-
|
111
|
-
describe 'and one vm' do
|
112
|
-
describe 'with one role' do
|
113
|
-
let(:vms) { [{'name' => 'master', 'roles' => 'shell-provisioner'}] }
|
114
122
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
'roles' => roles,
|
119
|
-
}
|
120
|
-
end
|
123
|
+
it 'preserves top-level configuration' do
|
124
|
+
expect(filtered_vm).to have_key 'foo'
|
125
|
+
end
|
121
126
|
|
122
|
-
|
123
|
-
|
124
|
-
end
|
127
|
+
context 'with no roles' do
|
128
|
+
let(:vms) { [{'name' => 'master'}] }
|
125
129
|
|
126
|
-
|
130
|
+
it "doesn't alter the vm" do
|
127
131
|
output = subject.run
|
128
|
-
output['vms']
|
132
|
+
expect(output['vms']).to eq vms
|
129
133
|
end
|
134
|
+
end
|
130
135
|
|
131
|
-
|
132
|
-
|
133
|
-
end
|
136
|
+
context 'with roles set to a single string' do
|
137
|
+
let(:vms) { [{'name' => 'master', 'roles' => 'shell-provisioner'}] }
|
134
138
|
|
135
139
|
it 'applies the role' do
|
136
140
|
expected = [{
|
@@ -142,45 +146,60 @@ describe ConfigBuilder::Filter::Roles do
|
|
142
146
|
end
|
143
147
|
end
|
144
148
|
|
145
|
-
|
149
|
+
context 'with roles set to an array' do
|
146
150
|
let(:vms) do
|
147
151
|
[{
|
148
152
|
'name' => 'master',
|
149
|
-
'roles' => [
|
153
|
+
'roles' => [
|
154
|
+
'folders-12',
|
155
|
+
'puppet-provisioner',
|
156
|
+
'shell-provisioner',
|
157
|
+
]
|
150
158
|
}]
|
151
159
|
end
|
152
160
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
'roles' => roles,
|
157
|
-
}
|
161
|
+
it 'applies all of the roles' do
|
162
|
+
expect(filtered_vm).to have_key 'provisioners'
|
163
|
+
expect(filtered_vm).to have_key 'synced_folders'
|
158
164
|
end
|
159
165
|
|
160
|
-
|
161
|
-
|
162
|
-
|
166
|
+
it 'merges attribute arrays in reverse order' do
|
167
|
+
expected_prov = [
|
168
|
+
{'type' => 'shell', 'inline' => '/usr/bin/sl'},
|
169
|
+
{'type' => 'puppet', 'manifest' => 'sl.pp'},
|
170
|
+
{'type' => 'puppet', 'manifest' => 'starwars.pp'},
|
171
|
+
]
|
163
172
|
|
164
|
-
|
165
|
-
output = subject.run
|
166
|
-
output['vms'][0]
|
173
|
+
expect(filtered_vm['provisioners']).to eq expected_prov
|
167
174
|
end
|
175
|
+
end
|
168
176
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
'
|
177
|
+
context 'when vm configuration overlaps with roles' do
|
178
|
+
let(:vms) do
|
179
|
+
[{
|
180
|
+
'name' => 'master',
|
181
|
+
'roles' => [ 'shell-provisioner', 'windows' ],
|
182
|
+
'communicator' => 'ssh',
|
183
|
+
'provisioners' => [
|
184
|
+
{'type' => 'foo', 'parameter' => 'bar', }
|
185
|
+
],
|
173
186
|
}]
|
187
|
+
end
|
174
188
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
]
|
189
|
+
it 'preserves single_keys set on the vm' do
|
190
|
+
expect(filtered_vm['communicator']).to eq 'ssh'
|
191
|
+
end
|
179
192
|
|
180
|
-
|
181
|
-
|
193
|
+
it 'merges array_keys set on the vm last' do
|
194
|
+
expected_prov = {
|
195
|
+
'type' => 'foo',
|
196
|
+
'parameter' => 'bar',
|
197
|
+
}
|
198
|
+
|
199
|
+
expect(filtered_vm['provisioners'].last).to eq expected_prov
|
182
200
|
end
|
183
201
|
end
|
202
|
+
|
184
203
|
end
|
185
204
|
|
186
205
|
describe "with multiple VMs and shared roles" do
|
data/tasks/spec.rake
ADDED
data/templates/locales/en.yml
CHANGED
@@ -9,3 +9,7 @@ en:
|
|
9
9
|
duplicate_entry: |-
|
10
10
|
The class registry %{registry} already has a class registered with identifier %{identifier}
|
11
11
|
and cannot replace the existing entry.
|
12
|
+
model:
|
13
|
+
vm:
|
14
|
+
provider_is_deprecated: |-
|
15
|
+
The provider attribute, set on vm %{name}, is deprecated and will be removed in an upcoming release. Use the providers attribute instead.
|
@@ -17,7 +17,9 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.files = %x{git ls-files -z}.split("\0")
|
18
18
|
gem.require_path = 'lib'
|
19
19
|
|
20
|
+
gem.add_runtime_dependency 'rake', '>= 0'
|
20
21
|
gem.add_runtime_dependency 'deep_merge', '~> 1.0.0'
|
21
22
|
|
23
|
+
# Pin to 2.14.x for compatibility with vagrant-spec.
|
22
24
|
gem.add_development_dependency 'rspec', '~> 2.14.0'
|
23
25
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-config_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrien Thebo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: deep_merge
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,11 +59,14 @@ extensions: []
|
|
45
59
|
extra_rdoc_files: []
|
46
60
|
files:
|
47
61
|
- .gitignore
|
62
|
+
- .rspec
|
63
|
+
- .travis.yml
|
48
64
|
- .yardopts
|
49
65
|
- CHANGELOG
|
50
66
|
- Gemfile
|
51
67
|
- LICENSE
|
52
68
|
- README.markdown
|
69
|
+
- Rakefile
|
53
70
|
- docs/GettingStarted.markdown
|
54
71
|
- examples/Vagrantfile
|
55
72
|
- examples/roles.yaml
|
@@ -69,6 +86,7 @@ files:
|
|
69
86
|
- lib/config_builder/model/base.rb
|
70
87
|
- lib/config_builder/model/network/forwarded_port.rb
|
71
88
|
- lib/config_builder/model/network/private_network.rb
|
89
|
+
- lib/config_builder/model/provider/aws.rb
|
72
90
|
- lib/config_builder/model/provider/azure.rb
|
73
91
|
- lib/config_builder/model/provider/libvirt.rb
|
74
92
|
- lib/config_builder/model/provider/virtualbox.rb
|
@@ -95,6 +113,7 @@ files:
|
|
95
113
|
- spec/config_builder/loader/yaml_spec.rb
|
96
114
|
- spec/config_builder/model/provider/vmware_fusion_spec.rb
|
97
115
|
- spec/spec_helper.rb
|
116
|
+
- tasks/spec.rake
|
98
117
|
- templates/locales/en.yml
|
99
118
|
- vagrant-config_builder.gemspec
|
100
119
|
homepage: https://github.com/adrienthebo/vagrant-config_builder
|
@@ -107,17 +126,17 @@ require_paths:
|
|
107
126
|
- lib
|
108
127
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
128
|
requirements:
|
110
|
-
- -
|
129
|
+
- - '>='
|
111
130
|
- !ruby/object:Gem::Version
|
112
131
|
version: '0'
|
113
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
133
|
requirements:
|
115
|
-
- -
|
134
|
+
- - '>='
|
116
135
|
- !ruby/object:Gem::Version
|
117
136
|
version: '0'
|
118
137
|
requirements: []
|
119
138
|
rubyforge_project:
|
120
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.0.14
|
121
140
|
signing_key:
|
122
141
|
specification_version: 4
|
123
142
|
summary: Generate Vagrant configurations from arbitrary data
|