outoftime-vagrant-librarian-puppet 0.7.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 41d9c097abe077125a36d44b257a68d7324da234
4
+ data.tar.gz: ade075600bc701eedb020b90a3affd8c31325eef
5
+ SHA512:
6
+ metadata.gz: 2370951c121920239ac99b5f5d7735459cc1df08f7e93900911e3e55f69ac6d92a61679f31688144bbad2fbf689a79fdf46d0b4ff30059398c07cb946561c00a
7
+ data.tar.gz: 43b4d2e92b8084580afcc6bb6ca82429977a35b04899bd2bf190bfbb69592db95d35fa39b667cef35eac9bf6c0551086d6467aa922e3da058c2fd8acf33c3d7b
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ Puppetfile.lock
19
+ modules
20
+ .vagrant
21
+ .tmp
data/Gemfile ADDED
@@ -0,0 +1,12 @@
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-librarian-puppet", path: "."
12
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jimmy Cuadra
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,61 @@
1
+ # vagrant-librarian-puppet
2
+
3
+ A [Vagrant](http://www.vagrantup.com/) plugin to install
4
+ [Puppet](http://docs.puppetlabs.com/#puppetpuppet) modules using
5
+ [Librarian-Puppet](https://github.com/rodjek/librarian-puppet).
6
+
7
+ ## Requirements
8
+
9
+ * Vagrant version 1.2.0 or greater.
10
+
11
+ ## Installation
12
+
13
+ ``` bash
14
+ vagrant plugin install vagrant-librarian-puppet
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Vagrant will automatically run Librarian-Puppet before any provisioning step, so
20
+ simply set up your Puppetfile as you normally would.
21
+
22
+ You may specify the subdirectory within which to run `librarian-puppet`
23
+ using the `librarian_puppet.puppetfile_dir` config key. Please keep in mind
24
+ that you will need to explicitly set the `modules` path in the
25
+ `:puppet` provisioner and this path must exist before running vagrant commands.
26
+
27
+ **NOTE:** Since the puppet provisioner will fail if the path provided to
28
+ "puppet.modules" doesn't exist and librarian-puppet will destroy and recreate
29
+ the modules directory on each run, this plugin supports a placeholder file
30
+ within the modules directory that can be checked into version control and will
31
+ persist between provisions.
32
+
33
+ ```ruby
34
+ Vagrant.configure("2") do |config|
35
+
36
+ config.librarian_puppet.puppetfile_dir = "puppet"
37
+ # placeholder_filename defaults to .PLACEHOLDER
38
+ config.librarian_puppet.placeholder_filename = ".MYPLACEHOLDER"
39
+
40
+ config.vm.provision :puppet do |puppet|
41
+ puppet.module_path = "puppet/modules"
42
+
43
+ ...
44
+
45
+ end
46
+ end
47
+ ```
48
+
49
+ ## Development
50
+
51
+ ``` bash
52
+ bundle
53
+ bundle exec vagrant up
54
+ ```
55
+
56
+ ## Acknowledgements
57
+
58
+ Thanks to @jimmycuadra and other contributors for their work on
59
+ [vagrant-librarian-chef](https://github.com/jimmycuadra/vagrant-librarian-chef).
60
+ This plugin made some slight changes to work with puppet, but largely just used
61
+ their code.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/Vagrantfile ADDED
@@ -0,0 +1,18 @@
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.librarian_puppet.puppetfile_dir = 'puppet'
10
+ config.librarian_puppet.resolve_options = { :force => true }
11
+
12
+ config.vm.provision :puppet do |puppet|
13
+ puppet.manifests_path = 'manifests'
14
+ puppet.manifest_file = 'init.pp'
15
+ puppet.module_path = 'puppet/modules'
16
+ end
17
+
18
+ end
@@ -0,0 +1,2 @@
1
+ require "vagrant-librarian-puppet/version"
2
+ require "vagrant-librarian-puppet/plugin"
@@ -0,0 +1,71 @@
1
+ require 'librarian/puppet'
2
+ require 'librarian/action'
3
+
4
+ module VagrantPlugins
5
+ module LibrarianPuppet
6
+ module Action
7
+ class Install
8
+ def initialize(app, env)
9
+ @app = app
10
+ @env = env
11
+ # Config#finalize! SHOULD be called automatically
12
+ env[:machine].config.librarian_puppet.finalize!
13
+ end
14
+
15
+ def call(env)
16
+ config = env[:machine].config.librarian_puppet
17
+ if
18
+ provisioned? and
19
+ File.exist? File.join(env[:root_path], config.puppetfile_path)
20
+
21
+ env[:ui].info "Installing Puppet modules with Librarian-Puppet..."
22
+
23
+ # NB: Librarian::Puppet::Environment calls `which puppet` so we
24
+ # need to make sure VAGRANT_HOME/gems/bin has been added to the
25
+ # path.
26
+ original_path = ENV['PATH']
27
+ bin_path = env[:gems_path].join('bin')
28
+ ENV['PATH'] = "#{bin_path}#{::File::PATH_SEPARATOR}#{ENV['PATH']}"
29
+
30
+ # Determine if we need to persist placeholder file
31
+ placeholder_file = File.join(
32
+ env[:root_path],
33
+ config.puppetfile_dir,
34
+ 'modules',
35
+ config.placeholder_filename
36
+ )
37
+ if File.exist? placeholder_file
38
+ placeholder_contents = File.read(placeholder_file)
39
+ else
40
+ placeholder_contents = nil
41
+ end
42
+
43
+ environment = Librarian::Puppet::Environment.new({
44
+ :project_path => File.join(env[:root_path], config.puppetfile_dir)
45
+ })
46
+ Librarian::Action::Ensure.new(environment).run
47
+ Librarian::Action::Resolve.new(environment, config.resolve_options).run
48
+ Librarian::Action::Install.new(environment).run
49
+
50
+ # Restore the original path
51
+ ENV['PATH'] = original_path
52
+
53
+ # Persist placeholder if necessary
54
+ if placeholder_contents != nil
55
+ File.open(placeholder_file, 'w') { |file|
56
+ file.write(placeholder_contents)
57
+ }
58
+ end
59
+
60
+ end
61
+ @app.call(env)
62
+ end
63
+
64
+ def provisioned?
65
+ @env[:provision_enabled].nil? ? true : @env[:provision_enabled]
66
+ end
67
+
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,34 @@
1
+ module VagrantPlugins
2
+ module LibrarianPuppet
3
+ class Config < Vagrant.plugin(2, :config)
4
+ attr_accessor :puppetfile_dir
5
+ attr_accessor :placeholder_filename
6
+ attr_accessor :resolve_options
7
+
8
+ def initialize
9
+ @puppetfile_dir = UNSET_VALUE
10
+ @placeholder_filename = UNSET_VALUE
11
+ @resolve_options = UNSET_VALUE
12
+ end
13
+
14
+ def finalize!
15
+ @puppetfile_dir = '.' if @puppetfile_dir == UNSET_VALUE
16
+ @placeholder_filename = '.PLACEHOLDER' if @placeholder_filename == UNSET_VALUE
17
+ @resolve_options = {} if @resolve_options == UNSET_VALUE
18
+ end
19
+
20
+ def validate(machine)
21
+ errors = []
22
+ if not @resolve_options.kind_of?(Hash)
23
+ errors << '`resolve_options` must be a hash'
24
+ end
25
+ return { 'vagrant-librarian-puppet' => errors }
26
+ end
27
+
28
+ def puppetfile_path
29
+ @puppetfile_path ||= @puppetfile_dir ? File.join(@puppetfile_dir, 'Puppetfile') : 'Puppetfile'
30
+ end
31
+
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,28 @@
1
+ begin
2
+ require "vagrant"
3
+ rescue LoadError
4
+ abort "vagrant-librarian-puppet must be loaded in a Vagrant environment."
5
+ end
6
+
7
+ require "vagrant-librarian-puppet/action/librarian_puppet"
8
+
9
+
10
+ module VagrantPlugins
11
+ module LibrarianPuppet
12
+ class Plugin < Vagrant.plugin("2")
13
+ name "vagrant-librarian-puppet"
14
+ description <<-DESC
15
+ A Vagrant plugin to install Puppet modules using Librarian-Puppet.
16
+ DESC
17
+ action_hook "librarian_puppet" do |hook|
18
+ # XXX see if we can only hook so long as a command option isn't passed
19
+ hook.before Vagrant::Action::Builtin::Provision, Action::Install
20
+ end
21
+
22
+ config "librarian_puppet" do
23
+ require_relative "config"
24
+ Config
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module LibrarianPuppet
3
+ VERSION = "0.7.1"
4
+ end
5
+ end
data/manifests/init.pp ADDED
@@ -0,0 +1,8 @@
1
+ class dev {
2
+
3
+ include git
4
+ include supervisor
5
+
6
+ }
7
+
8
+ include dev
data/puppet/Puppetfile ADDED
@@ -0,0 +1,8 @@
1
+ # Manage Puppet module dependencies with librarian-puppet
2
+
3
+ forge 'http://forge.puppetlabs.com'
4
+
5
+ mod 'supervisor',
6
+ :git => 'git://github.com/eventbrite/puppet-supervisor.git'
7
+
8
+ mod 'puppetlabs/git'
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant-librarian-puppet/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "outoftime-vagrant-librarian-puppet"
8
+ spec.version = VagrantPlugins::LibrarianPuppet::VERSION
9
+ spec.authors = ["Michael Hahn"]
10
+ spec.email = ["mwhahn@gmail.com"]
11
+ spec.description = %q{A Vagrant plugin to install Puppet modules using Librarian-Puppet.}
12
+ spec.summary = %q{A Vagrant plugin to install Puppet modules using Librarian-Puppet.}
13
+ spec.homepage = "https://github.com/mhahn/vagrant-librarian-puppet"
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_runtime_dependency "librarian-puppet", "~> 2.0"
22
+ spec.add_runtime_dependency "librarian"
23
+ spec.add_runtime_dependency 'net-http-persistent'
24
+ spec.add_runtime_dependency "puppet", "~> 3.4.3"
25
+ spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "rspec"
28
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: outoftime-vagrant-librarian-puppet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.1
5
+ platform: ruby
6
+ authors:
7
+ - Michael Hahn
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: librarian-puppet
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: librarian
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: net-http-persistent
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: puppet
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.4.3
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.4.3
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: A Vagrant plugin to install Puppet modules using Librarian-Puppet.
112
+ email:
113
+ - mwhahn@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - Gemfile
120
+ - LICENSE.txt
121
+ - README.md
122
+ - Rakefile
123
+ - Vagrantfile
124
+ - lib/vagrant-librarian-puppet.rb
125
+ - lib/vagrant-librarian-puppet/action/librarian_puppet.rb
126
+ - lib/vagrant-librarian-puppet/config.rb
127
+ - lib/vagrant-librarian-puppet/plugin.rb
128
+ - lib/vagrant-librarian-puppet/version.rb
129
+ - manifests/init.pp
130
+ - puppet/Puppetfile
131
+ - vagrant-librarian-puppet.gemspec
132
+ homepage: https://github.com/mhahn/vagrant-librarian-puppet
133
+ licenses:
134
+ - MIT
135
+ metadata: {}
136
+ post_install_message:
137
+ rdoc_options: []
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ requirements: []
151
+ rubyforge_project:
152
+ rubygems_version: 2.2.2
153
+ signing_key:
154
+ specification_version: 4
155
+ summary: A Vagrant plugin to install Puppet modules using Librarian-Puppet.
156
+ test_files: []