diff --git a/CHANGELOG b/CHANGELOG index 74fd5ec..7a761ed 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +* Thu Aug 24 2017 Dylan Cochran - 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 - 0.4.2 - (SIMP-3001) Prevent '.' and '..' from being used in keys - (SIMP-3446) Add parameters to reconfigure http and https listen diff --git a/data/common.yaml b/data/common.yaml index 4dd9daa..7d11562 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -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 diff --git a/functions/lookup.pp b/functions/lookup.pp index 483c43e..9424548 100644 --- a/functions/lookup.pp +++ b/functions/lookup.pp @@ -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 } diff --git a/manifests/consul.pp b/manifests/consul.pp index 9e535f8..e8be795 100644 --- a/manifests/consul.pp +++ b/manifests/consul.pp @@ -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 @@ -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, @@ -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, diff --git a/metadata.json b/metadata.json index e5e37a9..f0199b5 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "simp-libkv", - "version": "0.4.2", + "version": "0.4.3", "author": "simp", "summary": "", "license": "Apache-2.0",