From 7a25b04990de55cd689740b755c41ca249dfa20e Mon Sep 17 00:00:00 2001
From: Thomas Goirand <zigo@debian.org>
Date: Tue, 3 Apr 2018 11:11:32 +0200
Subject: [PATCH] Fixed puppet repo & key in Debian

It appears that the puppetlabs Debian repository is set to always
install a repository for Xenial (instead of using lsb_release to
find the OS), and that the Puppetlabs repo GPG key is outdated. This
patch fixes that.

Change-Id: I35231cdf7503d129bb408bc5d29a2cfe95c4e08e
---
 files/GPG-KEY-puppetlabs | 124 ++++++++++++++++-----------------------
 functions                |   2 +-
 2 files changed, 51 insertions(+), 75 deletions(-)

diff --git a/files/GPG-KEY-puppetlabs b/files/GPG-KEY-puppetlabs
index c9c43fed0..fe3709ca6 100644
--- a/files/GPG-KEY-puppetlabs
+++ b/files/GPG-KEY-puppetlabs
@@ -1,77 +1,53 @@
 -----BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1
+Version: GnuPG v1.4.12 (GNU/Linux)
 
-mQINBEw3u0ABEAC1+aJQpU59fwZ4mxFjqNCgfZgDhONDSYQFMRnYC1dzBpJHzI6b
-fUBQeaZ8rh6N4kZ+wq1eL86YDXkCt4sCvNTP0eF2XaOLbmxtV9bdpTIBep9bQiKg
-5iZaz+brUZlFk/MyJ0Yz//VQ68N1uvXccmD6uxQsVO+gx7rnarg/BGuCNaVtGwy+
-S98g8Begwxs9JmGa8pMCcSxtC7fAfAEZ02cYyrw5KfBvFI3cHDdBqrEJQKwKeLKY
-GHK3+H1TM4ZMxPsLuR/XKCbvTyl+OCPxU2OxPjufAxLlr8BWUzgJv6ztPe9imqpH
-Ppp3KuLFNorjPqWY5jSgKl94W/CO2x591e++a1PhwUn7iVUwVVe+mOEWnK5+Fd0v
-VMQebYCXS+3dNf6gxSvhz8etpw20T9Ytg4EdhLvCJRV/pYlqhcq+E9le1jFOHOc0
-Nc5FQweUtHGaNVyn8S1hvnvWJBMxpXq+Bezfk3X8PhPT/l9O2lLFOOO08jo0OYiI
-wrjhMQQOOSZOb3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VRWP5Pzmxc6/ZXU4ZhZQARAQABiQIlBBgBAgAPBQJXtiM+AhsMBQkJ
+ZgGAAAoJEH9DgoDvjTSfbWYQALwafIQK9avVNIuhMsyYPa/yHf6rUOLqrYO1GCmj
+vyG4cYmryzdxyfcXEmuE5QAIbEKSISrcO6Nvjt9PwLCjR/dUvco0f0YFTPv+kamn
++Bwp2Zt6d3MenXC6mLXPHR4OqFjzCpUT8kFwycvGPsuqZQ/CO0qzLDmAGTY+4ly3
+9aQEsQyFhV3P+6SWnaC2TldWpfG/2pCSaSa8dbYbRe3SUNKXwT8kw3WoQYNofF6n
+or8oFVA+UIVlvHc5h7L3tfFylRy5CwtR5rBQtoBicRVxEQc7ARNmB1XWuPntMQl/
+N1Fcfc+KSILFblAR6eVv+6BhMvRqzxqe81AEAP+oKVVwJ7H+wTQun2UKAgZATDWP
+/LQsYinmLADpraDPqxT2WJe8kjszMDQZCK+jhsVrhZdkiw9EHAM0z7BKz6JERmLu
+TIEcickkTfzbJWXZgv40Bvl99yPMswnR1lQHD7TKxyHYrI7dzJQri4mbORg4lOnZ
+3Tyodv21Ocf4as2No1p6esZW+M46zjZeO8zzExmmENI2+P7/VUt+LWyQFiqRM0iW
+zGioYMWgVePywFGaTV51/0uF9ymHHC7BDIcLgUWHdg/1B67jR5YQfzPJUqLhnylt
+1sjDRQIlf+3U+ddvre2YxX/rYUI2gBT32QzQrv016KsiZO+N+Iya3B4D68s6xxQS
+3xJn
+=mMjt
 -----END PGP PUBLIC KEY BLOCK-----
diff --git a/functions b/functions
index 099101540..c19a19cd0 100644
--- a/functions
+++ b/functions
@@ -129,7 +129,7 @@ install_puppet() {
         if dpkg -l $PUPPET_RELEASE_FILE >/dev/null 2>&1; then
             $SUDO apt-get purge -y $PUPPET_RELEASE_FILE
         fi
-        echo "deb ${NODEPOOL_PUPPETLABS_MIRROR} xenial PC1" | $SUDO tee /etc/apt/sources.list.d/puppetlabs.list
+        echo "deb ${NODEPOOL_PUPPETLABS_MIRROR} `lsb_release -s -c` PC1" | $SUDO tee /etc/apt/sources.list.d/puppetlabs.list
         $SUDO apt-key add files/GPG-KEY-puppetlabs
         # TODO(emilien): figure what installed /etc/default/puppet on the xenial nodepool image
         # We have no problem on Trusty but on Xenial we need to remove /etc/default/puppet before