vagrant-librarian-puppet 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/Vagrantfile +20 -6
- data/lib/vagrant-librarian-puppet/action/librarian_puppet.rb +20 -13
- data/lib/vagrant-librarian-puppet/config.rb +2 -2
- data/lib/vagrant-librarian-puppet/version.rb +1 -1
- data/manifests/multidir.pp +9 -0
- data/puppet_custom/Puppetfile +5 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06853b9fc2b9d7ab1f735f5c17904fd521398dce
|
4
|
+
data.tar.gz: ad66f090afa226825661c0d86233c7057f771bb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8833e4e3a209fc9b0508b2456fa676dd58a46793649b7270cb9031bc6499d5d8095f4264d6ea037ca179dd82b46888037a5beae97dc677f5b3022c44ac047e1d
|
7
|
+
data.tar.gz: 7aec620720511a6dc17522be4c6a351d3fad1bc834935dd380e49fd70fd59a83917e08942d5a0d0ba9bbe3bf44a5cc9580785aa91aedee0adeb97e43145996ca
|
data/README.md
CHANGED
@@ -24,6 +24,11 @@ using the `librarian_puppet.puppetfile_dir` config key. Please keep in mind
|
|
24
24
|
that you will need to explicitly set the `modules` path in the
|
25
25
|
`:puppet` provisioner and this path must exist before running vagrant commands.
|
26
26
|
|
27
|
+
Like the `puppet.module_path`, `librarian_puppet.puppetfile_dir` supports both,
|
28
|
+
a simple String or an Array of Strings. Librarian Puppet will look for Puppetfiles
|
29
|
+
in each Directory and manage each modules directory.
|
30
|
+
|
31
|
+
|
27
32
|
**NOTE:** Since the puppet provisioner will fail if the path provided to
|
28
33
|
"puppet.modules" doesn't exist and librarian-puppet will destroy and recreate
|
29
34
|
the modules directory on each run, this plugin supports a placeholder file
|
data/Vagrantfile
CHANGED
@@ -6,13 +6,27 @@ Vagrant.configure('2') do |config|
|
|
6
6
|
config.vm.box = 'precise64'
|
7
7
|
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
|
8
8
|
|
9
|
-
config.
|
10
|
-
|
9
|
+
config.vm.define "default" do |default|
|
10
|
+
default.librarian_puppet.puppetfile_dir = 'puppet'
|
11
|
+
default.librarian_puppet.placeholder_filename = ".gitkeep"
|
12
|
+
default.librarian_puppet.resolve_options = { :force => true }
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
default.vm.provision :puppet do |puppet|
|
15
|
+
puppet.manifests_path = 'manifests'
|
16
|
+
puppet.manifest_file = 'init.pp'
|
17
|
+
puppet.module_path = 'puppet/modules'
|
18
|
+
end
|
16
19
|
end
|
17
20
|
|
21
|
+
config.vm.define "multidir" do |multidir|
|
22
|
+
multidir.librarian_puppet.puppetfile_dir = ['puppet', 'puppet_custom']
|
23
|
+
multidir.librarian_puppet.placeholder_filename = ".gitkeep"
|
24
|
+
multidir.librarian_puppet.resolve_options = { :force => true }
|
25
|
+
|
26
|
+
multidir.vm.provision :puppet do |puppet|
|
27
|
+
puppet.manifests_path = 'manifests'
|
28
|
+
puppet.manifest_file = 'multidir.pp'
|
29
|
+
puppet.module_path = ['puppet_custom/modules', 'puppet/modules']
|
30
|
+
end
|
31
|
+
end
|
18
32
|
end
|
@@ -15,12 +15,7 @@ module VagrantPlugins
|
|
15
15
|
|
16
16
|
def call(env)
|
17
17
|
config = env[:machine].config.librarian_puppet
|
18
|
-
if
|
19
|
-
provisioned? and
|
20
|
-
File.exist? File.join(env[:root_path], config.puppetfile_path)
|
21
|
-
|
22
|
-
env[:ui].info "Installing Puppet modules with Librarian-Puppet..."
|
23
|
-
|
18
|
+
if provisioned?
|
24
19
|
# NB: Librarian::Puppet::Environment calls `which puppet` so we
|
25
20
|
# need to make sure VAGRANT_HOME/gems/bin has been added to the
|
26
21
|
# path.
|
@@ -28,10 +23,27 @@ module VagrantPlugins
|
|
28
23
|
bin_path = env[:gems_path].join('bin')
|
29
24
|
ENV['PATH'] = "#{bin_path}#{::File::PATH_SEPARATOR}#{ENV['PATH']}"
|
30
25
|
|
26
|
+
puppetfile_dirs = config.puppetfile_dir.kind_of?(Array) ? config.puppetfile_dir : [config.puppetfile_dir]
|
27
|
+
|
28
|
+
puppetfile_dirs.each do |puppetfile_dir|
|
29
|
+
provision(puppetfile_dir, env, config)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Restore the original path
|
33
|
+
ENV['PATH'] = original_path
|
34
|
+
end
|
35
|
+
@app.call(env)
|
36
|
+
end
|
37
|
+
|
38
|
+
def provision(puppetfile_dir, env, config)
|
39
|
+
if File.exist? File.join(env[:root_path], config.puppetfile_path(puppetfile_dir))
|
40
|
+
|
41
|
+
env[:ui].info "Installing Puppet modules in \"#{puppetfile_dir}\" with Librarian-Puppet..."
|
42
|
+
|
31
43
|
# Determine if we need to persist placeholder file
|
32
44
|
placeholder_file = File.join(
|
33
45
|
env[:root_path],
|
34
|
-
|
46
|
+
puppetfile_dir,
|
35
47
|
'modules',
|
36
48
|
config.placeholder_filename
|
37
49
|
)
|
@@ -42,7 +54,7 @@ module VagrantPlugins
|
|
42
54
|
end
|
43
55
|
|
44
56
|
environment = Librarian::Puppet::Environment.new({
|
45
|
-
:project_path => File.join(env[:root_path],
|
57
|
+
:project_path => File.join(env[:root_path], puppetfile_dir)
|
46
58
|
})
|
47
59
|
environment.config_db.local['destructive'] = config.destructive.to_s
|
48
60
|
environment.config_db.local['use-v1-api'] = config.use_v1_api
|
@@ -51,18 +63,13 @@ module VagrantPlugins
|
|
51
63
|
Librarian::Action::Resolve.new(environment, config.resolve_options).run
|
52
64
|
Librarian::Puppet::Action::Install.new(environment).run
|
53
65
|
|
54
|
-
# Restore the original path
|
55
|
-
ENV['PATH'] = original_path
|
56
|
-
|
57
66
|
# Persist placeholder if necessary
|
58
67
|
if placeholder_contents != nil
|
59
68
|
File.open(placeholder_file, 'w') { |file|
|
60
69
|
file.write(placeholder_contents)
|
61
70
|
}
|
62
71
|
end
|
63
|
-
|
64
72
|
end
|
65
|
-
@app.call(env)
|
66
73
|
end
|
67
74
|
|
68
75
|
def provisioned?
|
@@ -31,8 +31,8 @@ module VagrantPlugins
|
|
31
31
|
return { 'vagrant-librarian-puppet' => errors }
|
32
32
|
end
|
33
33
|
|
34
|
-
def puppetfile_path
|
35
|
-
@puppetfile_path ||=
|
34
|
+
def puppetfile_path(puppetfile_dir)
|
35
|
+
@puppetfile_path ||= puppetfile_dir ? File.join(puppetfile_dir, 'Puppetfile') : 'Puppetfile'
|
36
36
|
end
|
37
37
|
|
38
38
|
def use_v1_api
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-librarian-puppet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Hahn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: librarian-puppet
|
@@ -113,7 +113,11 @@ files:
|
|
113
113
|
- lib/vagrant-librarian-puppet/plugin.rb
|
114
114
|
- lib/vagrant-librarian-puppet/version.rb
|
115
115
|
- manifests/init.pp
|
116
|
+
- manifests/multidir.pp
|
116
117
|
- puppet/Puppetfile
|
118
|
+
- puppet/modules/.gitkeep
|
119
|
+
- puppet_custom/Puppetfile
|
120
|
+
- puppet_custom/modules/.gitkeep
|
117
121
|
- vagrant-librarian-puppet.gemspec
|
118
122
|
homepage: https://github.com/mhahn/vagrant-librarian-puppet
|
119
123
|
licenses:
|