Proxy ensure parameter.
* 'https': Specifies whether to enable https proxies. Valid options: 'true' and 'false'. Default: 'false'.
+ * 'ensure': Optional parameter. Valid options: 'file', 'present', and 'absent'. Default: 'undef'. Prefer 'file' over 'present'.
+
* `purge`: Specifies whether to purge any existing settings that aren't managed by Puppet. Valid options: a hash made up from the following keys:
* 'sources.list': Specifies whether to purge any unmanaged entries from `sources.list`. Valid options: 'true' and 'false'. Default: 'false'.
$_purge = merge($::apt::purge_defaults, $purge)
validate_hash($proxy)
+ if $proxy['ensure'] {
+ validate_re($proxy['ensure'], ['file', 'present', 'absent'])
+ }
if $proxy['host'] {
validate_string($proxy['host'])
}
validate_hash($settings)
validate_hash($ppas)
- if $proxy['host'] {
+ if $_proxy['ensure'] == 'absent' or $_proxy['host'] {
apt::setting { 'conf-proxy':
+ ensure => $_proxy['ensure'],
priority => '01',
content => template('apt/_conf_header.erb', 'apt/proxy.erb'),
}
}
$proxy_defaults = {
- 'host' => undef,
- 'port' => 8080,
- 'https' => false,
+ 'ensure' => undef,
+ 'host' => undef,
+ 'port' => 8080,
+ 'https' => false,
}
$purge_defaults = {
/Acquire::https::proxy "https:\/\/localhost:8080\/";/
)}
end
+
+ context 'ensure=absent' do
+ let(:params) { { :proxy => { 'ensure' => 'absent'} } }
+ it { is_expected.to contain_apt__setting('conf-proxy').with({
+ :ensure => 'absent',
+ :priority => '01',
+ })}
+ end
end
context 'lots of non-defaults' do
let :params do