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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9ccd334da99fc683a7240d10e6e828209b7fc611
4
- data.tar.gz: 6efab5c807c8a7cc3a741aca87bd9d31c3953269
3
+ metadata.gz: 2456550a3568d5e6cd1f34c93f069534fb57cbcd
4
+ data.tar.gz: 507a4ed03d6890f4e215c51f98b9df1bd44e26ec
5
5
  SHA512:
6
- metadata.gz: 6742da546734bd27b853dca3b3633993728af7300693fa2a8ec866ea65ce8d210fe93e6cd0aa896e290fe2bb4afc2fb8f21ba31aaf4d45116b69d1d5d97fc07a
7
- data.tar.gz: 34063b2d3cd89f86a7968fc313df591e27ece38d0cc80b8bfad192e3c895b772d2a085dd1cab37f5ede0c6bebdd16052243b839bdcab723406573a6a4364ac88
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]).stringify_keys)
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(
@@ -1,3 +1,3 @@
1
1
  class VaultUpdate
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
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.0
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-21 00:00:00.000000000 Z
11
+ date: 2016-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diffy