vagrant-puppet-fact-generator 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 45b13dd43fe7fda2c3a5b765b5e99df53dac4d69
4
+ data.tar.gz: 17f2f002ab517f5cd20c8c3799a1000889a81f01
5
+ SHA512:
6
+ metadata.gz: 26aab65da97055c0720d08ff5b7366a134b64b7a4533659ea0e3f59bde4a717f2c051c41e770eb9864b3d9f709aa0f705140fbc6ee0f56b446a02244694f343f
7
+ data.tar.gz: 2d7d38ecc43a03f9b6018670a53e7958ee7a9cd864070bf18c43ab7b3dcbe288fb05f06ebdea18f0654e70e6a5f39058778002c9e4174c278104af0ab416fd3d
@@ -0,0 +1,18 @@
1
+ *.rbc
2
+ .bundle
3
+ .config
4
+ .yardoc
5
+ Gemfile.lock
6
+ InstalledFiles
7
+ _yardoc
8
+ coverage
9
+ doc/
10
+ lib/bundler/man
11
+ rdoc
12
+ spec/reports
13
+ test/tmp
14
+ test/version_tmp
15
+ tmp
16
+ pkg
17
+
18
+ .vagrant
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-puppet-fact-generator", path: "."
12
+ end
@@ -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.
@@ -0,0 +1,27 @@
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
+ This plugin allows other plugins to specify puppet facts before provisioning the machine.
14
+
15
+ ## Development
16
+
17
+ ``` bash
18
+ $ bundle
19
+ $ bundle exec vagrant up
20
+ ```
21
+
22
+ ## Contributing
23
+
24
+ 1. Create your feature branch (`git checkout -b my-new-feature`)
25
+ 2. Commit your changes (`git commit -am 'Add some feature'`)
26
+ 3. Push to the branch (`git push origin my-new-feature`)
27
+ 4. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,16 @@
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_fact_generator.add_fact('some_fact', 'some_value')
10
+
11
+ config.vm.provision 'puppet' do |puppet|
12
+ puppet.manifests_path = 'manifests'
13
+ puppet.manifest_file = 'init.pp'
14
+ end
15
+
16
+ end
@@ -0,0 +1,2 @@
1
+ require "vagrant-puppet-fact-generator/version"
2
+ require "vagrant-puppet-fact-generator/plugin"
@@ -0,0 +1,26 @@
1
+ module VagrantPlugins
2
+ module PuppetFactGenerator
3
+ class Action
4
+ class GenerateFacts
5
+
6
+ def initialize(app, env)
7
+ @app = app
8
+ @env = env
9
+ @puppet_fact_generator = @env[:machine].config.puppet_fact_generator
10
+
11
+ provisioner = @env[:machine].config.vm.provisioners[0]
12
+ @puppet_config = provisioner ? provisioner.config: nil
13
+ end
14
+
15
+ def call(env)
16
+ if @puppet_config and @puppet_fact_generator.facts
17
+ @puppet_fact_generator.facts.each_pair { |k, v| @env[:ui].success "Creating fact #{k} => #{v}" }
18
+ @puppet_config.facter = @puppet_config.facter.merge(@puppet_fact_generator.facts)
19
+ end
20
+ @app.call(env)
21
+ end
22
+
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,37 @@
1
+ module VagrantPlugins
2
+ module PuppetFactGenerator
3
+ class Config < Vagrant.plugin(2, :config)
4
+ attr_accessor :facts
5
+
6
+ def initialize
7
+ @facts = UNSET_VALUE
8
+ end
9
+
10
+ def get_facts
11
+ if @facts == UNSET_VALUE
12
+ @facts = {}
13
+ end
14
+ return @facts
15
+ end
16
+
17
+ def add_fact(fact_name, value)
18
+ facts = get_facts()
19
+ facts[fact_name] = value
20
+ end
21
+
22
+ def finalize!
23
+ @facts = {} if @facts == UNSET_VALUE
24
+ end
25
+
26
+ def validate(machine)
27
+ errors = []
28
+ if @facts and not @facts.kind_of?(Hash)
29
+ errors << '`facts` must be a hash of form fact_name => fact_value'
30
+ end
31
+
32
+ return {'puppet_fact_generator' => errors}
33
+ end
34
+
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,30 @@
1
+ begin
2
+ require 'vagrant'
3
+ rescue LoadError
4
+ abort 'vagrant-puppet-fact-generator must be loaded in a Vagrant environment.'
5
+ end
6
+
7
+
8
+ module VagrantPlugins
9
+ module PuppetFactGenerator
10
+ class Plugin < Vagrant.plugin('2')
11
+ name 'vagrant-puppet-fact-generator'
12
+ description <<-DESC
13
+ A Vagrant plugin that allows other plugins to generate custom facts for provisioning.
14
+ DESC
15
+
16
+ # define configs
17
+ config 'puppet_fact_generator' do
18
+ require_relative 'config'
19
+ Config
20
+ end
21
+
22
+ # define hooks
23
+ action_hook 'setup_provision' do |hook|
24
+ require_relative 'actions/generate_facts'
25
+ hook.before Vagrant::Action::Builtin::Provision, Action::GenerateFacts
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module PuppetFactGenerator
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class dev {
2
+ notify { "Dev fact: ${some_fact}":}
3
+ }
4
+
5
+ include dev
@@ -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-fact-generator/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-puppet-fact-generator"
8
+ spec.version = VagrantPlugins::PuppetFactGenerator::VERSION
9
+ spec.authors = ["Michael Hahn"]
10
+ spec.email = ["mhahn@eventbrite.com"]
11
+ spec.description = %q{Vagrant plugin that allows other plugins to generate custom facts for provisioning.}
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-fact-generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.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 that allows other plugins to generate custom facts for
42
+ provisioning.
43
+ email:
44
+ - mhahn@eventbrite.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - Vagrantfile
55
+ - lib/vagrant-puppet-fact-generator.rb
56
+ - lib/vagrant-puppet-fact-generator/actions/generate_facts.rb
57
+ - lib/vagrant-puppet-fact-generator/config.rb
58
+ - lib/vagrant-puppet-fact-generator/plugin.rb
59
+ - lib/vagrant-puppet-fact-generator/version.rb
60
+ - manifests/init.pp
61
+ - pkg/vagrant-puppet-fact-generator-0.0.1.gem
62
+ - pkg/vagrant-puppet-fact-generator-0.1.0.gem
63
+ - vagrant-puppet-fact-generator.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 that allows other plugins to generate custom facts for provisioning.
88
+ test_files: []
89
+ has_rdoc: