kitchen-puppet 0.0.16 → 0.0.17
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.
- data/kitchen-puppet.gemspec +29 -29
- data/lib/kitchen/provisioner/puppet/librarian.rb +78 -83
- data/lib/kitchen/provisioner/puppet_agent.rb +218 -223
- data/lib/kitchen/provisioner/puppet_apply.rb +393 -390
- data/lib/kitchen/provisioner/puppet_apply_spec.rb +33 -33
- data/lib/kitchen-puppet/version.rb +7 -5
- data/provisioner_options.md +160 -159
- metadata +2 -2
data/kitchen-puppet.gemspec
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
|
4
|
-
require 'kitchen-puppet/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = Kitchen::Puppet::VERSION
|
9
|
-
s.authors = [
|
10
|
-
s.email = [
|
11
|
-
s.homepage =
|
12
|
-
s.summary =
|
13
|
-
candidates = Dir.glob(
|
14
|
-
s.files = candidates.sort
|
15
|
-
s.platform = Gem::Platform::RUBY
|
16
|
-
s.require_paths = ['lib']
|
17
|
-
s.rubyforge_project = '[none]'
|
18
|
-
s.description = <<-EOF
|
19
|
-
== DESCRIPTION:
|
20
|
-
|
21
|
-
Puppet Provisioner for Test Kitchen
|
22
|
-
|
23
|
-
== FEATURES:
|
24
|
-
|
25
|
-
Supports puppet apply, puppet agent, hiera, hiera-eyaml, custom facts, librarian-puppet
|
26
|
-
|
27
|
-
EOF
|
28
|
-
|
29
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
4
|
+
require 'kitchen-puppet/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'kitchen-puppet'
|
8
|
+
s.version = Kitchen::Puppet::VERSION
|
9
|
+
s.authors = ['Neill Turner']
|
10
|
+
s.email = ['neillwturner@gmail.com']
|
11
|
+
s.homepage = 'https://github.com/neillturner/kitchen-puppet'
|
12
|
+
s.summary = 'puppet provisioner for test-kitchen'
|
13
|
+
candidates = Dir.glob('{lib}/**/*') + ['README.md', 'provisioner_options.md', 'kitchen-puppet.gemspec']
|
14
|
+
s.files = candidates.sort
|
15
|
+
s.platform = Gem::Platform::RUBY
|
16
|
+
s.require_paths = ['lib']
|
17
|
+
s.rubyforge_project = '[none]'
|
18
|
+
s.description = <<-EOF
|
19
|
+
== DESCRIPTION:
|
20
|
+
|
21
|
+
Puppet Provisioner for Test Kitchen
|
22
|
+
|
23
|
+
== FEATURES:
|
24
|
+
|
25
|
+
Supports puppet apply, puppet agent, hiera, hiera-eyaml, custom facts, librarian-puppet
|
26
|
+
|
27
|
+
EOF
|
28
|
+
|
29
|
+
end
|
@@ -1,83 +1,78 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Author:: Fletcher Nichol (<fnichol@nichol.ca>) Neill Turner (<neillwturner@gmail.com>)
|
4
|
-
#
|
5
|
-
# Copyright (C) 2013, Fletcher Nichol, Neill Turner
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
|
19
|
-
require 'kitchen/errors'
|
20
|
-
require 'kitchen/logging'
|
21
|
-
|
22
|
-
module Kitchen
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Fletcher Nichol (<fnichol@nichol.ca>) Neill Turner (<neillwturner@gmail.com>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2013, Fletcher Nichol, Neill Turner
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
|
19
|
+
require 'kitchen/errors'
|
20
|
+
require 'kitchen/logging'
|
21
|
+
|
22
|
+
module Kitchen
|
23
|
+
module Provisioner
|
24
|
+
module Puppet
|
25
|
+
# Puppet module resolver that uses Librarian-Puppet and a Puppetfile to
|
26
|
+
# calculate # dependencies.
|
27
|
+
#
|
28
|
+
class Librarian
|
29
|
+
include Logging
|
30
|
+
|
31
|
+
def initialize(puppetfile, path, logger = Kitchen.logger)
|
32
|
+
@puppetfile = puppetfile
|
33
|
+
@path = path
|
34
|
+
@logger = logger
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.load!(logger = Kitchen.logger)
|
38
|
+
load_librarian!(logger)
|
39
|
+
end
|
40
|
+
|
41
|
+
def resolve
|
42
|
+
version = ::Librarian::Puppet::VERSION
|
43
|
+
info("Resolving module dependencies with Librarian-Puppet #{version}...")
|
44
|
+
debug("Using Puppetfile from #{puppetfile}")
|
45
|
+
|
46
|
+
env = ::Librarian::Puppet::Environment.new(
|
47
|
+
project_path: File.dirname(puppetfile))
|
48
|
+
env.config_db.local['path'] = path
|
49
|
+
::Librarian::Action::Resolve.new(env).run
|
50
|
+
::Librarian::Action::Install.new(env).run
|
51
|
+
end
|
52
|
+
|
53
|
+
attr_reader :puppetfile, :path, :logger
|
54
|
+
|
55
|
+
def self.load_librarian!(logger)
|
56
|
+
first_load = require 'librarian/puppet'
|
57
|
+
require 'librarian/puppet/environment'
|
58
|
+
require 'librarian/action/resolve'
|
59
|
+
require 'librarian/action/install'
|
60
|
+
|
61
|
+
version = ::Librarian::Puppet::VERSION
|
62
|
+
if first_load
|
63
|
+
logger.debug("Librarian-Puppet #{version} library loaded")
|
64
|
+
else
|
65
|
+
logger.debug("Librarian-Puppet #{version} previously loaded")
|
66
|
+
end
|
67
|
+
rescue LoadError => e
|
68
|
+
logger.fatal("The `librarian-puppet' gem is missing and must be installed" \
|
69
|
+
' or cannot be properly activated. Run' \
|
70
|
+
' `gem install librarian-puppet` or add the following to your' \
|
71
|
+
" Gemfile if you are using Bundler: `gem 'librarian-puppet'`.")
|
72
|
+
raise UserError,
|
73
|
+
"Could not load or activate Librarian-Puppet (#{e.message})"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|