key => '46925553',
key_server => 'subkeys.pgp.net',
pin => '-10',
- include_src => true
+ include_src => true,
+ include_deb => true
}
If you would like to configure your system so the source is the Puppet Labs APT repository
key_server: 'subkeys.pgp.net'
pin: '-10'
include_src: 'true'
+ include_deb: 'true'
'puppetlabs':
location: 'http://apt.puppetlabs.com'
}
if $ensure == 'present' {
- ::apt::pin { "hold ${package} at ${version}":
+ ::apt::pin { "hold_${package}":
packages => $package,
version => $version,
priority => $priority,
}
} else {
- ::apt::pin { "hold ${package} at ${version}":
+ ::apt::pin { "hold_${package}":
ensure => 'absent',
}
}
default: { fail('Valid values for disable_keys are true or false') }
}
- $proxy_set = $proxy_host ? {
- undef => absent,
- default => present
- }
-
- file { '01proxy':
- ensure => $proxy_set,
- path => "${apt_conf_d}/01proxy",
- content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";\n",
- notify => Exec['apt_update'],
- mode => '0644',
- owner => root,
- group => root,
+ case $proxy_host {
+ false, '', undef: {
+ file { '01proxy':
+ ensure => absent,
+ path => "${apt_conf_d}/01proxy",
+ notify => Exec['apt_update'],
+ }
+ }
+ default: {
+ file { '01proxy':
+ ensure => present,
+ path => "${apt_conf_d}/01proxy",
+ content => "Acquire::http::Proxy \"http://${proxy_host}:${proxy_port}\";\n",
+ notify => Exec['apt_update'],
+ mode => '0644',
+ owner => root,
+ group => root,
+ }
+ }
}
file { 'old-proxy-file':
}
}
}
+ '': {
+ fail('Unable to determine lsbdistid, is lsb-release installed?')
+ }
default: {
fail("Unsupported lsbdistid (${::lsbdistid})")
}
if defined(Class[apt]) {
$proxy_host = $apt::proxy_host
$proxy_port = $apt::proxy_port
- case $proxy_host {
- false, '': {
+ case $proxy_host {
+ false, '', undef: {
$proxy_env = []
- }
- default: {$proxy_env = ["http_proxy=http://${proxy_host}:${proxy_port}", "https_proxy=http://${proxy_host}:${proxy_port}"]}
+ }
+ default: {
+ $proxy_env = ["http_proxy=http://${proxy_host}:${proxy_port}", "https_proxy=http://${proxy_host}:${proxy_port}"]
+ }
}
} else {
$proxy_env = []
$release = 'UNDEF',
$repos = 'main',
$include_src = true,
+ $include_deb = true,
$required_packages = false,
$key = undef,
$key_server = 'keyserver.ubuntu.com',
EOS
apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to match(/apt_update/)
+ expect(r.stdout).to match(/Exec\[apt_update\]/)
end
end
end
EOS
apply_manifest(pp, :catch_failures => true) do |r|
- expect(r.stdout).to_not match(/apt_update/)
+ expect(r.stdout).to_not match(/Exec\[apt_update\]/)
end
end
end
# Attempted workaround for problems seen on debian with
# something holding the package database open.
- #shell('killall -9 apt-get')
- #shell('killall -9 dpkg')
+ shell('killall -9 apt-get', { :acceptable_exit_codes => [0,1] })
+ shell('killall -9 dpkg', { :acceptable_exit_codes => [0,1] })
apply_manifest(pp, :catch_failures => true)
end
end
end
+
+ describe "With lsb-release not installed" do
+ let(:facts) { { :lsbdistid => '' } }
+ let (:title) { 'my_package' }
+
+ it do
+ expect {
+ should compile
+ }.to raise_error(Puppet::Error, /Unable to determine lsbdistid, is lsb-release installed/)
+ end
+ end
+
end
:priority => 1001,
})
- should contain_apt__pin("hold #{title} at #{params[:version]}").with({
+ should contain_apt__pin("hold_#{title}").with({
:ensure => 'present',
:packages => title,
:version => params[:version],
:ensure => params[:ensure],
})
- should contain_apt__pin("hold #{title} at #{params[:version]}").with({
+ should contain_apt__pin("hold_#{title}").with({
:ensure => params[:ensure],
})
end
:priority => params[:priority],
})
- should contain_apt__pin("hold #{title} at #{params[:version]}").with({
+ should contain_apt__pin("hold_#{title}").with({
:ensure => 'present',
:packages => title,
:version => params[:version],
:release => 'karmic',
:repos => 'main',
:include_src => true,
+ :include_deb => true,
:required_packages => false,
:key => false,
:key_server => false,
if param_hash[:architecture]
arch = "[arch=#{param_hash[:architecture]}] "
end
- content << "\ndeb #{arch}#{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n"
-
+ if param_hash[:include_deb]
+ content << "\ndeb #{arch}#{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n"
+ end
if param_hash[:include_src]
content << "deb-src #{arch}#{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n"
end
#file generated by puppet
# <%= @comment %>
+<%- if @include_deb then -%>
deb <% if @architecture %>[arch=<%= @architecture %>] <% end %><%= @location %> <%= @release_real %> <%= @repos %>
+<%- end -%>
<%- if @include_src then -%>
deb-src <% if @architecture %>[arch=<%= @architecture %>] <% end %><%= @location %> <%= @release_real %> <%= @repos %>
<%- end -%>