From be66917ffa19481a774354dc7649edfdbb109f6a Mon Sep 17 00:00:00 2001 From: palintir Date: Thu, 10 Nov 2016 15:09:25 +0000 Subject: [PATCH 1/2] Updated repo.pp to only install repo key if it is not already installed Modified exec{"apt_key_add_${normalized_name}":} for Debian installations to get the gpg key fingerprint of the repository and only add it if a key with the same fingerprintdoes not exist locally. --- manifests/repo.pp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/manifests/repo.pp b/manifests/repo.pp index 3f60778..cc61340 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -68,18 +68,22 @@ path => "/etc/apt/sources.list.d/${normalized_name}.list", mode => '0644', content => template('packagecloud/apt.erb'), + notify => Exec["apt_get_update_${normalized_name}"], } exec { "apt_key_add_${normalized_name}": command => "wget --auth-no-challenge -qO - ${base_url}/${repo_name}/gpgkey | apt-key add -", path => '/usr/bin/:/bin/', require => File[$normalized_name], + unless => "apt-key exportall | gpg --with-fingerprint | grep \"$(curl -L ${base_url}/${repo_name}/gpgkey | gpg --with-fingerprint $line | head -2 | tail -1 | cut -d'=' -f2 | cut -d ' ' -$ + notify => Exec["apt_get_update_${normalized_name}"], } exec { "apt_get_update_${normalized_name}": command => "apt-get update -o Dir::Etc::sourcelist=\"sources.list.d/${normalized_name}.list\" -o Dir::Etc::sourceparts=\"-\" -o APT::Get::List-Cleanup=\"0\"", path => '/usr/bin/:/bin/', require => Exec["apt_key_add_${normalized_name}"], + refreshonly => true, } } default: { From 0d928fde1a4968a2116ce260e6b140d4a6105ec3 Mon Sep 17 00:00:00 2001 From: palintir Date: Fri, 11 Nov 2016 11:10:59 +0000 Subject: [PATCH 2/2] Truncated line 78 "unless...." when editting :-( --- manifests/repo.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/repo.pp b/manifests/repo.pp index cc61340..008cb6c 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -75,7 +75,7 @@ command => "wget --auth-no-challenge -qO - ${base_url}/${repo_name}/gpgkey | apt-key add -", path => '/usr/bin/:/bin/', require => File[$normalized_name], - unless => "apt-key exportall | gpg --with-fingerprint | grep \"$(curl -L ${base_url}/${repo_name}/gpgkey | gpg --with-fingerprint $line | head -2 | tail -1 | cut -d'=' -f2 | cut -d ' ' -$ + unless => "apt-key exportall | gpg --with-fingerprint | grep \"$(curl -L ${base_url}/${repo_name}/gpgkey | gpg --with-fingerprint $line | head -2 | tail -1 | cut -d'=' -f2 | cut -d ' ' -f2-12)\"", notify => Exec["apt_get_update_${normalized_name}"], }