system-config/modules/apt/manifests/ppa.pp
Monty Taylor 24381f67ee Silence unknown escape sequence warning.
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
2012-03-26 16:50:16 -07:00

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"
}
}
}