vault-update 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/lib/vault-update.rb +7 -8
- data/lib/vault-update/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2456550a3568d5e6cd1f34c93f069534fb57cbcd
|
4
|
+
data.tar.gz: 507a4ed03d6890f4e215c51f98b9df1bd44e26ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd1dfee7ae656c75c18d1556ab90ca603a732d3d3f33f115f6e00e59fff5e47e7098c0aa52b00bfd7d2fff66b01532e251bbef77aab9034a9aa95e6d6c1a83dc
|
7
|
+
data.tar.gz: 4571524be636ff87ddbf859e35a6da4b1c07a0b8c32c909faa0b16b61a5a6cb3619bcfe0bcf1860dbfa36d4939163bb19f0ba828e9b72071fb224b835fb98ad9
|
data/README.md
CHANGED
@@ -35,6 +35,20 @@ Options:
|
|
35
35
|
-h, --help Show this message
|
36
36
|
```
|
37
37
|
|
38
|
+
## Create a completely new key OR update a path without specifing a key separately
|
39
|
+
|
40
|
+
If valid JSON is specified on the command line (enclosed in single quotes), separate key and value arguments are not required. The JSON blob is merged "whole hog" with the existing value for the specified path.
|
41
|
+
|
42
|
+
```
|
43
|
+
$ vault-update -p secret/example '{"mykey": "myvalue"}'
|
44
|
+
Applying changes to secret/example:
|
45
|
+
|
46
|
+
-null
|
47
|
+
+{
|
48
|
+
+ "mykey": "myvalue"
|
49
|
+
+}
|
50
|
+
```
|
51
|
+
|
38
52
|
## Write a string value to a key
|
39
53
|
|
40
54
|
```
|
data/lib/vault-update.rb
CHANGED
@@ -88,21 +88,20 @@ class VaultUpdate
|
|
88
88
|
|
89
89
|
def update_secret(update_hash)
|
90
90
|
data =
|
91
|
-
if (current_secret_value = vault_read(opts[:path])
|
91
|
+
if (current_secret_value = vault_read(opts[:path]))
|
92
|
+
current_secret_value = current_secret_value.stringify_keys
|
92
93
|
secret_history[Time.now.to_i] = current_secret_value
|
93
94
|
vault_write "#{opts[:path]}_history", secret_history
|
94
|
-
current_secret_value.merge(update_hash.stringify_keys)
|
95
|
+
current_secret_value.merge!(update_hash.stringify_keys)
|
96
|
+
puts "current_secret_value: ".colorize(:blue) + current_secret_value.inspect if debug?
|
97
|
+
fail NoUpdateError if current_secret_value == update_hash
|
98
|
+
current_secret_value
|
95
99
|
else
|
96
100
|
puts "update_hash: ".colorize(:blue) + update_hash.inspect
|
97
101
|
update_hash
|
98
102
|
end
|
99
103
|
|
100
|
-
if debug?
|
101
|
-
puts "current_secret_value: ".colorize(:blue) + current_secret_value.inspect
|
102
|
-
puts "data: ".colorize(:blue) + data.inspect
|
103
|
-
end
|
104
|
-
|
105
|
-
fail NoUpdateError if current_secret_value == data
|
104
|
+
puts "data: ".colorize(:blue) + data.inspect if debug?
|
106
105
|
|
107
106
|
puts "Applying changes to #{opts[:path]}:\n".bold
|
108
107
|
puts Diffy::Diff.new(
|
data/lib/vault-update/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vault-update
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Herot
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|