bosh_cpi 2.2.0 → 2.3.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: b6b73f1c2e77398dacfa7788721c0a5d92bee402
4
- data.tar.gz: 4dc042273e7bbc5ddf380211109f9fe1196bc164
3
+ metadata.gz: 22b275a7f8e145ecff103b89af2860ad2fbd57f0
4
+ data.tar.gz: e5cde2eb87bc2d8a3ad1cd14f83dc6bc62dea09e
5
5
  SHA512:
6
- metadata.gz: 3c29f0a6907d601cdf58b0a317a81b6c855d1ae50be5e198e41093220a41b11acd7e40d5c3a3d79313160f9691e6fc2de0c0bfd37ed5918cbc39a1bfce2145a6
7
- data.tar.gz: f8a0996118812fecf8e948401bac8afe6f12c2d850cac4a0b9f4b2e8ac8bbd640a215ce6c08cba7ba56bd2d87dda3e202d123082a7b3227ca88f073b8673cd3a
6
+ metadata.gz: bc013366f869e11c426d8496148ce6c937d00af075196cac1c5821a1eb1ac4fddc47fe39c45752c6f753555ece0974b3694c72b4601fcfecb08dc37b11512d59
7
+ data.tar.gz: 3a946bc43d623e6a271b5f72b24517a98ae6dfad3f70884699c4076ac43050a089a4f890e1ac185ea2ba16b176adf2600d8050b1fe90e745a26b790811d4f39f
data/lib/bosh/cpi.rb CHANGED
@@ -5,3 +5,4 @@ end
5
5
  require 'bosh/cpi/cli'
6
6
  require 'bosh/cpi/logger'
7
7
  require 'bosh/cpi/registry_client'
8
+ require 'bosh/cpi/redactor'
@@ -0,0 +1,32 @@
1
+ module Bosh::Cpi
2
+ class Redactor
3
+
4
+ REDACTED = '<redacted>'
5
+
6
+ def self.clone_and_redact(hash, *paths)
7
+ begin
8
+ hash = JSON.parse(hash.to_json)
9
+ rescue
10
+ return nil
11
+ end
12
+
13
+ redact!(hash, *paths)
14
+ end
15
+
16
+ def self.redact!(hash, *json_paths)
17
+ json_paths.each do |json_path|
18
+ properties = json_path.split('.')
19
+ property_to_redact = properties.pop
20
+
21
+ target_hash = properties.reduce(hash, &fetch_property)
22
+ target_hash[property_to_redact] = REDACTED if target_hash.has_key? property_to_redact
23
+ end
24
+
25
+ hash
26
+ end
27
+
28
+ def self.fetch_property
29
+ -> (hash, property) { hash.fetch(property, {})}
30
+ end
31
+ end
32
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_cpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2017-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: membrane
@@ -63,6 +63,7 @@ files:
63
63
  - lib/bosh/cpi/compatibility_helpers.rb
64
64
  - lib/bosh/cpi/compatibility_helpers/delete_vm.rb
65
65
  - lib/bosh/cpi/logger.rb
66
+ - lib/bosh/cpi/redactor.rb
66
67
  - lib/bosh/cpi/registry_client.rb
67
68
  - lib/bosh/cpi/tasks.rb
68
69
  - lib/bosh/cpi/tasks/spec.rake