vagrant-r10k 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -2
- data/.pullreview.yml +4 -0
- data/.rspec +5 -0
- data/.ruby-version +1 -1
- data/.travis.yml +3 -1
- data/CHANGES.md +26 -0
- data/Gemfile +7 -2
- data/Gemfile.lock +181 -0
- data/README.md +122 -7
- data/Rakefile +111 -0
- data/lib/vagrant-r10k/action/base.rb +44 -0
- data/lib/vagrant-r10k/action/deploy.rb +91 -0
- data/lib/vagrant-r10k/action/validate.rb +46 -0
- data/lib/vagrant-r10k/config.rb +13 -4
- data/lib/vagrant-r10k/helpers.rb +174 -0
- data/lib/vagrant-r10k/plugin.rb +11 -5
- data/lib/vagrant-r10k/version.rb +2 -1
- data/spec/acceptance/skeletons/correct/Vagrantfile +21 -0
- data/spec/acceptance/skeletons/correct/gitcheck.sh +20 -0
- data/spec/acceptance/skeletons/correct/puppet/NOTmodules/.gitkeep +0 -0
- data/spec/acceptance/skeletons/correct/puppet/Puppetfile +12 -0
- data/spec/acceptance/skeletons/correct/puppet/manifests/default.pp +1 -0
- data/spec/acceptance/skeletons/correct/puppet/modules/.gitkeep +0 -0
- data/spec/acceptance/skeletons/could_not_resolve_host/Vagrantfile +21 -0
- data/spec/acceptance/skeletons/could_not_resolve_host/gitcheck.sh +20 -0
- data/spec/acceptance/skeletons/could_not_resolve_host/puppet/NOTmodules/.gitkeep +0 -0
- data/spec/acceptance/skeletons/could_not_resolve_host/puppet/Puppetfile +7 -0
- data/spec/acceptance/skeletons/could_not_resolve_host/puppet/manifests/default.pp +1 -0
- data/spec/acceptance/skeletons/could_not_resolve_host/puppet/modules/.gitkeep +0 -0
- data/spec/acceptance/skeletons/different_mod_path/Vagrantfile +19 -0
- data/spec/acceptance/skeletons/different_mod_path/gitcheck.sh +20 -0
- data/spec/acceptance/skeletons/different_mod_path/puppet/NOTmodules/.gitkeep +0 -0
- data/spec/acceptance/skeletons/different_mod_path/puppet/Puppetfile +12 -0
- data/spec/acceptance/skeletons/different_mod_path/puppet/manifests/default.pp +1 -0
- data/spec/acceptance/skeletons/different_mod_path/puppet/modules/.gitkeep +0 -0
- data/spec/acceptance/skeletons/no_mod_path/Vagrantfile +17 -0
- data/spec/acceptance/skeletons/no_mod_path/gitcheck.sh +20 -0
- data/spec/acceptance/skeletons/no_mod_path/puppet/NOTmodules/.gitkeep +0 -0
- data/spec/acceptance/skeletons/no_mod_path/puppet/Puppetfile +12 -0
- data/spec/acceptance/skeletons/no_mod_path/puppet/manifests/default.pp +1 -0
- data/spec/acceptance/skeletons/no_mod_path/puppet/modules/.gitkeep +0 -0
- data/spec/acceptance/skeletons/no_puppet_dir/Vagrantfile +18 -0
- data/spec/acceptance/skeletons/no_puppet_dir/gitcheck.sh +20 -0
- data/spec/acceptance/skeletons/no_vagrant_r10k/Vagrantfile +14 -0
- data/spec/acceptance/skeletons/no_vagrant_r10k/gitcheck.sh +20 -0
- data/spec/acceptance/skeletons/no_vagrant_r10k/puppet/NOTmodules/.gitkeep +0 -0
- data/spec/acceptance/skeletons/no_vagrant_r10k/puppet/Puppetfile +12 -0
- data/spec/acceptance/skeletons/no_vagrant_r10k/puppet/manifests/default.pp +1 -0
- data/spec/acceptance/skeletons/no_vagrant_r10k/puppet/modules/.gitkeep +0 -0
- data/spec/acceptance/skeletons/puppetfile_syntax_error/Vagrantfile +18 -0
- data/spec/acceptance/skeletons/puppetfile_syntax_error/gitcheck.sh +20 -0
- data/spec/acceptance/skeletons/puppetfile_syntax_error/puppet/Puppetfile +1 -0
- data/spec/acceptance/skeletons/puppetfile_syntax_error/puppet/manifests/default.pp +1 -0
- data/spec/acceptance/skeletons/puppetfile_syntax_error/puppet/modules/.gitkeep +0 -0
- data/spec/acceptance/vagrant-r10k/vagrant-r10k_spec.rb +255 -0
- data/spec/spec_helper.rb +10 -7
- data/spec/unit/action_base_spec.rb +57 -0
- data/spec/unit/action_deploy_spec.rb +550 -0
- data/spec/unit/action_validate_spec.rb +240 -0
- data/spec/unit/helpers_spec.rb +307 -0
- data/spec/unit/plugin_spec.rb +49 -0
- data/support/testrunner.py +189 -0
- data/vagrant-r10k.gemspec +1 -1
- data/vagrant-spec.config.rb +18 -0
- metadata +111 -19
- data/lib/vagrant-r10k/modulegetter.rb +0 -145
- data/spec/unit/modulegetter_spec.rb +0 -369
@@ -0,0 +1,91 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module R10k
|
5
|
+
module Action
|
6
|
+
# run r10k deploy
|
7
|
+
class Deploy < Base
|
8
|
+
|
9
|
+
# determine if we should run, and get config
|
10
|
+
def call(env)
|
11
|
+
@logger.debug "vagrant::r10k::deploy called"
|
12
|
+
|
13
|
+
unless r10k_enabled?(env)
|
14
|
+
env[:ui].info "vagrant-r10k not configured; skipping"
|
15
|
+
return @app.call(env)
|
16
|
+
end
|
17
|
+
|
18
|
+
unless provision_enabled?(env)
|
19
|
+
env[:ui].info "provisioning disabled; skipping vagrant-r10k"
|
20
|
+
return @app.call(env)
|
21
|
+
end
|
22
|
+
|
23
|
+
# get our config
|
24
|
+
config = r10k_config(env)
|
25
|
+
if config.nil?
|
26
|
+
@logger.info "vagrant::r10k::deploy got nil configuration"
|
27
|
+
raise ErrorWrapper.new(RuntimeError.new("vagrant-r10k configuration error; cannot continue"))
|
28
|
+
end
|
29
|
+
@logger.debug("vagrant::r10k::deploy: env_dir_path=#{config[:env_dir_path]}")
|
30
|
+
@logger.debug("vagrant::r10k::deploy: puppetfile_path=#{config[:puppetfile_path]}")
|
31
|
+
@logger.debug("vagrant::r10k::deploy: module_path=#{config[:module_path]}")
|
32
|
+
@logger.debug("vagrant::r10k::deploy: manifests=#{config[:manifests]}")
|
33
|
+
@logger.debug("vagrant::r10k::deploy: manifest_file=#{config[:manifest_file]}")
|
34
|
+
@logger.debug("vagrant::r10k::deploy: puppet_dir=#{config[:puppet_dir]}")
|
35
|
+
|
36
|
+
deploy(env, config)
|
37
|
+
|
38
|
+
@app.call(env)
|
39
|
+
end
|
40
|
+
|
41
|
+
# run the actual r10k deploy
|
42
|
+
def deploy(env, config)
|
43
|
+
@logger.debug("vagrant::r10k::deploy.deploy called")
|
44
|
+
require 'r10k/task_runner'
|
45
|
+
require 'r10k/task/puppetfile'
|
46
|
+
|
47
|
+
env[:ui].info "vagrant-r10k: Beginning r10k deploy of puppet modules into #{config[:module_path]} using #{config[:puppetfile_path]}"
|
48
|
+
|
49
|
+
if ENV["VAGRANT_LOG"] == "debug"
|
50
|
+
R10K::Logging.level = 0
|
51
|
+
else
|
52
|
+
R10K::Logging.level = 3
|
53
|
+
end
|
54
|
+
|
55
|
+
unless File.file?(config[:puppetfile_path])
|
56
|
+
raise ErrorWrapper.new(RuntimeError.new("Puppetfile at #{config[:puppetfile_path]} does not exist."))
|
57
|
+
end
|
58
|
+
|
59
|
+
# do the actual module buildout
|
60
|
+
runner = R10K::TaskRunner.new([])
|
61
|
+
begin
|
62
|
+
puppetfile = get_puppetfile(config)
|
63
|
+
@logger.debug("vagrant-r10k: creating Puppetfile::Sync task")
|
64
|
+
task = R10K::Task::Puppetfile::Sync.new(puppetfile)
|
65
|
+
@logger.debug("vagrant-r10k: appending task to runner queue")
|
66
|
+
runner.append_task task
|
67
|
+
@logger.debug("vagrant-r10k: running sync task")
|
68
|
+
runner.run
|
69
|
+
@logger.debug("vagrant-r10k: sync task complete")
|
70
|
+
rescue Exception => ex
|
71
|
+
@env[:ui].error "Invalid syntax in Puppetfile at #{config[:puppetfile_path]}"
|
72
|
+
raise ErrorWrapper.new(ex)
|
73
|
+
end
|
74
|
+
unless runner.succeeded?
|
75
|
+
runner.get_errors().each do |error|
|
76
|
+
if error[1].message.include?("fatal: unable to access") and error[1].message.include?("Could not resolve host")
|
77
|
+
# if we can't resolve the host, the error should include how to skip provisioning
|
78
|
+
@logger.debug("vagrant-r10k: caught 'Could not resolve host' error")
|
79
|
+
raise ErrorWrapper.new(RuntimeError.new(error[1].message + "\n\nIf you don't have connectivity to the host, running 'vagrant up --no-provision' will skip r10k deploy and all provisioning."))
|
80
|
+
else
|
81
|
+
raise ErrorWrapper.new(RuntimeError.new(error[1]))
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
@env[:ui].info "vagrant-r10k: Deploy finished"
|
86
|
+
@app.call(env)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module R10k
|
5
|
+
module Action
|
6
|
+
# action to validate config pre-deploy
|
7
|
+
class Validate < Base
|
8
|
+
|
9
|
+
# validate configuration pre-deploy
|
10
|
+
def call(env)
|
11
|
+
@logger.debug "vagrant::r10k::validate called"
|
12
|
+
|
13
|
+
unless r10k_enabled?(env)
|
14
|
+
env[:ui].info "vagrant-r10k not configured; skipping"
|
15
|
+
return @app.call(env)
|
16
|
+
end
|
17
|
+
|
18
|
+
unless provision_enabled?(env)
|
19
|
+
env[:ui].info "provisioning disabled; skipping vagrant-r10k"
|
20
|
+
return @app.call(env)
|
21
|
+
end
|
22
|
+
|
23
|
+
config = r10k_config(env)
|
24
|
+
if config.nil?
|
25
|
+
@logger.info "vagrant::r10k::deploy got nil configuration"
|
26
|
+
raise ErrorWrapper.new(RuntimeError.new("vagrant-r10k configuration error; cannot continue"))
|
27
|
+
end
|
28
|
+
|
29
|
+
puppetfile = get_puppetfile(config)
|
30
|
+
|
31
|
+
# validate puppetfile
|
32
|
+
@logger.debug "vagrant::r10k::validate: validating Puppetfile at #{config[:puppetfile_path]}"
|
33
|
+
begin
|
34
|
+
puppetfile.load
|
35
|
+
rescue Exception => ex
|
36
|
+
@env[:ui].error "Invalid syntax in Puppetfile at #{config[:puppetfile_path]}"
|
37
|
+
raise ErrorWrapper.new(ex)
|
38
|
+
end
|
39
|
+
|
40
|
+
@app.call(env)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/vagrant-r10k/config.rb
CHANGED
@@ -1,17 +1,25 @@
|
|
1
|
+
require "log4r"
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module R10k
|
5
|
+
# vagrant-r10k plugin configuration
|
3
6
|
class Config < Vagrant.plugin('2', :config)
|
4
7
|
attr_accessor :puppet_dir
|
5
8
|
attr_accessor :puppetfile_path
|
6
9
|
attr_accessor :module_path
|
7
10
|
|
11
|
+
# initialize config
|
8
12
|
def initialize
|
9
13
|
@puppet_dir = UNSET_VALUE
|
10
14
|
@puppetfile_path = UNSET_VALUE
|
11
15
|
@module_path = UNSET_VALUE
|
16
|
+
@logger = Log4r::Logger.new("vagrant::r10k::config")
|
17
|
+
@logger.debug("vagrant-r10k-config: initialize")
|
12
18
|
end
|
13
19
|
|
20
|
+
# validate configuration
|
14
21
|
def validate(machine)
|
22
|
+
@logger.debug("vagrant-r10k-config: validate")
|
15
23
|
errors = _detected_errors
|
16
24
|
|
17
25
|
return {} if puppet_dir == UNSET_VALUE and puppetfile_path == UNSET_VALUE
|
@@ -22,7 +30,7 @@ module VagrantPlugins
|
|
22
30
|
end
|
23
31
|
|
24
32
|
puppet_dir_path = File.join(machine.env.root_path, puppet_dir)
|
25
|
-
errors << "puppet_dir directory '#{puppet_dir_path}' does not exist"
|
33
|
+
errors << "puppet_dir directory '#{puppet_dir_path}' does not exist" unless File.directory?(puppet_dir_path)
|
26
34
|
|
27
35
|
if puppetfile_path == UNSET_VALUE
|
28
36
|
errors << "config.r10k.puppetfile_path must be set"
|
@@ -30,13 +38,14 @@ module VagrantPlugins
|
|
30
38
|
end
|
31
39
|
|
32
40
|
puppetfile = File.join(machine.env.root_path, puppetfile_path)
|
33
|
-
errors << "puppetfile '#{puppetfile}' does not exist"
|
41
|
+
errors << "puppetfile '#{puppetfile}' does not exist" unless File.file?(puppetfile)
|
34
42
|
|
35
43
|
if module_path != UNSET_VALUE
|
36
44
|
module_path_path = File.join(machine.env.root_path, module_path)
|
37
|
-
errors << "module_path directory '#{module_path_path}' does not exist"
|
45
|
+
errors << "module_path directory '#{module_path_path}' does not exist" unless File.directory?(module_path_path)
|
38
46
|
end
|
39
|
-
|
47
|
+
|
48
|
+
@logger.debug("vagrant-r10k-config: END validate")
|
40
49
|
{ "vagrant-r10k" => errors }
|
41
50
|
end
|
42
51
|
|
@@ -0,0 +1,174 @@
|
|
1
|
+
require 'r10k/logging'
|
2
|
+
require 'log4r'
|
3
|
+
|
4
|
+
# this is an ugly monkeypatch, since we're running inside of Vagrant,
|
5
|
+
# which has already defined logger but not with the debug1 and debug2 custom levels
|
6
|
+
module Log4r
|
7
|
+
# this is an ugly monkeypatch, since we're running inside of Vagrant,
|
8
|
+
# which has already defined logger but not with the debug1 and debug2 custom levels
|
9
|
+
class Logger
|
10
|
+
|
11
|
+
def debug1(msg)
|
12
|
+
self.debug(msg)
|
13
|
+
end
|
14
|
+
|
15
|
+
def debug2(msg)
|
16
|
+
self.debug(msg)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# patch this so we can get programmatic access to the errors
|
22
|
+
module R10K
|
23
|
+
# patch this so we can get programmatic access to the errors
|
24
|
+
class TaskRunner
|
25
|
+
def get_errors
|
26
|
+
@errors
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module VagrantPlugins
|
32
|
+
module R10k
|
33
|
+
# General-use vagrant-r10k helper methosd
|
34
|
+
module Helpers
|
35
|
+
|
36
|
+
# Determine if r10k.puppet_dir and r10k.puppetfile_path are in config
|
37
|
+
#
|
38
|
+
# @param [Vagrant::Environment] env
|
39
|
+
#
|
40
|
+
# @return [Boolean]
|
41
|
+
def r10k_enabled?(env)
|
42
|
+
unset = Vagrant::Plugin::V2::Config::UNSET_VALUE
|
43
|
+
if env[:machine].config.r10k.puppet_dir == unset or env[:machine].config.r10k.puppetfile_path == unset
|
44
|
+
return false
|
45
|
+
end
|
46
|
+
return true
|
47
|
+
end
|
48
|
+
|
49
|
+
# Determine if --no-provision was specified
|
50
|
+
#
|
51
|
+
# @param [Vagrant::Environment] env
|
52
|
+
#
|
53
|
+
# @return [Boolean]
|
54
|
+
def provision_enabled?(env)
|
55
|
+
env.fetch(:provision_enabled, true)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Get the root directory for the environment
|
59
|
+
#
|
60
|
+
# @param [Vagrant::Environment] env
|
61
|
+
#
|
62
|
+
# @return [String]
|
63
|
+
def env_dir(env)
|
64
|
+
env[:root_path]
|
65
|
+
end
|
66
|
+
|
67
|
+
# Get the Puppetfile path from config
|
68
|
+
#
|
69
|
+
# @param [Vagrant::Environment] env
|
70
|
+
#
|
71
|
+
# @return [File]
|
72
|
+
def puppetfile_path(env)
|
73
|
+
File.join(env_dir(env), env[:machine].config.r10k.puppetfile_path)
|
74
|
+
end
|
75
|
+
|
76
|
+
# Get the Puppet provisioner from config
|
77
|
+
#
|
78
|
+
# @param [Vagrant::Environment] env
|
79
|
+
#
|
80
|
+
# @return something
|
81
|
+
def puppet_provisioner(env)
|
82
|
+
provider = nil
|
83
|
+
env[:machine].config.vm.provisioners.each do |prov|
|
84
|
+
if prov.respond_to?(:type)
|
85
|
+
next if prov.type != :puppet
|
86
|
+
else
|
87
|
+
next if prov.name != :puppet
|
88
|
+
end
|
89
|
+
provider = prov
|
90
|
+
end
|
91
|
+
provider
|
92
|
+
end
|
93
|
+
|
94
|
+
# Get the r10k config
|
95
|
+
#
|
96
|
+
# @param [Vagrant::Environment] env
|
97
|
+
#
|
98
|
+
# @return [Hash]
|
99
|
+
def r10k_config(env)
|
100
|
+
ret = { :manifests => nil, :module_path => nil, :manifest_file => nil }
|
101
|
+
ret[:env_dir_path] = env_dir(env)
|
102
|
+
ret[:puppetfile_path] = puppetfile_path(env)
|
103
|
+
prov = puppet_provisioner(env)
|
104
|
+
return nil if prov.nil?
|
105
|
+
ret[:module_path] = module_path(env, prov, ret[:env_dir_path])
|
106
|
+
return nil if ret[:module_path].nil?
|
107
|
+
ret[:manifest_file] = File.join(ret[:env_dir_path], prov.config.manifest_file)
|
108
|
+
ret[:manifests] = File.join(ret[:env_dir_path], prov.config.manifests_path[1])
|
109
|
+
ret[:puppet_dir] = File.join(ret[:env_dir_path], env[:machine].config.r10k.puppet_dir)
|
110
|
+
ret
|
111
|
+
end
|
112
|
+
|
113
|
+
# Get the module path
|
114
|
+
#
|
115
|
+
# @param [Vagrant::Environment] env
|
116
|
+
# @param [something] prov
|
117
|
+
#
|
118
|
+
# @return [File] or [nil]
|
119
|
+
def module_path(env, prov, env_dir_path)
|
120
|
+
unset = Vagrant::Plugin::V2::Config::UNSET_VALUE
|
121
|
+
# if module_path has been set before, check if it fits to one defined in the provisioner config
|
122
|
+
if env[:machine].config.r10k.module_path != unset
|
123
|
+
module_path = env[:machine].config.r10k.module_path
|
124
|
+
if prov.config.module_path.is_a?(Array) and ! prov.config.module_path.include?(module_path)
|
125
|
+
raise ErrorWrapper.new(RuntimeError.new("vagrant-r10k: module_path \"#{module_path}\" is not within the ones defined in puppet provisioner; please correct this condition"))
|
126
|
+
elsif ! prov.config.module_path.is_a?(Array) and prov.config.module_path != module_path
|
127
|
+
raise ErrorWrapper.new(RuntimeError.new("vagrant-r10k: module_path \"#{module_path}\" is not the same as in puppet provisioner; please correct this condition"))
|
128
|
+
end
|
129
|
+
# no modulepath explict set in config, build one from the provisioner config
|
130
|
+
else
|
131
|
+
module_path = prov.config.module_path.is_a?(Array) ? prov.config.module_path[0] : prov.config.module_path
|
132
|
+
# TODO - raise here instead of returning nil later
|
133
|
+
env[:ui].info "vagrant-r10k: Building the r10k module path with puppet provisioner module_path \"#{module_path}\". (if module_path is an array, first element is used)"
|
134
|
+
end
|
135
|
+
|
136
|
+
return nil if module_path.nil?
|
137
|
+
|
138
|
+
# now join the module_path with the env_dir to have an absolute path
|
139
|
+
File.join(env_dir_path, module_path)
|
140
|
+
end
|
141
|
+
|
142
|
+
# Get a Puppetfile for the specified path
|
143
|
+
#
|
144
|
+
# @param [Hash] config
|
145
|
+
#
|
146
|
+
# @return [R10K::Puppetfile]
|
147
|
+
def get_puppetfile(config)
|
148
|
+
require 'r10k/puppetfile'
|
149
|
+
R10K::Puppetfile.new(config[:puppet_dir], config[:module_path], config[:puppetfile_path])
|
150
|
+
end
|
151
|
+
|
152
|
+
# wrapper to create VagrantErrors
|
153
|
+
class ErrorWrapper < ::Vagrant::Errors::VagrantError
|
154
|
+
attr_reader :original
|
155
|
+
|
156
|
+
def initialize(original)
|
157
|
+
@original = original
|
158
|
+
end
|
159
|
+
|
160
|
+
def to_s
|
161
|
+
"#{original.class}: #{original.to_s}"
|
162
|
+
end
|
163
|
+
|
164
|
+
private
|
165
|
+
|
166
|
+
def method_missing(fun, *args, &block)
|
167
|
+
original.send(fun, *args, &block)
|
168
|
+
end
|
169
|
+
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
data/lib/vagrant-r10k/plugin.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# :nocov:
|
1
2
|
begin
|
2
3
|
require "vagrant"
|
3
4
|
rescue LoadError
|
@@ -7,9 +8,12 @@ end
|
|
7
8
|
if Vagrant::VERSION < "1.2.0"
|
8
9
|
raise "The Vagrant r10k plugin is only compatible with Vagrant 1.2+"
|
9
10
|
end
|
11
|
+
# :nocov:
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
+
require_relative "version"
|
14
|
+
require_relative "action/base"
|
15
|
+
require_relative "action/validate"
|
16
|
+
require_relative "action/deploy"
|
13
17
|
|
14
18
|
module VagrantPlugins
|
15
19
|
module R10k
|
@@ -17,9 +21,11 @@ module VagrantPlugins
|
|
17
21
|
name "vagrant-r10k"
|
18
22
|
description "Retrieve puppet modules based on a Puppetfile"
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
24
|
+
[:machine_action_up, :machine_action_reload, :machine_action_provision].each do |action|
|
25
|
+
action_hook('vagrant-r10k', action) do |hook|
|
26
|
+
hook.after(Vagrant::Action::Builtin::ConfigValidate, Action::Base.validate)
|
27
|
+
hook.before(Vagrant::Action::Builtin::Provision, Action::Base.deploy)
|
28
|
+
end
|
23
29
|
end
|
24
30
|
|
25
31
|
config "r10k" do
|
data/lib/vagrant-r10k/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
#require 'vagrant-vmware-workstation'
|
5
|
+
puts ENV
|
6
|
+
|
7
|
+
Vagrant.configure("2") do |config|
|
8
|
+
config.vm.box = "vagrantr10kspec"
|
9
|
+
config.vm.network "private_network", type: "dhcp"
|
10
|
+
|
11
|
+
# r10k plugin to deploy puppet modules
|
12
|
+
config.r10k.puppet_dir = "puppet"
|
13
|
+
config.r10k.puppetfile_path = "puppet/Puppetfile"
|
14
|
+
|
15
|
+
# Provision the machine with the appliction
|
16
|
+
config.vm.provision "puppet" do |puppet|
|
17
|
+
puppet.manifests_path = "puppet/manifests"
|
18
|
+
puppet.manifest_file = "default.pp"
|
19
|
+
puppet.module_path = "puppet/modules"
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# helper script to determine if a git clone is checked out to a
|
3
|
+
# PR, tag, or branch, and then output some information about the status
|
4
|
+
if [ $# -gt 0 ]; then
|
5
|
+
cd $1
|
6
|
+
fi
|
7
|
+
origin=$(git remote show -n origin | grep 'Fetch URL:' | awk '{print $3}')
|
8
|
+
if tmp=$(git status | grep "refs/pull/origin"); then
|
9
|
+
foo=$(echo "$tmp" | awk '{print $4}' | awk -F / '{print $4}')
|
10
|
+
echo "PR: ${foo} @ $(git rev-parse HEAD) (origin: ${origin})"
|
11
|
+
elif tagname=$(git describe --exact-match --tags $(git log -n1 --pretty='%h') 2>/dev/null); then
|
12
|
+
echo "tag: ${tagname} @ $(git rev-parse HEAD) (origin: ${origin})"
|
13
|
+
elif git symbolic-ref -q HEAD &>/dev/null; then
|
14
|
+
branch_name=$(git symbolic-ref -q HEAD)
|
15
|
+
branch_name=${branch_name##refs/heads/}
|
16
|
+
branch_name=${branch_name:-HEAD}
|
17
|
+
echo "branch: ${branch_name} @ $(git rev-parse HEAD) (origin: ${origin})"
|
18
|
+
else
|
19
|
+
echo "sha: $(git rev-parse HEAD) (origin: ${origin})"
|
20
|
+
fi
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This is currently a noop but will be supported in the future.
|
2
|
+
forge 'forge.puppetlabs.com'
|
3
|
+
|
4
|
+
# v1.0.1 -> cdb8d7a186846b49326cec1cfb4623bd77529b04
|
5
|
+
mod 'reviewboard',
|
6
|
+
:git => 'https://github.com/jantman/puppet-reviewboard.git',
|
7
|
+
:ref => 'v1.0.1'
|
8
|
+
|
9
|
+
# 0.1.0 -> 3a504b5f66ebe1853bda4ee065fce18118958d84
|
10
|
+
mod 'nodemeister',
|
11
|
+
:git => 'https://github.com/jantman/puppet-nodemeister.git',
|
12
|
+
:ref => '0.1.0'
|
@@ -0,0 +1 @@
|
|
1
|
+
notify {'vagrant-r10k puppet run': }
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
#require 'vagrant-vmware-workstation'
|
5
|
+
puts ENV
|
6
|
+
|
7
|
+
Vagrant.configure("2") do |config|
|
8
|
+
config.vm.box = "vagrantr10kspec"
|
9
|
+
config.vm.network "private_network", type: "dhcp"
|
10
|
+
|
11
|
+
# r10k plugin to deploy puppet modules
|
12
|
+
config.r10k.puppet_dir = "puppet"
|
13
|
+
config.r10k.puppetfile_path = "puppet/Puppetfile"
|
14
|
+
|
15
|
+
# Provision the machine with the appliction
|
16
|
+
config.vm.provision "puppet" do |puppet|
|
17
|
+
puppet.manifests_path = "puppet/manifests"
|
18
|
+
puppet.manifest_file = "default.pp"
|
19
|
+
puppet.module_path = "puppet/modules"
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# helper script to determine if a git clone is checked out to a
|
3
|
+
# PR, tag, or branch, and then output some information about the status
|
4
|
+
if [ $# -gt 0 ]; then
|
5
|
+
cd $1
|
6
|
+
fi
|
7
|
+
origin=$(git remote show -n origin | grep 'Fetch URL:' | awk '{print $3}')
|
8
|
+
if tmp=$(git status | grep "refs/pull/origin"); then
|
9
|
+
foo=$(echo "$tmp" | awk '{print $4}' | awk -F / '{print $4}')
|
10
|
+
echo "PR: ${foo} @ $(git rev-parse HEAD) (origin: ${origin})"
|
11
|
+
elif tagname=$(git describe --exact-match --tags $(git log -n1 --pretty='%h') 2>/dev/null); then
|
12
|
+
echo "tag: ${tagname} @ $(git rev-parse HEAD) (origin: ${origin})"
|
13
|
+
elif git symbolic-ref -q HEAD &>/dev/null; then
|
14
|
+
branch_name=$(git symbolic-ref -q HEAD)
|
15
|
+
branch_name=${branch_name##refs/heads/}
|
16
|
+
branch_name=${branch_name:-HEAD}
|
17
|
+
echo "branch: ${branch_name} @ $(git rev-parse HEAD) (origin: ${origin})"
|
18
|
+
else
|
19
|
+
echo "sha: $(git rev-parse HEAD) (origin: ${origin})"
|
20
|
+
fi
|
File without changes
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This is currently a noop but will be supported in the future.
|
2
|
+
forge 'forge.puppetlabs.com'
|
3
|
+
|
4
|
+
# v1.0.1 -> cdb8d7a186846b49326cec1cfb4623bd77529b04
|
5
|
+
mod 'reviewboard',
|
6
|
+
:git => 'https://invalidhost.jasonantman.com/jantman/puppet-reviewboard.git',
|
7
|
+
:ref => 'v1.0.1'
|
@@ -0,0 +1 @@
|
|
1
|
+
notify {'vagrant-r10k puppet run': }
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure("2") do |config|
|
5
|
+
config.vm.box = "vagrantr10kspec"
|
6
|
+
config.vm.network "private_network", type: "dhcp"
|
7
|
+
|
8
|
+
# r10k plugin to deploy puppet modules
|
9
|
+
config.r10k.puppet_dir = "puppet"
|
10
|
+
config.r10k.puppetfile_path = "puppet/Puppetfile"
|
11
|
+
config.r10k.module_path = "puppet/NOTmodules"
|
12
|
+
|
13
|
+
# Provision the machine with the appliction
|
14
|
+
config.vm.provision "puppet" do |puppet|
|
15
|
+
puppet.manifests_path = "puppet/manifests"
|
16
|
+
puppet.manifest_file = "default.pp"
|
17
|
+
puppet.module_path = "puppet/modules"
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# helper script to determine if a git clone is checked out to a
|
3
|
+
# PR, tag, or branch, and then output some information about the status
|
4
|
+
if [ $# -gt 0 ]; then
|
5
|
+
cd $1
|
6
|
+
fi
|
7
|
+
origin=$(git remote show -n origin | grep 'Fetch URL:' | awk '{print $3}')
|
8
|
+
if tmp=$(git status | grep "refs/pull/origin"); then
|
9
|
+
foo=$(echo "$tmp" | awk '{print $4}' | awk -F / '{print $4}')
|
10
|
+
echo "PR: ${foo} @ $(git rev-parse HEAD) (origin: ${origin})"
|
11
|
+
elif tagname=$(git describe --exact-match --tags $(git log -n1 --pretty='%h') 2>/dev/null); then
|
12
|
+
echo "tag: ${tagname} @ $(git rev-parse HEAD) (origin: ${origin})"
|
13
|
+
elif git symbolic-ref -q HEAD &>/dev/null; then
|
14
|
+
branch_name=$(git symbolic-ref -q HEAD)
|
15
|
+
branch_name=${branch_name##refs/heads/}
|
16
|
+
branch_name=${branch_name:-HEAD}
|
17
|
+
echo "branch: ${branch_name} @ $(git rev-parse HEAD) (origin: ${origin})"
|
18
|
+
else
|
19
|
+
echo "sha: $(git rev-parse HEAD) (origin: ${origin})"
|
20
|
+
fi
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This is currently a noop but will be supported in the future.
|
2
|
+
forge 'forge.puppetlabs.com'
|
3
|
+
|
4
|
+
# v1.0.1 -> cdb8d7a186846b49326cec1cfb4623bd77529b04
|
5
|
+
mod 'reviewboard',
|
6
|
+
:git => 'https://github.com/jantman/puppet-reviewboard.git',
|
7
|
+
:ref => 'v1.0.1'
|
8
|
+
|
9
|
+
# 0.1.0 -> 3a504b5f66ebe1853bda4ee065fce18118958d84
|
10
|
+
mod 'nodemeister',
|
11
|
+
:git => 'https://github.com/jantman/puppet-nodemeister.git',
|
12
|
+
:ref => '0.1.0'
|
@@ -0,0 +1 @@
|
|
1
|
+
notify {'vagrant-r10k puppet run': }
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant.configure("2") do |config|
|
5
|
+
config.vm.box = "vagrantr10kspec"
|
6
|
+
config.vm.network "private_network", type: "dhcp"
|
7
|
+
|
8
|
+
# r10k plugin to deploy puppet modules
|
9
|
+
config.r10k.puppet_dir = "puppet"
|
10
|
+
config.r10k.puppetfile_path = "puppet/Puppetfile"
|
11
|
+
|
12
|
+
# Provision the machine with the appliction
|
13
|
+
config.vm.provision "puppet" do |puppet|
|
14
|
+
puppet.manifests_path = "puppet/manifests"
|
15
|
+
puppet.manifest_file = "default.pp"
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
# helper script to determine if a git clone is checked out to a
|
3
|
+
# PR, tag, or branch, and then output some information about the status
|
4
|
+
if [ $# -gt 0 ]; then
|
5
|
+
cd $1
|
6
|
+
fi
|
7
|
+
origin=$(git remote show -n origin | grep 'Fetch URL:' | awk '{print $3}')
|
8
|
+
if tmp=$(git status | grep "refs/pull/origin"); then
|
9
|
+
foo=$(echo "$tmp" | awk '{print $4}' | awk -F / '{print $4}')
|
10
|
+
echo "PR: ${foo} @ $(git rev-parse HEAD) (origin: ${origin})"
|
11
|
+
elif tagname=$(git describe --exact-match --tags $(git log -n1 --pretty='%h') 2>/dev/null); then
|
12
|
+
echo "tag: ${tagname} @ $(git rev-parse HEAD) (origin: ${origin})"
|
13
|
+
elif git symbolic-ref -q HEAD &>/dev/null; then
|
14
|
+
branch_name=$(git symbolic-ref -q HEAD)
|
15
|
+
branch_name=${branch_name##refs/heads/}
|
16
|
+
branch_name=${branch_name:-HEAD}
|
17
|
+
echo "branch: ${branch_name} @ $(git rev-parse HEAD) (origin: ${origin})"
|
18
|
+
else
|
19
|
+
echo "sha: $(git rev-parse HEAD) (origin: ${origin})"
|
20
|
+
fi
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This is currently a noop but will be supported in the future.
|
2
|
+
forge 'forge.puppetlabs.com'
|
3
|
+
|
4
|
+
# v1.0.1 -> cdb8d7a186846b49326cec1cfb4623bd77529b04
|
5
|
+
mod 'reviewboard',
|
6
|
+
:git => 'https://github.com/jantman/puppet-reviewboard.git',
|
7
|
+
:ref => 'v1.0.1'
|
8
|
+
|
9
|
+
# 0.1.0 -> 3a504b5f66ebe1853bda4ee065fce18118958d84
|
10
|
+
mod 'nodemeister',
|
11
|
+
:git => 'https://github.com/jantman/puppet-nodemeister.git',
|
12
|
+
:ref => '0.1.0'
|
@@ -0,0 +1 @@
|
|
1
|
+
notify {'vagrant-r10k puppet run': }
|
File without changes
|