Skip to content

Commit

Permalink
Merge pull request #365 from houtmanj/fix2
Browse files Browse the repository at this point in the history
(#359) Datacenter support to consul_key_value
  • Loading branch information
solarkennedy authored Oct 3, 2017
2 parents d19ee1f + fb08366 commit 87cbafe
Show file tree
Hide file tree
Showing 10 changed files with 518 additions and 93 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
language: ruby
bundler_args: --without development
bundler_args: --without development --full-index
before_install: rm Gemfile.lock || true
sudo: false
cache: bundler
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Simon Croome <simon@croome.org>
Dan Tehranian <tehranian@gmail.com>
Vik Bhatti <vik@vikbhatti.com>
Justin King <justin.dynamicd@gmail.com>
Jos Houtman <jos@houtman.io>
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ group :test do
gem "json_pure", '~> 1.8.3'

gem "rake"
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.7.0'
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.8.4'
gem "puppet-lint"

gem "rspec"
Expand All @@ -27,4 +27,7 @@ group :test do
gem "puppetlabs_spec_helper"
gem "hiera"
gem "hiera-puppet-helper"
gem "webmock", "~> 2.3.0"
#pin for 1.9.3 compatability for now
gem "public_suffix", '~> 1.4.6'
end
145 changes: 78 additions & 67 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.1)
CFPropertyList (2.3.5)
addressable (2.4.0)
aws-sdk-v1 (1.66.0)
aws-sdk-v1 (1.67.0)
json (~> 1.4)
nokogiri (>= 1.4.4)
beaker (2.51.0)
nokogiri (~> 1)
beaker (2.52.0)
aws-sdk-v1 (~> 1.57)
beaker-answers (~> 0.0)
beaker-hiera (~> 0.0)
Expand All @@ -26,40 +26,43 @@ GEM
net-scp (~> 1.2)
net-ssh (~> 2.9)
open_uri_redirections (~> 0.2.1)
public_suffix (< 1.5.0)
rbvmomi (~> 1.8, < 1.9.0)
rsync (~> 1.0.9)
stringify-hash (~> 0.0)
unf (~> 0.1)
beaker-answers (0.11.0)
beaker-answers (0.17.0)
hocon (~> 1.0)
require_all (~> 1.3.2)
stringify-hash (~> 0.0.0)
beaker-hiera (0.1.1)
stringify-hash (~> 0.0.0)
beaker-hostgenerator (0.7.3)
beaker-hostgenerator (1.1.0)
deep_merge (~> 1.0)
stringify-hash (~> 0.0.0)
beaker-pe (0.12.0)
beaker-pe (0.12.2)
stringify-hash (~> 0.0.0)
beaker-puppet_install_helper (0.4.4)
beaker (~> 2.0)
beaker-puppet_install_helper (0.7.1)
beaker (>= 2.0)
beaker-rspec (5.6.0)
beaker (~> 2.0)
rspec
serverspec (~> 2)
specinfra (~> 2)
builder (3.2.2)
coderay (1.1.1)
builder (3.2.3)
coderay (1.1.2)
crack (0.4.3)
safe_yaml (~> 1.0.0)
deep_merge (1.1.1)
diff-lcs (1.2.5)
docker-api (1.31.0)
diff-lcs (1.3)
docker-api (1.33.6)
excon (>= 0.38.0)
json
domain_name (0.5.20160826)
domain_name (0.5.20170404)
unf (>= 0.0.5, < 1.0.0)
excon (0.52.0)
facter (2.4.6)
faraday (0.9.2)
excon (0.59.0)
facter (2.5.1)
faraday (0.13.1)
multipart-post (>= 1.2, < 3)
fission (0.5.0)
CFPropertyList (~> 2.2)
Expand Down Expand Up @@ -90,18 +93,18 @@ GEM
fog-atmos (0.1.0)
fog-core
fog-xml
fog-aws (0.12.0)
fog-aws (1.4.1)
fog-core (~> 1.38)
fog-json (~> 1.0)
fog-xml (~> 0.1)
ipaddress (~> 0.8)
fog-brightbox (0.11.0)
fog-brightbox (0.13.0)
fog-core (~> 1.22)
fog-json
inflecto (~> 0.0.2)
fog-core (1.42.0)
fog-core (1.45.0)
builder
excon (~> 0.49)
excon (~> 0.58)
formatador (~> 0.2)
fog-dynect (0.0.3)
fog-core
Expand All @@ -117,13 +120,13 @@ GEM
fog-json (1.0.2)
fog-core (~> 1.0)
multi_json (~> 1.10)
fog-local (0.3.0)
fog-local (0.4.0)
fog-core (~> 1.27)
fog-powerdns (0.1.1)
fog-core (~> 1.27)
fog-json (~> 1.0)
fog-xml (~> 0.1)
fog-profitbricks (2.0.1)
fog-profitbricks (4.0.0)
fog-core (~> 1.42)
fog-json (~> 1.0)
fog-radosgw (0.0.5)
Expand Down Expand Up @@ -155,9 +158,9 @@ GEM
fog-voxel (0.1.0)
fog-core
fog-xml
fog-xml (0.1.2)
fog-xml (0.1.3)
fog-core
nokogiri (~> 1.5, >= 1.5.11)
nokogiri (>= 1.5.11, < 2.0.0)
formatador (0.2.5)
google-api-client (0.9.4)
addressable (~> 2.3)
Expand All @@ -169,74 +172,74 @@ GEM
representable (~> 2.3.0)
retriable (~> 2.0)
thor (~> 0.19)
googleauth (0.5.1)
faraday (~> 0.9)
googleauth (0.5.3)
faraday (~> 0.12)
jwt (~> 1.4)
logging (~> 2.0)
memoist (~> 0.12)
multi_json (~> 1.11)
os (~> 0.9)
signet (~> 0.7)
hashdiff (0.3.6)
hiera (1.3.4)
json_pure
hiera-puppet-helper (1.0.1)
hocon (1.1.2)
http-cookie (1.0.2)
hocon (1.2.5)
http-cookie (1.0.3)
domain_name (~> 0.5)
httpclient (2.8.2.4)
httpclient (2.8.3)
hurley (0.2)
in-parallel (0.1.15)
in-parallel (0.1.17)
inflecto (0.0.2)
inifile (2.0.2)
ipaddress (0.8.3)
json (1.8.3)
json_pure (1.8.3)
json (1.8.6)
json_pure (1.8.6)
jwt (1.5.6)
little-plugger (1.1.4)
logging (2.1.0)
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
memoist (0.15.0)
memoist (0.16.0)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (2.99.3)
mini_portile2 (2.1.0)
minitest (5.9.0)
mocha (1.1.0)
minitest (5.10.3)
mocha (1.3.0)
metaclass (~> 0.0.1)
multi_json (1.12.1)
multi_json (1.12.2)
multipart-post (2.0.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.9.4)
net-telnet (0.1.1)
netrc (0.11.0)
nokogiri (1.6.8)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
open_uri_redirections (0.2.1)
os (0.9.6)
pkg-config (1.1.7)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
puppet (3.7.5)
public_suffix (1.4.6)
puppet (3.8.7)
facter (> 1.6, < 3)
hiera (~> 1.0)
json_pure
puppet-blacksmith (3.4.0)
puppet (>= 2.7.16)
rest-client (~> 1.8.0)
puppet-lint (2.0.2)
puppet-syntax (2.1.0)
puppet-lint (2.3.0)
puppet-syntax (2.4.1)
rake
puppetlabs_spec_helper (1.2.2)
puppetlabs_spec_helper (2.3.2)
mocha (~> 1.0)
puppet-lint (~> 2.0)
puppet-syntax (~> 2.0)
rspec-puppet (~> 2.0)
rake (10.5.0)
rake (12.0.0)
rbvmomi (1.8.2)
builder
nokogiri (>= 1.4.1)
Expand All @@ -249,49 +252,55 @@ GEM
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
retriable (2.1.0)
rspec (3.1.0)
rspec-core (~> 3.1.0)
rspec-expectations (~> 3.1.0)
rspec-mocks (~> 3.1.0)
rspec-core (3.1.7)
rspec-support (~> 3.1.0)
rspec-expectations (3.1.2)
rspec (3.6.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
rspec-mocks (~> 3.6.0)
rspec-core (3.6.0)
rspec-support (~> 3.6.0)
rspec-expectations (3.6.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.1.0)
rspec-support (~> 3.6.0)
rspec-its (1.2.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.1.3)
rspec-support (~> 3.1.0)
rspec-puppet (2.4.0)
rspec-mocks (3.6.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-puppet (2.6.8)
rspec
rspec-support (3.1.2)
rspec-support (3.6.0)
rsync (1.0.9)
serverspec (2.36.1)
safe_yaml (1.0.4)
serverspec (2.40.0)
multi_json
rspec (~> 3.0)
rspec-its
specinfra (~> 2.53)
sfl (2.2)
specinfra (~> 2.68)
sfl (2.3)
signet (0.7.3)
addressable (~> 2.3)
faraday (~> 0.9)
jwt (~> 1.5)
multi_json (~> 1.10)
slop (3.6.0)
specinfra (2.63.1)
specinfra (2.71.2)
net-scp
net-ssh (>= 2.7, < 4.0)
net-ssh (>= 2.7, < 5.0)
net-telnet
sfl
stringify-hash (0.0.2)
thor (0.19.1)
thor (0.20.0)
trollop (2.1.2)
uber (0.0.15)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.2)
unf_ext (0.0.7.4)
vagrant-wrapper (2.0.3)
webmock (2.3.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff

PLATFORMS
ruby
Expand All @@ -305,7 +314,8 @@ DEPENDENCIES
json (~> 1.8.3)
json_pure (~> 1.8.3)
pry
puppet (~> 3.7.0)
public_suffix (~> 1.4.6)
puppet (~> 3.8.4)
puppet-blacksmith
puppet-lint
puppet-syntax
Expand All @@ -316,6 +326,7 @@ DEPENDENCIES
rspec-puppet
serverspec
vagrant-wrapper
webmock (~> 2.3.0)

BUNDLED WITH
1.12.5
1.15.4
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,15 +243,37 @@ consul_prepared_query { 'consul':

## Key/Value Objects

Example:

```puppet
consul_key_value { 'key/path':
ensure => 'present',
value => 'myvaluestring',
flags => 12345,
ensure => 'present',
value => 'myvaluestring',
flags => 12345,
datacenter => 'dc1'
}
```

This provider allows you to manage key/value pairs.
This provider allows you to manage key/value pairs. It tries to be smart in two ways:

1. It caches the data accessible from the kv store with the specified acl token.
2. It does not update the key if the value & flag are already correct.


These parameters are mandatory when using `consul_key_value`:

* `name` Name of the key/value object. Path in key/value store.
* `value` value of the key.

The optional parameters only need to be specified if you require changes from default behaviour.

* `flags` {Integer} an opaque unsigned integer that can be attached to each entry. Clients can choose to use this however makes sense for their application. Default is `0`.
* `acl\_api_token` {String} Token for accessing the ACL API. Default is `''`.
* `datacenter` {String} Use the key/value store in specified datacenter. If `''` (default) it will use the datacenter of the Consul agent at the HTTP address.
* `protocol` {String} protocol to use. Either `'http'` (default) or `'https'`.
* `port` {Integer} consul port. Defaults to `8500`.
* `hostname` {String} consul hostname. Defaults to `'localhost'`.
* `api_tries` {Integer} number of tries when contacting the Consul REST API. Timeouts are not retried because a timeout already takes long. Defaults to `3`.

## Limitations

Expand Down
Loading

0 comments on commit 87cbafe

Please sign in to comment.