Skip to content

Commit

Permalink
Merge branch 'release/0.4.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
heliocentric committed Aug 24, 2017
2 parents 0a46a44 + a6b62db commit 3e82297
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* Thu Aug 24 2017 Dylan Cochran <[email protected]> - 0.4.3
- (SIMP-3623) libkv::lookup_key backend should turn softfail on by default
- Add fix for 0.9.x consul installations

* Tue Jul 18 2017 Dylan Cochran <[email protected]> - 0.4.2
- (SIMP-3001) Prevent '.' and '..' from being used in keys
- (SIMP-3446) Add parameters to reconfigure http and https listen
Expand Down
1 change: 0 additions & 1 deletion data/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ libkv::consul::config_hash:
data_dir: '/opt/consul'
node_name: "%{::hostname}"
client_addr: '0.0.0.0'
ui_dir: /opt/consul/ui
18 changes: 16 additions & 2 deletions functions/lookup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,22 @@ function libkv::lookup(
}

}
if (libkv::exists({ "url" => $_url, "key" => $_key})) {
libkv::get({ "url" => $_url, "key" => $_key})
if (has_key($options, "softfail")) {
$_opts = {
"softfail" => $options["softfail"]
}
} else {
$_opts = {
"softfail" => true
}
}
if (libkv::exists($_opts + { "url" => $_url, "key" => $_key})) {
$ret = libkv::get($_opts + { "url" => $_url, "key" => $_key})
if ($ret == undef) {
$context.not_found
} else {
$ret
}
} else {
$context.not_found
}
Expand Down
13 changes: 11 additions & 2 deletions manifests/consul.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
$_bootstrap_hash = { "bootstrap_expect" => 1 }
} else {
$type = type($facts['consul_bootstrap'])
notify { "consul_bootstrap = ${type}": }
if ($facts["consul_bootstrap"] == "true") {
$_bootstrap_hash = { "bootstrap_expect" => 1 }
## Create real token
Expand Down Expand Up @@ -204,6 +203,16 @@
# Attempt to store bootstrap info into consul directly via libkv.
# Use softfail to get around issues if the service isn't up
$hash = lookup('consul::config_hash', { "default_value" => {} })
if (SemVer.new($version) >= SemVer.new('0.7.0')) {
$_uidir = {
'ui' => true
}
} else {
$_uidir = {
'ui' => true,
'ui_dir' => '/opt/consul/ui'
}
}
$class_hash = {
'server' => $server,
'node_name' => $::hostname,
Expand All @@ -214,7 +223,7 @@
'https' => $https_listen,
},
}
$merged_hash = $hash + $class_hash + $_datacenter + $config_hash + $_key_hash + $_token_hash + $_bootstrap_hash + $_cert_hash
$merged_hash = $hash + $class_hash + $_datacenter + $config_hash + $_key_hash + $_token_hash + $_bootstrap_hash + $_cert_hash + $_uidir
class { '::consul':
config_hash => $merged_hash,
version => $version,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simp-libkv",
"version": "0.4.2",
"version": "0.4.3",
"author": "simp",
"summary": "",
"license": "Apache-2.0",
Expand Down

0 comments on commit 3e82297

Please sign in to comment.