kitchen-puppet 3.3.2 → 3.4.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 +4 -4
- data/lib/kitchen-puppet/version.rb +1 -1
- data/lib/kitchen/provisioner/puppet/r10k.rb +73 -0
- data/lib/kitchen/provisioner/puppet_apply.rb +27 -4
- data/provisioner_options.md +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: df14da642855ea0a839df2f8ad0cdc4792f8c2b9
|
|
4
|
+
data.tar.gz: aa9ae40146325dbbcd971fa3386d2ee2254964e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 84b81095921b8eb7468aff290085afb48be1b7f58d3f752934ede4d6d3f933717b9ef4dc96ba08c0839b05f1eb3595664b4728d4bc3a5ff6ac24402d1c9fbf74
|
|
7
|
+
data.tar.gz: a03e2f07fc71aab142738ccba3d90f7eab350be33a474a95b3d98ab6fc624a280a0ef8684eb559a5a843dbbe748c8197f2968aa506ba986c19304535769fe866
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# Author:: Fletcher Nichol (<fnichol@nichol.ca>) Neill Turner (<neillwturner@gmail.com>) Dennis Lerch (<dennis.lerch@transporeon.com>)
|
|
5
|
+
#
|
|
6
|
+
# Copyright (C) 2018, Fletcher Nichol, Neill Turner, Dennis Lerch
|
|
7
|
+
#
|
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
# you may not use this file except in compliance with the License.
|
|
10
|
+
# You may obtain a copy of the License at
|
|
11
|
+
#
|
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
#
|
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
# See the License for the specific language governing permissions and
|
|
18
|
+
# limitations under the License.
|
|
19
|
+
|
|
20
|
+
require 'kitchen/errors'
|
|
21
|
+
require 'kitchen/logging'
|
|
22
|
+
|
|
23
|
+
module Kitchen
|
|
24
|
+
module Provisioner
|
|
25
|
+
module Puppet
|
|
26
|
+
# Puppet module resolver that uses R10K and a Puppetfile to
|
|
27
|
+
# calculate # dependencies.
|
|
28
|
+
#
|
|
29
|
+
class R10K
|
|
30
|
+
include Logging
|
|
31
|
+
|
|
32
|
+
def initialize(puppetfile, path, logger = Kitchen.logger)
|
|
33
|
+
@puppetfile = puppetfile
|
|
34
|
+
@path = path
|
|
35
|
+
@logger = logger
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.load!(logger = Kitchen.logger)
|
|
39
|
+
load_r10k!(logger)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def resolve
|
|
43
|
+
version = ::R10K::VERSION
|
|
44
|
+
info("Resolving module dependencies with R10K-Puppet #{version}...")
|
|
45
|
+
debug("Using Puppetfile from #{puppetfile}")
|
|
46
|
+
|
|
47
|
+
::R10K::Git::Cache.settings[:cache_root] = '.r10k/git'
|
|
48
|
+
::R10K::Forge::ModuleRelease.settings[:cache_root] = '.r10k/cache'
|
|
49
|
+
|
|
50
|
+
pf = ::R10K::Puppetfile.new(nil, path, puppetfile)
|
|
51
|
+
pf.load
|
|
52
|
+
pf.modules.map(&:sync)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
attr_reader :puppetfile, :path, :logger
|
|
56
|
+
|
|
57
|
+
def self.load_r10k!(logger)
|
|
58
|
+
require 'r10k/puppetfile'
|
|
59
|
+
|
|
60
|
+
version = ::R10K::VERSION
|
|
61
|
+
logger.debug("R10K #{version} library loaded")
|
|
62
|
+
rescue LoadError => e
|
|
63
|
+
logger.fatal("The `r10k' gem is missing and must be installed" \
|
|
64
|
+
' or cannot be properly activated. Run' \
|
|
65
|
+
' `gem install r10k` or add the following to your' \
|
|
66
|
+
" Gemfile if you are using Bundler: `gem 'r10k'`.")
|
|
67
|
+
raise UserError,
|
|
68
|
+
"Could not load or activate R10K (#{e.message})"
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
require 'uri'
|
|
25
25
|
require 'json'
|
|
26
26
|
require 'kitchen'
|
|
27
|
-
require 'kitchen/provisioner/puppet/librarian'
|
|
28
27
|
|
|
29
28
|
module Kitchen
|
|
30
29
|
class Busser
|
|
@@ -59,6 +58,7 @@ module Kitchen
|
|
|
59
58
|
default_config :require_puppet_repo, true
|
|
60
59
|
default_config :require_chef_for_busser, true
|
|
61
60
|
default_config :resolve_with_librarian_puppet, true
|
|
61
|
+
default_config :resolve_with_r10k, false
|
|
62
62
|
default_config :puppet_environment, nil
|
|
63
63
|
default_config :puppet_environment_config_path do |provisioner|
|
|
64
64
|
provisioner.calculate_path('environment.conf')
|
|
@@ -165,6 +165,7 @@ module Kitchen
|
|
|
165
165
|
default_config :puppet_detailed_exitcodes, nil
|
|
166
166
|
default_config :facter_file, nil
|
|
167
167
|
default_config :librarian_puppet_ssl_file, nil
|
|
168
|
+
default_config :r10k_ssl_file, nil
|
|
168
169
|
|
|
169
170
|
default_config :hiera_eyaml, false
|
|
170
171
|
default_config :hiera_eyaml_key_remote_path, '/etc/puppet/secure/keys'
|
|
@@ -758,9 +759,16 @@ module Kitchen
|
|
|
758
759
|
|
|
759
760
|
def load_needed_dependencies!
|
|
760
761
|
return unless File.exist?(puppetfile)
|
|
761
|
-
return unless config[:resolve_with_librarian_puppet]
|
|
762
|
-
|
|
763
|
-
|
|
762
|
+
return unless config[:resolve_with_librarian_puppet] || config[:resolve_with_r10k]
|
|
763
|
+
if config[:resolve_with_librarian_puppet]
|
|
764
|
+
require 'kitchen/provisioner/puppet/librarian'
|
|
765
|
+
debug("Puppetfile found at #{puppetfile}, loading Librarian-Puppet")
|
|
766
|
+
Puppet::Librarian.load!(logger)
|
|
767
|
+
elsif config[:resolve_with_r10k]
|
|
768
|
+
require 'kitchen/provisioner/puppet/r10k'
|
|
769
|
+
debug("Puppetfile found at #{puppetfile}, loading R10K")
|
|
770
|
+
Puppet::R10K.load!(logger)
|
|
771
|
+
end
|
|
764
772
|
end
|
|
765
773
|
|
|
766
774
|
def tmpmodules_dir
|
|
@@ -900,6 +908,10 @@ module Kitchen
|
|
|
900
908
|
config[:librarian_puppet_ssl_file]
|
|
901
909
|
end
|
|
902
910
|
|
|
911
|
+
def r10k_ssl_file
|
|
912
|
+
config[:r10k_puppet_ssl_file] || config[:librarian_puppet_ssl_file]
|
|
913
|
+
end
|
|
914
|
+
|
|
903
915
|
def puppet_cmd
|
|
904
916
|
return '& "C:\Program Files\Puppet Labs\Puppet\bin\puppet"' if powershell?
|
|
905
917
|
|
|
@@ -1259,6 +1271,7 @@ module Kitchen
|
|
|
1259
1271
|
|
|
1260
1272
|
FileUtils.mkdir_p(tmpmodules_dir)
|
|
1261
1273
|
resolve_with_librarian if File.exist?(puppetfile) && config[:resolve_with_librarian_puppet]
|
|
1274
|
+
resolve_with_r10k if File.exist?(puppetfile) && config[:resolve_with_r10k] && !config[:resolve_with_librarian_puppet]
|
|
1262
1275
|
modules_to_copy = {}
|
|
1263
1276
|
|
|
1264
1277
|
# If root dir (.) is a module, add it for copying
|
|
@@ -1408,6 +1421,7 @@ module Kitchen
|
|
|
1408
1421
|
end
|
|
1409
1422
|
|
|
1410
1423
|
def resolve_with_librarian
|
|
1424
|
+
require 'kitchen/provisioner/puppet/librarian'
|
|
1411
1425
|
Kitchen.mutex.synchronize do
|
|
1412
1426
|
ENV['SSL_CERT_FILE'] = librarian_puppet_ssl_file if librarian_puppet_ssl_file
|
|
1413
1427
|
Puppet::Librarian.new(puppetfile, tmpmodules_dir, logger).resolve
|
|
@@ -1415,6 +1429,15 @@ module Kitchen
|
|
|
1415
1429
|
end
|
|
1416
1430
|
end
|
|
1417
1431
|
|
|
1432
|
+
def resolve_with_r10k
|
|
1433
|
+
require 'kitchen/provisioner/puppet/r10k'
|
|
1434
|
+
Kitchen.mutex.synchronize do
|
|
1435
|
+
ENV['SSL_CERT_FILE'] = r10k_ssl_file if r10k_ssl_file
|
|
1436
|
+
Puppet::R10K.new(puppetfile, tmpmodules_dir, logger).resolve
|
|
1437
|
+
ENV['SSL_CERT_FILE'] = '' if r10k_ssl_file
|
|
1438
|
+
end
|
|
1439
|
+
end
|
|
1440
|
+
|
|
1418
1441
|
def cp_command
|
|
1419
1442
|
return 'cp -force' if powershell?
|
|
1420
1443
|
'cp'
|
data/provisioner_options.md
CHANGED
|
@@ -59,6 +59,7 @@ ignore_spec_fixtures | false | don't copy spec/fixtures to avoid problems with s
|
|
|
59
59
|
install_custom_facts| false | Install custom facts to yaml file at "/tmp/kitchen/facter/kitchen.rb"
|
|
60
60
|
install_hiera | false | Installs `hiera-puppet` package. Not needed for puppet > 3.x.x
|
|
61
61
|
librarian_puppet_ssl_file | nil | ssl certificate file for librarian-puppet
|
|
62
|
+
r10k_ssl_file | nil | ssl certificate file for r10k
|
|
62
63
|
manifest | puppet parses every .pp file in the manifests_path directory and its subdirectories | manifest(s) for puppet apply to run. If set to a file like 'site.pp' it will use the file in the mainfests_path.
|
|
63
64
|
manifests_path | 'mainfests' | puppet repo manifests directory
|
|
64
65
|
max_retries| 1 | maximum number of retry attempts of converge command
|
|
@@ -110,6 +111,7 @@ require_puppet_collections | true | Set if using puppet collections install (Pup
|
|
|
110
111
|
require_puppet_omnibus | false | Set if using omnibus puppet install
|
|
111
112
|
require_puppet_repo | true | Set if using a puppet install from yum or apt repo
|
|
112
113
|
resolve_with_librarian_puppet | true | Use librarian_puppet to resolve modules if a Puppetfile is found
|
|
114
|
+
resolve_with_r10k | true | Use r10k to resolve modules if a Puppetfile is found
|
|
113
115
|
retry_on_exit_code| [] | Array of exit codes to retry converge command against
|
|
114
116
|
update_package_repos| true| update OS repository metadata
|
|
115
117
|
wait_for_retry| 30 | number of seconds to wait before retrying converge command
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kitchen-puppet
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Neill Turner
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-08-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: net-ssh
|
|
@@ -57,6 +57,7 @@ files:
|
|
|
57
57
|
- kitchen-puppet.gemspec
|
|
58
58
|
- lib/kitchen-puppet/version.rb
|
|
59
59
|
- lib/kitchen/provisioner/puppet/librarian.rb
|
|
60
|
+
- lib/kitchen/provisioner/puppet/r10k.rb
|
|
60
61
|
- lib/kitchen/provisioner/puppet_agent.rb
|
|
61
62
|
- lib/kitchen/provisioner/puppet_apply.rb
|
|
62
63
|
- lib/kitchen/provisioner/puppet_bolt.rb
|