chef-sugar 1.2.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/CHANGELOG.md +5 -1
- data/lib/chef/sugar/data_bag.rb +7 -8
- data/lib/chef/sugar/version.rb +1 -1
- data/metadata.rb +11 -2
- data/spec/unit/chef/sugar/data_bag_spec.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5674537c266d05abd9f17e9b069f904945e12b7
|
4
|
+
data.tar.gz: b6f26132d9c4e1ee9fd99e7c5437e45bb884c4ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e45cf63cba7efb2305fa499475f2e176135354cc157b39efb11ccf332bc8bb5df863e15785cad7c9ca8ca189778bcf9e8d95fcc1692201d08da417797c60ced
|
7
|
+
data.tar.gz: 5e8ba58f52af37590e283e49a1fdab8cde85a404b25e4fd1c481d46518b9532e9367225a47138c7ee70ec5e658939fa17182f948482d1ef072dee0bb1ddcc3d0
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,12 +2,16 @@ Chef Sugar Changelog
|
|
2
2
|
=========================
|
3
3
|
This file is used to list changes made in each version of the chef-sugar cookbook and gem.
|
4
4
|
|
5
|
+
v1.2.2 (2014-03-13)
|
6
|
+
-------------------
|
7
|
+
- Fix a critical bug with `encrypted_data_bag_item` using the wrong key
|
8
|
+
|
5
9
|
v1.2.0 (2014-03-09)
|
6
10
|
-------------------
|
7
11
|
- Add `namespace` functionality for specifying attributes in a DSL
|
8
12
|
- Add constraints helpers for comparing version strings
|
9
13
|
- Add `require_chef_gem` to safely require and degrade if a gem is not installed
|
10
|
-
- Add `deep_fetch` and `deep_fetch
|
14
|
+
- Add `deep_fetch` and `deep_fetch!` to fetch deeply nested keys
|
11
15
|
- Accept an optional secret key in `encrypted_data_bag_item` helper and raise a helpful error if one is not set (NOTE: this changes the airity of the method, but it's backward-compatible because Ruby is magic)
|
12
16
|
- Add Stove for releasing
|
13
17
|
- Updated copyrights for 2014
|
data/lib/chef/sugar/data_bag.rb
CHANGED
@@ -42,20 +42,19 @@ EOH
|
|
42
42
|
# @param [String] id
|
43
43
|
# the id of the encrypted data bag
|
44
44
|
# @param [String] secret
|
45
|
-
# the encrypted data bag secret
|
45
|
+
# the encrypted data bag secret raw value
|
46
46
|
#
|
47
47
|
# @return [Hash]
|
48
48
|
#
|
49
49
|
def encrypted_data_bag_item(bag, id, secret = nil)
|
50
50
|
Chef::Log.debug "Loading encrypted data bag item #{bag}/#{id}"
|
51
51
|
|
52
|
-
secret
|
53
|
-
|
54
|
-
if secret
|
55
|
-
Chef::EncryptedDataBagItem.load(bag, id, secret)
|
56
|
-
else
|
52
|
+
if secret.nil? && Chef::Config[:encrypted_data_bag_secret].nil?
|
57
53
|
raise EncryptedDataBagSecretNotGiven.new
|
58
54
|
end
|
55
|
+
|
56
|
+
secret ||= File.read(Chef::Config[:encrypted_data_bag_secret])
|
57
|
+
Chef::EncryptedDataBagItem.load(bag, id, secret)
|
59
58
|
end
|
60
59
|
|
61
60
|
#
|
@@ -95,12 +94,12 @@ EOH
|
|
95
94
|
end
|
96
95
|
|
97
96
|
module DSL
|
98
|
-
# @see Chef::Sugar::DataBag#encrypted_data_bag_item
|
97
|
+
# @see Chef::Sugar::DataBag#encrypted_data_bag_item
|
99
98
|
def encrypted_data_bag_item(bag, id, secret = nil)
|
100
99
|
Chef::Sugar::DataBag.encrypted_data_bag_item(bag, id, secret)
|
101
100
|
end
|
102
101
|
|
103
|
-
# @see Chef::Sugar::DataBag#encrypted_data_bag_item_for_environment
|
102
|
+
# @see Chef::Sugar::DataBag#encrypted_data_bag_item_for_environment
|
104
103
|
def encrypted_data_bag_item_for_environment(bag, id, secret = nil)
|
105
104
|
Chef::Sugar::DataBag.encrypted_data_bag_item_for_environment(node, bag, id, secret)
|
106
105
|
end
|
data/lib/chef/sugar/version.rb
CHANGED
data/metadata.rb
CHANGED
@@ -4,5 +4,14 @@ maintainer_email 'sethvargo@gmail.com'
|
|
4
4
|
license 'Apache 2.0'
|
5
5
|
description 'Installs chef-sugar. Please see the chef-sugar ' \
|
6
6
|
'Ruby gem for more information.'
|
7
|
-
long_description
|
8
|
-
|
7
|
+
long_description <<-EOH
|
8
|
+
Chef Sugar is a Gem & Chef Recipe that includes series of helpful syntactic
|
9
|
+
sugars on top of the Chef core and other resources to make a cleaner, more lean
|
10
|
+
recipe DSL, enforce DRY principles, and make writing Chef recipes an awesome and
|
11
|
+
fun experience!
|
12
|
+
|
13
|
+
For the most up-to-date information and documentation, please visit the [Chef
|
14
|
+
Sugar project page on GitHub](https://github.com/sethvargo/chef-sugar).
|
15
|
+
EOH
|
16
|
+
|
17
|
+
version '1.2.2'
|
@@ -13,7 +13,8 @@ describe Chef::Sugar::DataBag do
|
|
13
13
|
|
14
14
|
context 'when Chef::Config is set' do
|
15
15
|
it 'loads the secret key from the Chef::Config' do
|
16
|
-
Chef::Config.stub(:[]).with(:encrypted_data_bag_secret).and_return('
|
16
|
+
Chef::Config.stub(:[]).with(:encrypted_data_bag_secret).and_return('/data/path')
|
17
|
+
File.stub(:read).with('/data/path').and_return('B@c0n')
|
17
18
|
|
18
19
|
expect(Chef::EncryptedDataBagItem).to receive(:load)
|
19
20
|
.with('accounts', 'github', 'B@c0n')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-sugar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Vargo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|