From 58733681426938b3bd90c9396e1a351c20422ef2 Mon Sep 17 00:00:00 2001 From: Dylan Cochran Date: Fri, 18 Aug 2017 11:39:23 -0400 Subject: [PATCH 1/5] Add semver for 0.9.0 --- data/common.yaml | 1 - manifests/consul.pp | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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/manifests/consul.pp b/manifests/consul.pp index 9e535f8..31357bd 100644 --- a/manifests/consul.pp +++ b/manifests/consul.pp @@ -204,6 +204,13 @@ # 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.9.0')) { + $_uidir = {} + } else { + $_uidir = { + 'ui_dir' => '/opt/consul/ui' + } + } $class_hash = { 'server' => $server, 'node_name' => $::hostname, From 01b5784f551b98b429bdb84be63a19f9a8c772d9 Mon Sep 17 00:00:00 2001 From: Dylan Cochran Date: Fri, 18 Aug 2017 11:44:09 -0400 Subject: [PATCH 2/5] fix path --- manifests/consul.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/consul.pp b/manifests/consul.pp index 31357bd..2fe1cb3 100644 --- a/manifests/consul.pp +++ b/manifests/consul.pp @@ -221,7 +221,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, From e70111cca3d21805d7ad221ce9e9c4b2beb941f5 Mon Sep 17 00:00:00 2001 From: Dylan Cochran Date: Fri, 18 Aug 2017 11:56:46 -0400 Subject: [PATCH 3/5] Fix version check for the ui flag --- manifests/consul.pp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/manifests/consul.pp b/manifests/consul.pp index 2fe1cb3..290eb2d 100644 --- a/manifests/consul.pp +++ b/manifests/consul.pp @@ -204,10 +204,13 @@ # 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.9.0')) { - $_uidir = {} + if (SemVer.new($version) >= SemVer.new('0.7.0')) { + $_uidir = { + 'ui' => true + } } else { $_uidir = { + 'ui' => true, 'ui_dir' => '/opt/consul/ui' } } From 5d3169d1e573cfdfd4bb57894e0a617cc4181586 Mon Sep 17 00:00:00 2001 From: Dylan Cochran Date: Tue, 22 Aug 2017 17:01:47 -0400 Subject: [PATCH 4/5] (SIMP-3623) libkv::lookup_key backend should turn softfail on by default A hiera backend, when failing, should not cause a puppet catalog compilation as this is POLA, as hiera's behaviour is to not return a value when a layer fails. Turn softfail on by default for libkv::lookup SIMP-3623 #close --- functions/lookup.pp | 18 ++++++++++++++++-- manifests/consul.pp | 1 - 2 files changed, 16 insertions(+), 3 deletions(-) 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 290eb2d..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 From a6b62db77354a75c69146222b18f982c8714a83d Mon Sep 17 00:00:00 2001 From: Dylan Cochran Date: Thu, 24 Aug 2017 15:51:10 -0400 Subject: [PATCH 5/5] Release 0.4.3 --- CHANGELOG | 4 ++++ metadata.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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/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",