chef-vault-retry 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff30d34bbf8026116369661dfe0339c53bfb2b51
4
- data.tar.gz: a527512f4de92b17142e06c7993beaa670ff4289
3
+ metadata.gz: ebd822ec9d88f7fab435cc60cf48faa85608d686
4
+ data.tar.gz: 3d2a8956a769a8dd04fc68864cda8152fd7ec5b3
5
5
  SHA512:
6
- metadata.gz: 41b84e9897fe479a20032128b488955a32cae01f308715c8135b1c201bb03cb9b1d4feaf2c11f6dff4fde35fa8e0cccd5e66abeefaa7245d9a7224b6c61df285
7
- data.tar.gz: f1c0f2d2ae341a2e17f902cbd30ae09b76991be40f485a33e95041e7607ec55b37ce23453a087a3ac64a09d8868737c96c7fedcb39d3b1c2192c2e51e0b50cb9
6
+ metadata.gz: cd11e0ba0ec77f377bbc7409a60c478889be750cf97319e292ca127503e29dfa3f8068d0553cafe28eae12e0dc1aa91089ccb2c2fb7a882469b4c6a2841d2f7a
7
+ data.tar.gz: a19ad6626932f001d4737ae995db29f0f6f763fad7b0d7110ce34e0550bbc46c7e6fbe53d71616290f9f8e37da137ce01a5deb601e76a73403275f2ba8dafbc1
@@ -0,0 +1,2 @@
1
+ Style/FileName:
2
+ Enabled: false
data/README.md CHANGED
@@ -37,3 +37,7 @@ The same ChefVault::Item.load method will be called, but if a secret decryption
37
37
  2. Recipe execution will pause for 30 seconds
38
38
  3. The process will repeat
39
39
  * It will repeat this 40 times by default (~20 minutes). The number of retries can be customized by passing a Fixnum as the `retries` argument of `ChefVaultRetry::Item.load`
40
+
41
+ ## Databag Fallback
42
+
43
+ This cookbook emulates the default `chef-vault` cookbook behaviour and falls back to normal data bag item loading if the item is not actually a Chef Vault item. This can be disabled by passing `databag_fallback=false` to `ChefVaultRetry::Item.load`.
@@ -20,20 +20,24 @@ require 'chef-vault'
20
20
 
21
21
  class ChefVaultRetry
22
22
  class Item
23
-
24
- def self.load(v, i, retries=40)
25
- retries.times do
26
- begin
27
- return ChefVault::Item.load(v, i)
28
- rescue ChefVault::Exceptions::SecretDecryption
29
- puts "SecretDecryption exception raised; "\
30
- "please refresh vault item (#{v}/#{i})"
31
- sleep 30
32
- next
23
+ def self.load(v, i, retries = 40, databag_fallback = true)
24
+ if ChefVault::Item.vault?(v, i)
25
+ retries.times do
26
+ begin
27
+ return ChefVault::Item.load(v, i)
28
+ rescue ChefVault::Exceptions::SecretDecryption
29
+ puts 'SecretDecryption exception raised; '\
30
+ "please refresh vault item (#{v}/#{i})"
31
+ sleep 30
32
+ next
33
+ end
33
34
  end
35
+ fail "Failed after #{retries} attempts to decrypt #{v}/#{i}"
36
+ elsif databag_fallback
37
+ Chef::DataBagItem.load(v, i)
38
+ else
39
+ fail "#{v}/#{i} vault item not found and databag_fallback not permitted"
34
40
  end
35
- fail "Failed after #{retries} attempts to decrypt #{v}/#{i}"
36
41
  end
37
-
38
42
  end
39
43
  end
@@ -15,6 +15,6 @@
15
15
  # limitations under the License.
16
16
 
17
17
  class ChefVaultRetry
18
- VERSION = '0.1.0'
18
+ VERSION = '0.2.0'
19
19
  MAJOR, MINOR, TINY = VERSION.split('.')
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-vault-retry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Biola University
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-13 00:00:00.000000000 Z
11
+ date: 2015-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-vault
@@ -32,6 +32,7 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - ".gitignore"
35
+ - ".rubocop.yml"
35
36
  - Gemfile
36
37
  - README.md
37
38
  - chef-vault-retry.gemspec
@@ -57,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
58
  version: '0'
58
59
  requirements: []
59
60
  rubyforge_project:
60
- rubygems_version: 2.4.5
61
+ rubygems_version: 2.4.8
61
62
  signing_key:
62
63
  specification_version: 4
63
64
  summary: Retry support for chef-vault