kitchen-chef-extended-attributes 0.1.0 → 0.2.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/CHANGELOG.md +7 -1
- data/README.md +1 -0
- data/lib/kitchen/provisioner/chef_extended_attributes.rb +2 -1
- data/test/cookbooks/extended_attributes_test/files/default/test/clearingattributes_test.rb +10 -0
- data/test/cookbooks/extended_attributes_test/files/default/test/kitchenmerged_test.rb +1 -0
- data/test/cookbooks/extended_attributes_test/files/default/test/kitchenoverride_test.rb +1 -1
- data/test/cookbooks/extended_attributes_test/recipes/clearingattributes.rb +1 -0
- data/test/nodes/clearingattributes.json +5 -0
- data/test/nodes/kitchenoverride.json +4 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e286ac2af2db2c43d020910a5648a8632c8d524
|
4
|
+
data.tar.gz: f84ac1bfa62d9fd01840948230c880179f8b676f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34488a38b31b9dc598a920993201c890c875f4aa87bae4f692e3c469a617325b5b731a51e190f7750b3626ab86dcdefb4c2c87db9212250d9b976e1141c3b013
|
7
|
+
data.tar.gz: aa087e40fae73064e86b5329a28ac1ab29d003fe00229a13bfd2810a2efa8f944dc18c5cfe8547dbfbd8034c9bd85511884ec051893e59cd031c4996285f6aed
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# kitchen-chef-extended-attributes
|
2
2
|
|
3
|
-
## v0.
|
3
|
+
## v0.2.0 (2015-02-12)
|
4
|
+
|
5
|
+
Bugfixes:
|
6
|
+
|
7
|
+
* Corrected an important issue with merging attributes not correctly merging symbol and string keys together, creating duplicate keys in the JSON
|
8
|
+
|
9
|
+
## v0.1.0 (2015-02-09)
|
4
10
|
|
5
11
|
Initial release of extension - provides overwrite and merge of JSON files
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://circleci.com/gh/jeremyolliver/kitchen-chef-extended-attributes)
|
4
4
|
[](https://codeclimate.com/github/jeremyolliver/kitchen-chef-extended-attributes)
|
5
|
+
[](http://badge.fury.io/rb/kitchen-chef-extended-attributes)
|
5
6
|
|
6
7
|
## Use Case
|
7
8
|
|
@@ -31,7 +31,8 @@ module Kitchen
|
|
31
31
|
info("merging #{instance.suite.name}.json and kitchen attributes")
|
32
32
|
|
33
33
|
custom_json = JSON.parse(File.read(source_file))
|
34
|
-
|
34
|
+
kitchen_attrs = Kitchen::Util.stringified_hash(config[:attributes])
|
35
|
+
merged_json = custom_json.merge(kitchen_attrs)
|
35
36
|
merged_json['run_list'] ||= []
|
36
37
|
merged_json['run_list'] += (config[:run_list] || [])
|
37
38
|
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'minitest/spec'
|
2
|
+
|
3
|
+
describe_recipe 'extended_attributes_test::clearingattributes' do
|
4
|
+
it 'should not have the license key present' do
|
5
|
+
file('/tmp/kitchen/dna.json').wont_match 'defaultkey'
|
6
|
+
merged_json_data = JSON.parse(File.read('/tmp/kitchen/dna.json'))
|
7
|
+
merged_json_data.keys.sort.must_equal ['run_list', 'service']
|
8
|
+
merged_json_data['service'].must_equal({'license_key' => nil})
|
9
|
+
end
|
10
|
+
end
|
@@ -4,6 +4,7 @@ describe_recipe 'extended_attributes_test::kitchenmerged' do
|
|
4
4
|
it 'should give higher precendence to attributes in kitchen.yml' do
|
5
5
|
merged_json_data = JSON.parse(File.read('/tmp/kitchen/dna.json'))
|
6
6
|
merged_json_data['valuefromdna'].must_equal 'overridden'
|
7
|
+
merged_json_data.keys.sort.must_equal ['run_list', 'valuefromdna']
|
7
8
|
end
|
8
9
|
|
9
10
|
it 'should include run_list items from dna JSON file' do
|
@@ -2,7 +2,7 @@ require 'minitest/spec'
|
|
2
2
|
|
3
3
|
describe_recipe 'extended_attributes_test::kitchenoverride' do
|
4
4
|
it 'should not contain attributes from kitchen.yml' do
|
5
|
-
file('/tmp/kitchen/dna.json').
|
5
|
+
file('/tmp/kitchen/dna.json').wont_match 'shouldnevershowup'
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'should include attributes from dna JSON file' do
|
@@ -0,0 +1 @@
|
|
1
|
+
include_recipe 'minitest-handler'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-chef-extended-attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Olliver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|
@@ -81,13 +81,16 @@ files:
|
|
81
81
|
- LICENSE.txt
|
82
82
|
- README.md
|
83
83
|
- CHANGELOG.md
|
84
|
+
- test/cookbooks/extended_attributes_test/files/default/test/clearingattributes_test.rb
|
84
85
|
- test/cookbooks/extended_attributes_test/files/default/test/default_test.rb
|
85
86
|
- test/cookbooks/extended_attributes_test/files/default/test/kitchenmerged_test.rb
|
86
87
|
- test/cookbooks/extended_attributes_test/files/default/test/kitchenoverride_test.rb
|
87
88
|
- test/cookbooks/extended_attributes_test/metadata.rb
|
89
|
+
- test/cookbooks/extended_attributes_test/recipes/clearingattributes.rb
|
88
90
|
- test/cookbooks/extended_attributes_test/recipes/default.rb
|
89
91
|
- test/cookbooks/extended_attributes_test/recipes/kitchenmerged.rb
|
90
92
|
- test/cookbooks/extended_attributes_test/recipes/kitchenoverride.rb
|
93
|
+
- test/nodes/clearingattributes.json
|
91
94
|
- test/nodes/default.json
|
92
95
|
- test/nodes/kitchenmerged.json
|
93
96
|
- test/nodes/kitchenoverride.json
|
@@ -116,13 +119,16 @@ signing_key:
|
|
116
119
|
specification_version: 4
|
117
120
|
summary: test-kitchen chef-solo integrated with dna.json files from your repo
|
118
121
|
test_files:
|
122
|
+
- test/cookbooks/extended_attributes_test/files/default/test/clearingattributes_test.rb
|
119
123
|
- test/cookbooks/extended_attributes_test/files/default/test/default_test.rb
|
120
124
|
- test/cookbooks/extended_attributes_test/files/default/test/kitchenmerged_test.rb
|
121
125
|
- test/cookbooks/extended_attributes_test/files/default/test/kitchenoverride_test.rb
|
122
126
|
- test/cookbooks/extended_attributes_test/metadata.rb
|
127
|
+
- test/cookbooks/extended_attributes_test/recipes/clearingattributes.rb
|
123
128
|
- test/cookbooks/extended_attributes_test/recipes/default.rb
|
124
129
|
- test/cookbooks/extended_attributes_test/recipes/kitchenmerged.rb
|
125
130
|
- test/cookbooks/extended_attributes_test/recipes/kitchenoverride.rb
|
131
|
+
- test/nodes/clearingattributes.json
|
126
132
|
- test/nodes/default.json
|
127
133
|
- test/nodes/kitchenmerged.json
|
128
134
|
- test/nodes/kitchenoverride.json
|