vagrant-hitch 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vagrant-hitch.rb +25 -0
- data/spec/hitch_spec.rb +26 -2
- data/vagrant-hitch.gemspec +1 -1
- metadata +3 -3
data/lib/vagrant-hitch.rb
CHANGED
@@ -107,6 +107,31 @@ module VagrantHitch
|
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
+
# Setup Puppet Server Provisioner
|
111
|
+
if node_config.has_key?('puppet_server')
|
112
|
+
# Import any defaults set by the Puppet Server Provisioner
|
113
|
+
node_config.deep_merge!(@puppet_server_provisioner_defaults) if !@puppet_server_provisioner_defaults.nil?
|
114
|
+
|
115
|
+
config.vm.provision :puppet_server do |puppet|
|
116
|
+
puppet.puppet_server = node_config['puppet_server']['server']
|
117
|
+
puppet.puppet_node = node_config['hostname']
|
118
|
+
|
119
|
+
# Setup Puppet Graphing
|
120
|
+
if node_config['puppet_server']['options'].include?('--graph')
|
121
|
+
begin
|
122
|
+
graph_dir = File.join(config_dir,'..','graph')
|
123
|
+
[graph_dir, "#{graph_dir}/#{node_config['hostname']}"].each { |d| Dir.mkdir(d) if !File.directory?(d) }
|
124
|
+
node_config['puppet_server']['options'] << "--graphdir=/vagrant/graph/#{node_config['hostname']}"
|
125
|
+
rescue => e
|
126
|
+
puts "Unable to create Puppet Graph Directory: #{e}"
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# Puppet Options must be the last option to ensure any additions are included
|
131
|
+
puppet.options = node_config['puppet_server']['options'].join(' ')
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
110
135
|
# Setup Chef Provisioner
|
111
136
|
if node_config.has_key?('chef')
|
112
137
|
# Import any defaults set by the Chef Provisioner
|
data/spec/hitch_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'tmpdir'
|
2
|
+
|
1
3
|
require File.join(File.dirname(__FILE__),'..','/lib/vagrant-hitch')
|
2
4
|
describe VagrantHitch do
|
3
5
|
it 'should return a proc' do
|
@@ -12,7 +14,29 @@ describe VagrantHitch do
|
|
12
14
|
expect { VagrantHitch.up!('somepath') }.to raise_error
|
13
15
|
end
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
context "with a valid Vagrantfile" do
|
18
|
+
# set up Vagrantfile
|
19
|
+
before(:all) do
|
20
|
+
rootdir = File.join(File.dirname(__FILE__),'..')
|
21
|
+
tempdir = Dir.tmpdir
|
22
|
+
vagrantfile = <<-HERE.gsub(/^ {6}/, '')
|
23
|
+
require '#{rootdir}/lib/vagrant_init.rb'
|
24
|
+
Vagrant::Config.run &VagrantHitch.up!(File.join('#{rootdir}','example','config'))
|
25
|
+
HERE
|
26
|
+
# create new Vagrantfile in ../tmp
|
27
|
+
File.open(File.join(tempdir,"Vagrantfile"), "w") {|f| f.write(vagrantfile) }
|
28
|
+
Dir.chdir(tempdir)
|
29
|
+
end
|
30
|
+
|
31
|
+
# clean up the temporary directory
|
32
|
+
after(:all) do
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should not include the default node information' do
|
36
|
+
output = Array.new
|
37
|
+
IO.popen("vagrant status") { |io| output = io.readlines.collect { |l| l.chomp } }
|
38
|
+
output.should include("test1 not created","test2 not created")
|
39
|
+
output.should_not include("default not created")
|
40
|
+
end
|
17
41
|
end
|
18
42
|
end
|
data/vagrant-hitch.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-hitch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-11-
|
13
|
+
date: 2012-11-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: vagrant
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
|
-
rubygems_version: 1.8.
|
92
|
+
rubygems_version: 1.8.23
|
93
93
|
signing_key:
|
94
94
|
specification_version: 3
|
95
95
|
summary: Creates and use a data driven vagrant environment
|