From fc907004a75ab2f8f8302706150b68a9cdd6baf0 Mon Sep 17 00:00:00 2001
From: Varac <varac@leap.se>
Date: Sat, 24 Jun 2017 12:14:10 +0200
Subject: [PATCH] Add configured apt component to the unattended-upgrades
 whitelist

Resolves: #8792
---
 .../site_apt/files/Debian/51unattended-upgrades-leap        | 6 ------
 puppet/modules/site_apt/manifests/unattended_upgrades.pp    | 3 +--
 .../modules/site_apt/templates/51unattended-upgrades-leap   | 5 +++++
 3 files changed, 6 insertions(+), 8 deletions(-)
 delete mode 100644 puppet/modules/site_apt/files/Debian/51unattended-upgrades-leap
 create mode 100644 puppet/modules/site_apt/templates/51unattended-upgrades-leap

diff --git a/puppet/modules/site_apt/files/Debian/51unattended-upgrades-leap b/puppet/modules/site_apt/files/Debian/51unattended-upgrades-leap
deleted file mode 100644
index bbaac6a2..00000000
--- a/puppet/modules/site_apt/files/Debian/51unattended-upgrades-leap
+++ /dev/null
@@ -1,6 +0,0 @@
-// this file is managed by puppet !
-
-Unattended-Upgrade::Allowed-Origins {
-  "leap.se:stable";
-}
-
diff --git a/puppet/modules/site_apt/manifests/unattended_upgrades.pp b/puppet/modules/site_apt/manifests/unattended_upgrades.pp
index 42f1f4c6..ddadd35a 100644
--- a/puppet/modules/site_apt/manifests/unattended_upgrades.pp
+++ b/puppet/modules/site_apt/manifests/unattended_upgrades.pp
@@ -11,8 +11,7 @@ class site_apt::unattended_upgrades {
 
   # configure LEAP upgrades
   apt::apt_conf { '51unattended-upgrades-leap':
-    source      => [
-      "puppet:///modules/site_apt/${::lsbdistid}/51unattended-upgrades-leap"],
+    content     => template('site_apt/51unattended-upgrades-leap'),
     require     => Package['unattended-upgrades'],
     refresh_apt => false,
   }
diff --git a/puppet/modules/site_apt/templates/51unattended-upgrades-leap b/puppet/modules/site_apt/templates/51unattended-upgrades-leap
new file mode 100644
index 00000000..3e28531f
--- /dev/null
+++ b/puppet/modules/site_apt/templates/51unattended-upgrades-leap
@@ -0,0 +1,5 @@
+// this file is managed by puppet !
+
+Unattended-Upgrade::Origins-Pattern {
+  "site=deb.leap.se,component=<%= @apt_platform_component %>";
+}
-- 
GitLab