From 9f3787512e6e18e92cc409acc83451bdc7c18dcb Mon Sep 17 00:00:00 2001 From: Dylan Cochran Date: Mon, 10 Jul 2017 17:46:44 -0400 Subject: [PATCH 1/3] (SIMP-3403) Spurious 'undefined method unpack' Check if the Value field we get from consul is nil before attempting to base64 decode SIMP-3403 #close --- lib/puppet_x/libkv/consul_provider.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/puppet_x/libkv/consul_provider.rb b/lib/puppet_x/libkv/consul_provider.rb index ff6c08d..8de0e01 100644 --- a/lib/puppet_x/libkv/consul_provider.rb +++ b/lib/puppet_x/libkv/consul_provider.rb @@ -288,7 +288,11 @@ def atomic_list(params) value.each do |entry| nkey = entry["Key"].gsub(reg,"") retval[nkey] = entry - retval[nkey]["value"] = Base64.decode64(entry["Value"]) + unless (entry["Value"] == nil) + retval[nkey]["value"] = Base64.decode64(entry["Value"]) + else + retval[nkey]["value"] = nil + end retval[nkey].delete("Value") retval[nkey].delete("Key") end From 12487d5d5bf2b8a8c01e585ad5acdd9004374e29 Mon Sep 17 00:00:00 2001 From: Dylan Cochran Date: Mon, 10 Jul 2017 17:54:50 -0400 Subject: [PATCH 2/3] (SIMP-3407) Fix idempoency on acl token generation * Fix consul-create-acl to use options correctly, and generate files in the correct location SIMP-3407 #close --- files/consul/consul-create-acl | 16 ++++++++++++++-- manifests/consul.pp | 5 ++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/files/consul/consul-create-acl b/files/consul/consul-create-acl index 0b46c58..7820ded 100644 --- a/files/consul/consul-create-acl +++ b/files/consul/consul-create-acl @@ -1,12 +1,24 @@ #!/bin/sh -TOKEN=$(cat $1) -OUTPUTFILE=$2 # Give consul some time to attempt a join, then realize it's bootstrapping # a new cluster sleep 10 + +while getopts ":t:" o; do + case "${o}" in + t) + TYPE=${OPTARG} + ;; + esac +done + +shift $((OPTIND-1)) +TOKEN=$(cat $1) +OUTPUTFILE=$2 + if [ "${TYPE}" = "" ] ; then TYPE="libkv" fi + case "${TYPE}" in libkv) POLICY='{ diff --git a/manifests/consul.pp b/manifests/consul.pp index a84c9f8..d90b4cc 100644 --- a/manifests/consul.pp +++ b/manifests/consul.pp @@ -55,7 +55,7 @@ ], } exec { "/usr/bin/consul-create-acl -t agent_token /etc/simp/bootstrap/consul/master_token /etc/simp/bootstrap/consul/agent_token": - creates => "/etc/simp/bootstrap/consul/libkv_token", + creates => "/etc/simp/bootstrap/consul/agent_token", require => [ Service['consul'], File["/usr/bin/consul-create-acl"], @@ -183,4 +183,7 @@ config_hash => $merged_hash, version => $version, } + file { "/usr/bin/consul": + target => "/usr/local/bin/consul", + } } From 026ff376e8e1e02b7e98a386654bcffdc8671a54 Mon Sep 17 00:00:00 2001 From: Dylan Cochran Date: Tue, 11 Jul 2017 10:53:49 -0400 Subject: [PATCH 3/3] Release 0.3.2 --- CHANGELOG | 4 ++++ metadata.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index abb1646..1358420 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +* Tue Jul 11 2017 Dylan Cochran - 0.3.2 +- (SIMP-3407) Fix idempoency on acl token generation +- (SIMP-3403) Spurious 'undefined method unpack' + * Mon Jul 10 2017 Dylan Cochran - 0.3.1 - (SIMP-3360) Use module data for certificate paths - (SIMP-3087) Add libkv::lookup hierav5 backend function diff --git a/metadata.json b/metadata.json index 7bc078b..fd35d38 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "simp-libkv", - "version": "0.3.1", + "version": "0.3.2", "author": "simp", "summary": "", "license": "Apache-2.0",