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 +4 -4
- data/.rubocop.yml +2 -0
- data/README.md +4 -0
- data/lib/chef-vault-retry.rb +16 -12
- data/lib/chef-vault-retry/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebd822ec9d88f7fab435cc60cf48faa85608d686
|
4
|
+
data.tar.gz: 3d2a8956a769a8dd04fc68864cda8152fd7ec5b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd11e0ba0ec77f377bbc7409a60c478889be750cf97319e292ca127503e29dfa3f8068d0553cafe28eae12e0dc1aa91089ccb2c2fb7a882469b4c6a2841d2f7a
|
7
|
+
data.tar.gz: a19ad6626932f001d4737ae995db29f0f6f763fad7b0d7110ce34e0550bbc46c7e6fbe53d71616290f9f8e37da137ce01a5deb601e76a73403275f2ba8dafbc1
|
data/.rubocop.yml
ADDED
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`.
|
data/lib/chef-vault-retry.rb
CHANGED
@@ -20,20 +20,24 @@ require 'chef-vault'
|
|
20
20
|
|
21
21
|
class ChefVaultRetry
|
22
22
|
class Item
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
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.
|
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-
|
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.
|
61
|
+
rubygems_version: 2.4.8
|
61
62
|
signing_key:
|
62
63
|
specification_version: 4
|
63
64
|
summary: Retry support for chef-vault
|