module-puppetlabs-apt/manifests/ppa.pp
Nan Liu 2dcec036ca Add logoutput on_failure for all exec resources.
We need more information to debug issues on exec failure. This change
enables logouput => on_failure.
2012-06-07 14:53:41 -07:00

43 lines
1.2 KiB
Puppet

# ppa.pp
define apt::ppa(
$release = $::lsbdistcodename
) {
include apt::params
include apt::update
$sources_list_d = $apt::params::sources_list_d
if ! $release {
fail('lsbdistcodename fact not available: release parameter required')
}
$filename_without_slashes = regsubst($name, '/', '-', G)
$filename_without_dots = regsubst($filename_without_slashes, '\.', '_', G)
$filename_without_ppa = regsubst($filename_without_dots, '^ppa:', '', G)
$sources_list_d_filename = "${filename_without_ppa}-${release}.list"
if ! defined(Package['python-software-properties']) {
package { 'python-software-properties': }
}
exec { "add-apt-repository-${name}":
command => "/usr/bin/add-apt-repository ${name}",
creates => "${sources_list_d}/${sources_list_d_filename}",
logoutput => 'on_failure',
require => [ File[$sources_list_d],
Package['python-software-properties'] ],
notify => Exec['apt_update'],
}
file { "${sources_list_d}/${sources_list_d_filename}":
ensure => file,
require => Exec["add-apt-repository-${name}"],
}
# Need anchor to provide containment for dependencies.
anchor { "apt::ppa::${name}":
require => Class['apt::update'],
}
}