kitchen-chef_zero_berks_env 0.0.1 → 1.0.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f606d23cba1fa31d168cbccf375d367e7443fd04
|
|
4
|
+
data.tar.gz: b297ce4e8f2a5a707fab565a5bf89eb63bac4422
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12ca5700a66cb6244b9ffddb8887ab1ca75308a918ae9857bf8a697ddba40009aea3d7c6a2eab521837524291815f5762f00c07edc586a1f460749c59710faa9
|
|
7
|
+
data.tar.gz: a0fd9421e62f51ca709c82ddf87f049d1525e832f2a2af863e76c9ef937f31419251538396b9abee0cf969a9062ddb576676e8dac7139979dcbb149244d03f9e
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
1
|
# kitchen-chef_zero_berks_env
|
|
2
2
|
|
|
3
|
+
[](http://badge.fury.io/rb/kitchen-chef_zero_berks_env)
|
|
4
|
+
[](https://rubygems.org/gems/kitchen-chef_zero_berks_env)
|
|
5
|
+
[](https://travis-ci.org/ruizink/kitchen-chef_zero_berks_env)
|
|
6
|
+
|
|
3
7
|
Chef Zero provider for Test Kitchen that enables Berkshelf to vendor the cookbook versions specified by a given chef environment.
|
|
8
|
+
|
|
9
|
+
## Use Case
|
|
10
|
+
|
|
11
|
+
If you adopted the pattern of pinning cookbooks per chef environment, and still want to use Berkshelf and Test Kitchen on your workflow,
|
|
12
|
+
this provider extension enables Berkshelf to build a lock file based on a given chef environment, respecting the cookbook version dependencies.
|
|
13
|
+
The default behaviour of the Chef providers is to first gather the cookbook dependencies using Berkshelf vendor and then run Chef on the box.
|
|
14
|
+
Well, if you don't pin the cookbook version dependencies within the cookbooks, Berkshelf will end up vendoring allways the latest versions.
|
|
15
|
+
That might conflict with cookbook restrictions that you have defined within the chef environment, and the converge will fail.
|
|
16
|
+
Hopefuly this provider will do the trick!
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
Simply replace the provider from `chef_zero` to `chef_zero_berks_env`.
|
|
21
|
+
The provider will look for the `environments_path` and `environment` configs from the provider.
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
```yaml
|
|
26
|
+
provisioner:
|
|
27
|
+
name: chef_zero_berks_env
|
|
28
|
+
environments_path: 'environments'
|
|
29
|
+
|
|
30
|
+
suites:
|
|
31
|
+
- name: default
|
|
32
|
+
provisioner:
|
|
33
|
+
client_rb:
|
|
34
|
+
environment: 'my_chef_environment'
|
|
35
|
+
```
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
# -*-
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
2
|
|
|
3
|
-
require
|
|
3
|
+
require 'kitchen/provisioner/chef_zero'
|
|
4
4
|
|
|
5
5
|
module Kitchen
|
|
6
|
-
|
|
7
6
|
module Provisioner
|
|
8
|
-
|
|
9
|
-
#
|
|
7
|
+
# Tweaked Chef Zero provisioner that enables Berkshelf to load
|
|
8
|
+
# cookbook restrictions from Chef environments.
|
|
10
9
|
#
|
|
11
|
-
# @author
|
|
10
|
+
# @author Mario Santos <mario.rf.santos@gmail.com>
|
|
12
11
|
class ChefZeroBerksEnv < ChefZero
|
|
13
|
-
|
|
14
12
|
# Performs a Berkshelf cookbook resolution inside a common mutex.
|
|
15
13
|
#
|
|
16
14
|
# @api private
|
|
17
15
|
def resolve_with_berkshelf
|
|
18
|
-
|
|
19
16
|
# Load Berksfile
|
|
20
17
|
berks = ::Berkshelf::Berksfile.from_file(berksfile)
|
|
21
18
|
|
|
@@ -32,10 +29,10 @@ module Kitchen
|
|
|
32
29
|
info("Resolving dependency graph with Berkshelf #{::Berkshelf::VERSION}...")
|
|
33
30
|
berks.install
|
|
34
31
|
info("Locking the versions fetched from the chef environment '#{chef_environment}'...")
|
|
35
|
-
unless environment_json[
|
|
36
|
-
berks.lockfile.graph.each do |
|
|
37
|
-
version = environment_json[
|
|
38
|
-
unless version.nil?
|
|
32
|
+
unless environment_json['cookbook_versions'].nil?
|
|
33
|
+
berks.lockfile.graph.each do |graphitem|
|
|
34
|
+
version = environment_json['cookbook_versions'][graphitem.name]
|
|
35
|
+
unless version.nil? || berks.has_dependency?(graphitem.name)
|
|
39
36
|
info("Adding Berkshelf dependency: #{graphitem.name} (#{version})")
|
|
40
37
|
berks.add_dependency(graphitem.name, version)
|
|
41
38
|
end
|
|
@@ -58,7 +55,7 @@ module Kitchen
|
|
|
58
55
|
FileUtils.rm_rf(tmpbooks_dir)
|
|
59
56
|
berks.vendor(tmpbooks_dir)
|
|
60
57
|
else
|
|
61
|
-
berks.install(
|
|
58
|
+
berks.install(path => tmpbooks_dir)
|
|
62
59
|
end
|
|
63
60
|
end
|
|
64
61
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kitchen-chef_zero_berks_env
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mário Santos
|
|
@@ -52,10 +52,11 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '3.2'
|
|
55
|
-
description:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
description: |2
|
|
56
|
+
Plugin for test-kitchen that extends the chef_zero provisioner allowing
|
|
57
|
+
berkshelf to use cookbook restrictions loaded from chef environment files.
|
|
58
|
+
This way, Berkshelf will allways vendor the cookbook versions specified
|
|
59
|
+
in the chef environment.
|
|
59
60
|
email:
|
|
60
61
|
- mario.rf.santos@gmail.com
|
|
61
62
|
executables: []
|
|
@@ -65,8 +66,8 @@ files:
|
|
|
65
66
|
- CHANGELOG.md
|
|
66
67
|
- LICENSE
|
|
67
68
|
- README.md
|
|
68
|
-
- lib/kitchen-chef_zero_berks_env.rb
|
|
69
69
|
- lib/kitchen/provisioner/chef_zero_berks_env.rb
|
|
70
|
+
- lib/kitchen_chef_zero_berks_env.rb
|
|
70
71
|
homepage: https://github.com/ruizink/kitchen-chef_zero_berks_env
|
|
71
72
|
licenses:
|
|
72
73
|
- MIT
|