3a31943b1f
Change-Id: Id9169a80a59c3de0fb3952955ad2cea502ded2b7 Reviewed-on: https://review.openstack.org/257 Reviewed-by: James E. Blair <corvus@inaugust.com> Tested-by: Jenkins
31 lines
952 B
Puppet
31 lines
952 B
Puppet
define apt::ppa($ensure = present) {
|
|
$has_ppa = "/usr/bin/test -f /etc/apt/sources.list.d/`echo $name | cut -f2 -d: | sed 's/\//-/'`*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"
|
|
}
|
|
}
|
|
}
|