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 +4 -4
- data/lib/bosh/cpi.rb +1 -0
- data/lib/bosh/cpi/redactor.rb +32 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22b275a7f8e145ecff103b89af2860ad2fbd57f0
|
4
|
+
data.tar.gz: e5cde2eb87bc2d8a3ad1cd14f83dc6bc62dea09e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc013366f869e11c426d8496148ce6c937d00af075196cac1c5821a1eb1ac4fddc47fe39c45752c6f753555ece0974b3694c72b4601fcfecb08dc37b11512d59
|
7
|
+
data.tar.gz: 3a946bc43d623e6a271b5f72b24517a98ae6dfad3f70884699c4076ac43050a089a4f890e1ac185ea2ba16b176adf2600d8050b1fe90e745a26b790811d4f39f
|
data/lib/bosh/cpi.rb
CHANGED
@@ -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.
|
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-
|
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
|