hako-vault 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -0
- data/Rakefile +1 -0
- data/hako-vault.gemspec +2 -1
- data/lib/hako/env_providers/vault.rb +7 -2
- 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: 857dcdb4a7af8fa24681d44c9a7dfadd0b2f0fbb
|
4
|
+
data.tar.gz: 155f485439835ce24f8fdac0c010d97c1584a1e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ca9f0d575d0c89cddc8e60ac038b1e1338f28fc649790cbd7bc3983c8a35a7766d81c6d9002cf54237ab6faff9cf23d3a8249a0cf625ab8e7f17914304cfad3
|
7
|
+
data.tar.gz: f04e9d6cd602f3aa5e5cee050a334cb213ad8095cac2162eb410774842a609230a79ea84ac508428abf767cf926528a99d3cdadda379fb360fb3370a0e18da9c
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/hako-vault.gemspec
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
|
+
|
3
4
|
lib = File.expand_path('../lib', __FILE__)
|
4
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
6
|
|
6
7
|
Gem::Specification.new do |spec|
|
7
8
|
spec.name = 'hako-vault'
|
8
|
-
spec.version = '0.2.
|
9
|
+
spec.version = '0.2.3'
|
9
10
|
spec.authors = ['Kohei Suzuki']
|
10
11
|
spec.email = ['eagletmt@gmail.com']
|
11
12
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'hako/env_provider'
|
3
4
|
require 'json'
|
4
5
|
require 'net/http'
|
@@ -80,7 +81,7 @@ module Hako
|
|
80
81
|
# @return [Array<String>]
|
81
82
|
def parent_directories_for(variables)
|
82
83
|
# XXX: URI module cannot join relative URIs
|
83
|
-
base_uri = URI.parse(
|
84
|
+
base_uri = URI.parse('https://dummy/')
|
84
85
|
variables.map do |variable|
|
85
86
|
(base_uri + variable + '.').request_uri.sub(%r{\A/}, '')
|
86
87
|
end.uniq
|
@@ -95,7 +96,7 @@ module Hako
|
|
95
96
|
req['X-Vault-Token'] = ENV['VAULT_TOKEN']
|
96
97
|
res = @http.request(req)
|
97
98
|
code = res.code.to_i
|
98
|
-
if code
|
99
|
+
if retryable_http_code?(code)
|
99
100
|
Hako.logger.warn("Vault HTTP Error: #{res.code}: #{res.body}")
|
100
101
|
last_error = res
|
101
102
|
interval = 1.5**i
|
@@ -107,6 +108,10 @@ module Hako
|
|
107
108
|
end
|
108
109
|
raise Error.new("Vault HTTP Error: #{last_error.code}: #{last_error.body}")
|
109
110
|
end
|
111
|
+
|
112
|
+
def retryable_http_code?(code)
|
113
|
+
code == 307 || (code >= 500 && code < 600)
|
114
|
+
end
|
110
115
|
end
|
111
116
|
end
|
112
117
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hako-vault
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kohei Suzuki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hako
|