From 69d68b733a1b52fa7f6fb9637c8855e1f4f9b7df Mon Sep 17 00:00:00 2001 From: Ralph Bolton Date: Thu, 8 Nov 2018 10:27:15 +0000 Subject: [PATCH 1/2] Stop using Apt class to avoid duplicate declaration and use conf.d file to make Apt use the proxy --- manifests/package/apt.pp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/manifests/package/apt.pp b/manifests/package/apt.pp index 05f7e1c..aadfe86 100644 --- a/manifests/package/apt.pp +++ b/manifests/package/apt.pp @@ -1,14 +1,12 @@ # package/apt.pp (private class) -# Uses the puppetlabs-apt module to manage apt package manager proxies -# https://forge.puppetlabs.com/puppetlabs/apt +# Writes a conf.d file to make Apt use the proxy class httpproxy::package::apt { - - class { '::apt': - proxy => { - 'ensure' => $httpproxy::packagemanager::ensure, - 'host' => $httpproxy::http_proxy, - 'port' => $httpproxy::http_proxy_port, - }, + file { 'apt_via_proxy': + path => '/etc/apt/apt.conf.d/05proxy', + ensure => $httpproxy::packagemanager::ensure, + owner => 'root', + group => 'root', + mode => '0644', + content => "Acquire::http::Proxy \"http://${httpproxy::http_proxy}:${httpproxy::http_proxy_port}\";" } - contain '::apt' } From 9a11b5cb291cb2e335fa778eabfb6b91fb74c5df Mon Sep 17 00:00:00 2001 From: Ralph Bolton Date: Thu, 8 Nov 2018 10:46:46 +0000 Subject: [PATCH 2/2] Reformatted to resolve lint failures --- manifests/package/apt.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/package/apt.pp b/manifests/package/apt.pp index aadfe86..21a6c1b 100644 --- a/manifests/package/apt.pp +++ b/manifests/package/apt.pp @@ -2,11 +2,11 @@ # Writes a conf.d file to make Apt use the proxy class httpproxy::package::apt { file { 'apt_via_proxy': - path => '/etc/apt/apt.conf.d/05proxy', ensure => $httpproxy::packagemanager::ensure, + path => '/etc/apt/apt.conf.d/05proxy', owner => 'root', group => 'root', mode => '0644', - content => "Acquire::http::Proxy \"http://${httpproxy::http_proxy}:${httpproxy::http_proxy_port}\";" + content => "Acquire::http::Proxy \"http://${httpproxy::http_proxy}:${httpproxy::http_proxy_port}\";", } }