chef-vault 4.0.1 → 4.0.6

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
  SHA256:
3
- metadata.gz: 8c20a420a9d49bc39c1e32679f901e7404ed331ebe1fb5a3781f64316c1733c2
4
- data.tar.gz: b328d3d990b89f4378461f319ec208047a518bdfce6231b5b8905c4a9a49c65a
3
+ metadata.gz: 03bdd8e351901cf22ffe796719f896d66facb68e879c9391cc1a9b1c37f7fda6
4
+ data.tar.gz: f0bcdfb1453a3a1369b8dc4c4bf953d88f02553b7b7a75c37b52bb53d6c433c6
5
5
  SHA512:
6
- metadata.gz: 8fc0571def8f7eab2a3bbb57e6ec4d0bd39469a6b5f46668918da3d9c11b8a522760a7c08aa673e780c59bfe4272f56b1f46b4e3634c6f9c666eda0ec3dc0812
7
- data.tar.gz: ffcce0b7bb89f24b019d6dce1b41ee8d31c573a4f99ee2d92e3a9f005c8c69ebc2b68207261001b0d4fcb27c1262d1d88d94ff8d84091ae0f7a7ecd57c93c62f
6
+ metadata.gz: dd6bf1713a7070cb868c8ada5cebefc160f7d20dea520068b280a4bbd66c6a2dca429ca3a06a6c50186d4bc23145e41536b6dd141c8d53ed3c12d0244ae0a105
7
+ data.tar.gz: b5be7ab98224fecb927546fe14513fc2c1efec41d63069c460e402b9581ee38e7bc3fd1241e76de00334760e7df7aa480abd907263155d6bb59124d6eadb0017
data/Gemfile CHANGED
@@ -22,6 +22,6 @@ end
22
22
  group :debug do
23
23
  gem "pry"
24
24
  gem "pry-byebug"
25
- gem "pry-stack_explorer"
25
+ gem "pry-stack_explorer", "~> 0.4.0" # pin until we drop ruby < 2.6
26
26
  gem "rb-readline"
27
27
  end
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  # Chef-Vault Gemspec file
3
2
  # Copyright 2013-2015, Nordstrom, Inc.
4
3
  # Copyright 2017-2019, Chef Software, Inc.
@@ -14,7 +14,7 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
- require "json"
17
+ require "json" unless defined?(JSON)
18
18
 
19
19
  class ChefVault
20
20
  class Actor
@@ -15,7 +15,7 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
- require "securerandom"
18
+ require "securerandom" unless defined?(SecureRandom)
19
19
  require_relative "mixins"
20
20
 
21
21
  class ChefVault
@@ -340,7 +340,16 @@ class ChefVault
340
340
  def self.data_bag_item_type(vault, name)
341
341
  # adapted from https://github.com/opscode-cookbooks/chef-vault/blob/v1.3.0/libraries/chef_vault_item.rb
342
342
  # and https://github.com/sensu/sensu-chef/blob/2.9.0/libraries/sensu_helpers.rb
343
- dbi = Chef::DataBagItem.load(vault, name)
343
+ begin
344
+ dbi = Chef::DataBagItem.load(vault, name)
345
+ rescue Net::HTTPServerException => http_error
346
+ if http_error.response.code == "404"
347
+ raise ChefVault::Exceptions::ItemNotFound,
348
+ "#{vault}/#{name} not found"
349
+ else
350
+ raise http_error
351
+ end
352
+ end
344
353
  encrypted = dbi.detect do |_, v|
345
354
  v.is_a?(Hash) && v.key?("encrypted_data")
346
355
  end
@@ -15,6 +15,6 @@
15
15
  # limitations under the License.
16
16
 
17
17
  class ChefVault
18
- VERSION = "4.0.1"
18
+ VERSION = "4.0.6"
19
19
  MAJOR, MINOR, TINY = VERSION.split(".")
20
20
  end
@@ -45,9 +45,10 @@ class Chef
45
45
  end
46
46
  end
47
47
 
48
+ # Permalink for regex of replacing '_keys' with '': https://rubular.com/r/5cA5JNSyLfPSfY
48
49
  def vault_items(vault)
49
50
  Chef::DataBag.load(vault).keys.each_with_object([]) do |key, array|
50
- array << key.sub("_keys", "") if key =~ /.+_keys$/
51
+ array << key.sub(/_keys(?=[^_keys]*$)/, "") if key =~ /.+_keys$/
51
52
  end
52
53
  end
53
54
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-vault
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thom May
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-30 00:00:00.000000000 Z
11
+ date: 2020-08-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Data encryption support for Chef Infra using data bags
14
14
  email: