vagrant-puppet-module-registry 0.2.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 +7 -0
- data/.gitignore +18 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +22 -0
- data/README.md +25 -0
- data/Rakefile +1 -0
- data/Vagrantfile +17 -0
- data/lib/vagrant-puppet-module-registry/actions/add_module_facts.rb +47 -0
- data/lib/vagrant-puppet-module-registry/config.rb +57 -0
- data/lib/vagrant-puppet-module-registry/plugin.rb +35 -0
- data/lib/vagrant-puppet-module-registry/version.rb +5 -0
- data/lib/vagrant-puppet-module-registry.rb +2 -0
- data/manifests/init.pp +8 -0
- data/manifests/modules/core/manifests/init.pp +4 -0
- data/pkg/vagrant-puppet-module-registry-0.1.0.gem +0 -0
- data/pkg/vagrant-puppet-module-registry-0.2.0.gem +0 -0
- data/vagrant-puppet-module-registry.gemspec +23 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cc5ac4281a6befe6534ef4f65a75d55b8a137042
|
4
|
+
data.tar.gz: ae75d1a70300f7c4b47529dff989dd420bdeb78d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a2bf1ce2401ba1988247bbe4f78798ce260bb88352d6eada628aec1c6b7f9d5acee8696427fd277bc8115a6a0fcf827a4481b2620c43fc92073927b44cf72207
|
7
|
+
data.tar.gz: d76f99296a1c4c1be902556c13e8ff755c2b7360f6099ff437d15f8caa3e21d71f79da14e9d2f96d715c11192fb8690a21c8cf9f76d6e188f6e87b13025c171c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group :development do
|
6
|
+
gem 'vagrant', github: 'mitchellh/vagrant'
|
7
|
+
gem 'debugger'
|
8
|
+
end
|
9
|
+
|
10
|
+
group :plugins do
|
11
|
+
gem 'vagrant-puppet-fact-generator', :git => 'git@github.com:eventbrite/vagrant-puppet-fact-generator.git'
|
12
|
+
gem 'vagrant-puppet-module-registry', path: '.'
|
13
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Michael Hahn
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# vagrant-soa
|
2
|
+
|
3
|
+
A [Vagrant](http://www.vagrantup.com/) plugin to handle our SOA infrastructre within vagrant.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
``` bash
|
8
|
+
vagrant plugin install vagrant-soa
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
## Development
|
14
|
+
|
15
|
+
``` bash
|
16
|
+
$ bundle
|
17
|
+
$ bundle exec vagrant up
|
18
|
+
```
|
19
|
+
|
20
|
+
## Contributing
|
21
|
+
|
22
|
+
1. Create your feature branch (`git checkout -b my-new-feature`)
|
23
|
+
2. Commit your changes (`git commit -am 'Add some feature'`)
|
24
|
+
3. Push to the branch (`git push origin my-new-feature`)
|
25
|
+
4. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/Vagrantfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- mode: ruby -*-
|
3
|
+
# vi: set ft=ruby :
|
4
|
+
|
5
|
+
Vagrant.configure('2') do |config|
|
6
|
+
config.vm.box = 'precise64'
|
7
|
+
config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
|
8
|
+
|
9
|
+
config.puppet_module_registry.register_module_path('core', 'manifests/modules')
|
10
|
+
|
11
|
+
config.vm.provision 'puppet' do |puppet|
|
12
|
+
puppet.manifests_path = 'manifests'
|
13
|
+
puppet.manifest_file = 'init.pp'
|
14
|
+
puppet.module_path = config.puppet_module_registry.get_puppet_module_paths()
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module PuppetModuleRegistry
|
3
|
+
class Action
|
4
|
+
class AddModuleFacts
|
5
|
+
def initialize(app, env)
|
6
|
+
@app = app
|
7
|
+
@env = env
|
8
|
+
@puppet_fact_generator = @env[:machine].config.puppet_fact_generator
|
9
|
+
@puppet_module_registry = @env[:machine].config.puppet_module_registry
|
10
|
+
|
11
|
+
provisioner = @env[:machine].config.vm.provisioners[0]
|
12
|
+
@puppet_config = provisioner ? provisioner.config: nil
|
13
|
+
end
|
14
|
+
|
15
|
+
# During puppet provision vagrant links all the paths provided to
|
16
|
+
# `puppet.module_path` to temporary shared paths within the vm. It does
|
17
|
+
# this by looping through `puppet.module_path` and linking to
|
18
|
+
# /tmp/vagrant-puppet/modules-N, N being the index of the path within
|
19
|
+
# the module_path array. Modules need to reference this temporary
|
20
|
+
# directory in order to install certain files. Instead of guessing at
|
21
|
+
# which temporary directory it will be installed in, we generate custom
|
22
|
+
# facts that can be referenced within the module's manifests.
|
23
|
+
#
|
24
|
+
# These custom facts will be of the form: "#{name}_vagrant_module_path"
|
25
|
+
def call(env)
|
26
|
+
if @puppet_config
|
27
|
+
module_paths = @puppet_module_registry.get_puppet_module_paths()
|
28
|
+
module_map = @puppet_module_registry.get_puppet_module_path_map()
|
29
|
+
module_paths.each_with_index do |path, i|
|
30
|
+
name = module_map.fetch(path)
|
31
|
+
if not name
|
32
|
+
env[:ui].warn "Failed to install custom fact for #{path}. No reference in @puppet_module_registry.puppet_module_path_to_name."
|
33
|
+
else
|
34
|
+
@puppet_fact_generator.add_fact(
|
35
|
+
"#{name}_vagrant_module_path",
|
36
|
+
File.join(@puppet_config.temp_dir, "modules-#{i}")
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
@app.call(env)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module PuppetModuleRegistry
|
3
|
+
class Config < Vagrant.plugin(2, :config)
|
4
|
+
|
5
|
+
attr_accessor :puppet_module_paths
|
6
|
+
attr_accessor :puppet_module_path_to_name
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@puppet_module_paths = UNSET_VALUE
|
10
|
+
@puppet_module_path_to_name = UNSET_VALUE
|
11
|
+
end
|
12
|
+
|
13
|
+
# Return a hash which should be of the form module_path => name.
|
14
|
+
def get_puppet_module_path_map
|
15
|
+
if @puppet_module_path_to_name == UNSET_VALUE
|
16
|
+
@puppet_module_path_to_name = {}
|
17
|
+
end
|
18
|
+
return @puppet_module_path_to_name
|
19
|
+
end
|
20
|
+
|
21
|
+
# Return an array of modules to be added to puppet's module path when
|
22
|
+
# provisioning
|
23
|
+
def get_puppet_module_paths
|
24
|
+
if @puppet_module_paths == UNSET_VALUE
|
25
|
+
@puppet_module_paths = []
|
26
|
+
end
|
27
|
+
return @puppet_module_paths
|
28
|
+
end
|
29
|
+
|
30
|
+
# Add a path to the `puppet_module_paths` array as well as the
|
31
|
+
# `puppet_module_path_to_name` hash. This gives us a mechanism to loop
|
32
|
+
# through `puppet_module_paths` and retrieve the name the path is
|
33
|
+
# associated with.
|
34
|
+
def register_module_path(name, path)
|
35
|
+
module_map = get_puppet_module_path_map()
|
36
|
+
module_paths = get_puppet_module_paths()
|
37
|
+
module_map[path] = name
|
38
|
+
module_paths.push(path)
|
39
|
+
end
|
40
|
+
|
41
|
+
def finalize!
|
42
|
+
@puppet_module_paths = [] if @puppet_module_paths == UNSET_VALUE
|
43
|
+
@puppet_module_path_to_name = {} if @puppet_module_path_to_name == UNSET_VALUE
|
44
|
+
end
|
45
|
+
|
46
|
+
def validate(machine)
|
47
|
+
errors = []
|
48
|
+
if @puppet_module_path_to_name and
|
49
|
+
not @puppet_module_path_to_name.kind_of?(Hash)
|
50
|
+
errors << "`puppet_module_path_to_name` must be a hash"
|
51
|
+
end
|
52
|
+
return { "puppet_module_registry" => errors }
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
begin
|
2
|
+
require 'vagrant'
|
3
|
+
rescue LoadError
|
4
|
+
abort 'vagrant-puppet-module-registry must be loaded in a Vagrant environment.'
|
5
|
+
end
|
6
|
+
|
7
|
+
begin
|
8
|
+
require 'vagrant-puppet-fact-generator'
|
9
|
+
rescue LoadError
|
10
|
+
abort 'vagrant-puppet-module-registry depends on the `vagrant-puppet-fact-generator` plugin.'
|
11
|
+
end
|
12
|
+
|
13
|
+
module VagrantPlugins
|
14
|
+
module PuppetModuleRegistry
|
15
|
+
class Plugin < Vagrant.plugin('2')
|
16
|
+
name 'vagrant-puppet-module-registry'
|
17
|
+
description <<-DESC
|
18
|
+
A Vagrant plugin to manage multiple puppet module paths.
|
19
|
+
DESC
|
20
|
+
|
21
|
+
# define configs
|
22
|
+
config 'puppet_module_registry' do
|
23
|
+
require_relative 'config'
|
24
|
+
Config
|
25
|
+
end
|
26
|
+
|
27
|
+
# define hooks
|
28
|
+
action_hook 'add_module_facts' do |hook|
|
29
|
+
require_relative 'actions/add_module_facts'
|
30
|
+
hook.before VagrantPlugins::PuppetFactGenerator::Action::GenerateFacts, Action::AddModuleFacts
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/manifests/init.pp
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-puppet-module-registry/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-puppet-module-registry"
|
8
|
+
spec.version = VagrantPlugins::PuppetModuleRegistry::VERSION
|
9
|
+
spec.authors = ["Michael Hahn"]
|
10
|
+
spec.email = ["mhahn@eventbrite.com"]
|
11
|
+
spec.description = %q{Vagrant plugin to manage multiple puppet module paths.}
|
12
|
+
spec.summary = spec.description
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-puppet-module-registry
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Hahn
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Vagrant plugin to manage multiple puppet module paths.
|
42
|
+
email:
|
43
|
+
- mhahn@eventbrite.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- Vagrantfile
|
54
|
+
- lib/vagrant-puppet-module-registry.rb
|
55
|
+
- lib/vagrant-puppet-module-registry/actions/add_module_facts.rb
|
56
|
+
- lib/vagrant-puppet-module-registry/config.rb
|
57
|
+
- lib/vagrant-puppet-module-registry/plugin.rb
|
58
|
+
- lib/vagrant-puppet-module-registry/version.rb
|
59
|
+
- manifests/init.pp
|
60
|
+
- manifests/modules/core/manifests/init.pp
|
61
|
+
- pkg/vagrant-puppet-module-registry-0.1.0.gem
|
62
|
+
- pkg/vagrant-puppet-module-registry-0.2.0.gem
|
63
|
+
- vagrant-puppet-module-registry.gemspec
|
64
|
+
homepage: ''
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 2.0.3
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: Vagrant plugin to manage multiple puppet module paths.
|
88
|
+
test_files: []
|
89
|
+
has_rdoc:
|