configuration_service-provider-vault 2.0.13 → 2.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 190e81b31bf02336313b32fff476262984e1498b
4
- data.tar.gz: f20de4c7945adf0170650400725f61ddc091158d
3
+ metadata.gz: 58dccf02a9c8b0bbb2b3a45a41feca76dbbdd433
4
+ data.tar.gz: 40007d246d0b2050cba3dd9905c9afafc589f17a
5
5
  SHA512:
6
- metadata.gz: a2af6602ef9b0b14b7ad017f04692c546ef16619ce87b052210d8cc694697558dd917a52dee284498f207ddc2cca6d3d531a2a5c64ae54306c7b1ad18c0e7812
7
- data.tar.gz: f6b4b736b867da5ea9d2aefe9366b027b6833f821d8e53b4d52b274e1614c1b2b73ee6e6b59ded246d93e4f5d40fe1b3f039a0e7e0f6318141c22fb36076cb24
6
+ metadata.gz: a95a3cd249b9b67321c0802bc5de1f2dcbff4d194493da815cac1ae54846b3347f78d9cbb5610d92f56d3e090ffbc76552e26e09a74a8c3fed6ff73a1a88b060
7
+ data.tar.gz: 6f2db51f0fe4f75a620b249d1642445550dc5647ae09d033c10dcd60debc679ba4ad98a2e778b5b10729da21a50930439a095270d22c692246981fef317a24c7
data/.gemspec CHANGED
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "bundler", "~> 1.7"
26
26
  spec.add_development_dependency "rake", "~> 10.0"
27
27
  spec.add_development_dependency "cucumber", "~> 2.0"
28
- spec.add_development_dependency "rspec-expectations", "~> 3.3"
28
+ spec.add_development_dependency "rspec", "~> 3.4"
29
29
  end
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.travis.yml CHANGED
@@ -1,22 +1,22 @@
1
1
  ---
