24381f67ee
warning: Unrecognised escape sequence '\/' in file modules/apt/manifests/ppa.pp at line 2 Was getting thrown. Using tr seems to work well here. Change-Id: I82996736ba15e9b4ff5125fad142aae1b286d395
31 lines
945 B
Puppet
31 lines
945 B
Puppet
define apt::ppa($ensure = present) {
|
|
$has_ppa = "/usr/bin/test -f /etc/apt/sources.list.d/`echo $name | cut -f2 -d: | tr / -`*list"
|
|
case $ensure {
|
|
present: {
|
|
exec { "Add $name PPA":
|
|
path => "/usr/sbin:/usr/bin:/sbin:/bin",
|
|
environment => "HOME=/root",
|
|
command => "add-apt-repository $name ; apt-get update",
|
|
user => "root",
|
|
group => "root",
|
|
logoutput => on_failure,
|
|
unless => "$has_ppa",
|
|
}
|
|
}
|
|
absent: {
|
|
exec { "Add $name PPA":
|
|
path => "/usr/sbin:/usr/bin:/sbin:/bin",
|
|
environment => "HOME=/root",
|
|
command => "add-apt-repository --remove $name ; apt-get update",
|
|
user => "root",
|
|
group => "root",
|
|
logoutput => on_failure,
|
|
unless => "$has_ppa",
|
|
}
|
|
}
|
|
default: {
|
|
fail "Invalid 'ensure' value '$ensure' for ppa"
|
|
}
|
|
}
|
|
}
|