2
- language: ruby
3
- rvm:
4
- - ruby-2.0.0
5
- - ruby-2.3.0
6
- - jruby-9.0.4.0
7
- before_install:
8
- - r=$(rvm current)
9
- - v=${r#*-}; v=${v%-clang}
10
- - p=${r%%-*}
11
- - if [ "$p" = "ruby" ]; then rebuild=true; fi
12
- - if [ -n "$rebuild" ]; then git clone https://github.com/openssl/openssl.git; fi
13
- - if [ -n "$rebuild" ]; then (cd openssl && git checkout OpenSSL_1_0_1n); fi
14
- - if [ -n "$rebuild" ]; then (cd openssl && ./config -fPIC --prefix=/usr/local/ssl shared && make && sudo make install) >/dev/null; fi
15
- - if [ -n "$rebuild" ]; then git clone https://github.com/rbenv/ruby-build.git; fi
16
- - if [ -n "$rebuild" ]; then (cd ruby-build && sudo ./install.sh); fi
17
- - if [ -n "$rebuild" ]; then RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/ssl ruby-build $v ~/.rvm/rubies/$r; fi
18
- - rm -f vault_0.3.1_linux_amd64.zip
19
- - wget https://dl.bintray.com/mitchellh/vault/vault_0.3.1_linux_amd64.zip
20
- - unzip vault_0.3.1_linux_amd64.zip
21
- - sudo mv vault /usr/local/bin/
22
- - gem install bundler
2
+ language: c
3
+ env:
4
+ - TRUBY=ruby-2.0.0-p648 OPENSSL=openssl-1.0.1d
5
+ - TRUBY=ruby-2.3.0 OPENSSL=openssl-1.0.2f
6
+ - TRUBY=jruby-9.0.0.0 OPENSSL=none
7
+ - TRUBY=jruby-9.0.4.0 OPENSSL=none
8
+ install:
9
+ - RUBY_URL=https://s3-eu-west-1.amazonaws.com/hetznerza/travis-ci/precise/no-rvm/${TRUBY}-${OPENSSL}.tar.gz
10
+ - rvm implode --force
11
+ - sudo mkdir -p /opt/rubies
12
+ - curl ${RUBY_URL} | sudo tar -C /opt/rubies -xzf -
13
+ - git clone https://github.com/postmodern/chruby.git
14
+ - (cd chruby && sudo ./scripts/setup.sh)
15
+ - chruby-exec ${TRUBY} -- ruby --version
16
+ - chruby-exec ${TRUBY} -- gem install --no-ri --no-rdoc bundler
17
+ - curl -O https://releases.hashicorp.com/vault/0.4.1/vault_0.4.1_linux_amd64.zip
18
+ - sudo unzip vault_0.4.1_linux_amd64.zip -d /usr/local/bin
19
+ script:
20
+ - chruby-exec ${TRUBY} -- ruby --version
21
+ - chruby-exec ${TRUBY} -- bundle
22
+ - chruby-exec ${TRUBY} -- bundle exec rake
data/Rakefile CHANGED
@@ -1,15 +1,43 @@
1
1
  require "open3"
2
2
  require "bundler/gem_tasks"
3
+ require "rspec/core/rake_task"
3
4
 
4
5
  task :default => :test
5
6
 
6
- desc "Test the Vault provider for Configuration Service against a Vault development server"
7
- task :test do
7
+ RSpec::Core::RakeTask.new(:just_spec)
8
+
9
+ desc "Run all tests (rspec and cucumber)"
10
+ task :test => :preflight do
11
+ with_devserver do
12
+ Rake::Task["just_spec"].invoke
13
+ Rake::Task["just_features"].invoke
14
+ end
15
+ end
16
+
17
+ desc "Run RSpec code examples against a Vault development server"
18
+ task :spec => :preflight do
19
+ with_devserver do
20
+ Rake::Task["just_spec"].invoke
21
+ end
22
+ end
23
+
24
+ desc "Pre-flight checks"
25
+ task :preflight do
8
26
  if File.exists?("#{ENV["HOME"]}/.vault-token")
9
27
  raise "cannot test with ~/.vault-token present"
10
28
  end
29
+ unless ENV["VAULT_TOKEN"].to_s.empty?
30
+ raise "cannot test with VAULT_TOKEN environment variable set"
31
+ end
32
+ unless ENV["VAULT_ADDR"].to_s.empty?
33
+ raise "cannot test with VAULT_ADDR environment variable set"
34
+ end
35
+ end
36
+
37
+ desc "Test the Vault provider for Configuration Service against a Vault development server"
38
+ task :features => :preflight do
11
39
  with_devserver do
12
- Rake::Task["just_test"].invoke
40
+ Rake::Task["just_features"].invoke
13
41
  end
14
42
  end
15
43
 
@@ -24,7 +52,7 @@ task :scramble do
24
52
  end
25
53
 
26
54
  desc "Run cucumber without starting a Vault development server"
27
- task :just_test do
55
+ task :just_features do
28
56
  gem = Gem::Specification.find_by_name("configuration_service")
29
57
  features_path = gem.full_gem_path + "/features"
30
58
  ENV["TEST_ORCHESTRATION_PROVIDER"] ||= "vault"
@@ -1,5 +1,15 @@
1
1
  #!/bin/sh -e
2
2
 
3
+ if [ -n "$VAULT_TOKEN" ]; then
4
+ echo "error: cannot start vault dev server with VAULT_TOKEN environmant variable set" 1>&2
5
+ exit 1
6
+ fi
7
+
8
+ if [ -n "$VAULT_ADDR" ]; then
9
+ echo "error: cannot start vault dev server with VAULT_ADDR environmant variable set" 1>&2
10
+ exit 1
11
+ fi
12
+
3
13
  vault server -config fixtures/vault.d/configuration.json 1>&2 &
4
14
  pid=$!
5
15
  echo $pid > fixtures/vault.pid
@@ -4,7 +4,7 @@ module ConfigurationService
4
4
 
5
5
  class Vault
6
6
 
7
- VERSION = "2.0.13"
7
+ VERSION = "2.0.14"
8
8
 
9
9
  end
10
10
 
@@ -1,6 +1,7 @@
1
1
  require "configuration_service"
2
2
  require "vault"
3
3
  require "json"
4
+ require "thread"
4
5
  require "time"
5
6
 
6
7
  require_relative "vault/path_helper"
@@ -31,6 +32,7 @@ module ConfigurationService
31
32
  if ca_cert = options[:ca_cert]
32
33
  @vault.ssl_ca_cert = ca_cert
33
34
  end
35
+ @mutex = Mutex.new
34
36
  end
35
37
 
36
38
  ##
@@ -52,14 +54,16 @@ module ConfigurationService
52
54
  # @see #publish_configuration
53
55
  #
54
56
  def request_configuration(identifier, token)
55
- authenticate(token)
56
-
57
- adapt_exceptions do
58
- if revision = get_latest_revision(identifier)
59
- path = build_path(identifier, revision)
60
- if response = @vault.logical.read(path)
61
- data, metadata = JSON.parse(response.data[:data]), JSON.parse(response.data[:metadata])
62
- ConfigurationService::Configuration.new(identifier, data, metadata)
57
+ @mutex.synchronize do
58
+ authenticate(token)
59
+
60
+ adapt_exceptions do
61
+ if revision = get_latest_revision(identifier)
62
+ path = build_path(identifier, revision)
63
+ if response = @vault.logical.read(path)
64
+ data, metadata = JSON.parse(response.data[:data]), JSON.parse(response.data[:metadata])
65
+ ConfigurationService::Configuration.new(identifier, data, metadata)
66
+ end
63
67
  end
64
68
  end
65
69
  end
@@ -88,16 +92,18 @@ module ConfigurationService
88
92
  # @todo make revision history queryable (blocked by https://github.com/hashicorp/vault/issues/111)
89
93
  #
90
94
  def publish_configuration(configuration, token)
91
- authenticate(token)
95
+ @mutex.synchronize do
96
+ authenticate(token)
92
97
 
93
- identifier, data, metadata = configuration.identifier, configuration.data, configuration.metadata
94
- revision = metadata["revision"] or raise "can't publish configuration without revision in metadata"
98
+ identifier, data, metadata = configuration.identifier, configuration.data, configuration.metadata
99
+ revision = metadata["revision"] or raise "can't publish configuration without revision in metadata"
95
100
 
96
- adapt_exceptions do
97
- path = build_path(identifier, revision)
98
- @vault.logical.write(path, data: JSON.generate(data), metadata: JSON.generate(metadata), format: "json")
99
- set_latest_revision(identifier, metadata["revision"])
100
- ConfigurationService::Configuration.new(identifier, data, metadata)
101
+ adapt_exceptions do
102
+ path = build_path(identifier, revision)
103
+ @vault.logical.write(path, data: JSON.generate(data), metadata: JSON.generate(metadata), format: "json")
104
+ set_latest_revision(identifier, metadata["revision"])
105
+ ConfigurationService::Configuration.new(identifier, data, metadata)
106
+ end
101
107
  end
102
108
  end
103
109
 
metadata CHANGED
@@ -1,99 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configuration_service-provider-vault
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.13
4
+ version: 2.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sheldon Hearn
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-06 00:00:00.000000000 Z
11
+ date: 2016-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ name: vault
14
15
  requirement: !ruby/object:Gem::Requirement
15
16
  requirements:
16
17
  - - "~>"
17
18
  - !ruby/object:Gem::Version
18
19
  version: '0.2'
19
- name: vault
20
- prerelease: false
21
20
  type: :runtime
21
+ prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.2'
27
27
  - !ruby/object:Gem::Dependency
28
+ name: configuration_service
28
29
  requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - "~>"
31
32
  - !ruby/object:Gem::Version
32
33
  version: 2.0.5
33
- name: configuration_service
34
- prerelease: false
35
34
  type: :runtime
35
+ prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.0.5
41
41
  - !ruby/object:Gem::Dependency
42
+ name: bundler
42
43
  requirement: !ruby/object:Gem::Requirement
43
44
  requirements:
44
45
  - - "~>"
45
46
  - !ruby/object:Gem::Version
46
47
  version: '1.7'
47
- name: bundler
48
- prerelease: false
49
48
  type: :development
49
+ prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.7'
55
55
  - !ruby/object:Gem::Dependency
56
+ name: rake
56
57
  requirement: !ruby/object:Gem::Requirement
57
58
  requirements:
58
59
  - - "~>"
59
60
  - !ruby/object:Gem::Version
60
61
  version: '10.0'
61
- name: rake
62
- prerelease: false
63
62
  type: :development
63
+ prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '10.0'
69
69
  - !ruby/object:Gem::Dependency
70
+ name: cucumber
70
71
  requirement: !ruby/object:Gem::Requirement
71
72
  requirements:
72
73
  - - "~>"
73
74
  - !ruby/object:Gem::Version
74
75
  version: '2.0'
75
- name: cucumber
76
- prerelease: false
77
76
  type: :development
77
+ prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.0'
83
83
  - !ruby/object:Gem::Dependency
84
+ name: rspec
84
85
  requirement: !ruby/object:Gem::Requirement
85
86
  requirements:
86
87
  - - "~>"
87
88
  - !ruby/object:Gem::Version
88
- version: '3.3'
89
- name: rspec-expectations
90
- prerelease: false
89
+ version: '3.4'
91
90
  type: :development
91
+ prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.3'
96
+ version: '3.4'
97
97
  description: A HashiCorp Vault provider for the Configuration Service
98
98
  email:
99
99
  - sheldonh@starjuice.net
@@ -103,6 +103,7 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - ".gemspec"
105
105
  - ".gitignore"
106
+ - ".rspec"
106
107
  - ".travis.yml"
107
108
  - ".yardopts"
108
109
  - Gemfile
@@ -130,7 +131,7 @@ files:
130
131
  homepage: https://github.com/hetznerZA/configuration_service-provider-vault
131
132
  licenses: []
132
133
  metadata: {}
133
- post_install_message:
134
+ post_install_message:
134
135
  rdoc_options: []
135
136
  require_paths:
136
137
  - lib
@@ -145,9 +146,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
146
  - !ruby/object:Gem::Version
146
147
  version: '0'
147
148
  requirements: []
148
- rubyforge_project:
149
- rubygems_version: 2.4.8
150
- signing_key:
149
+ rubyforge_project:
150
+ rubygems_version: 2.5.1
151
+ signing_key:
151
152
  specification_version: 4
152
153
  summary: Vault provider for Configuration Service
153
154
  test_files: []
155
+ has_rdoc: