system-config/modules/jenkins_slave/manifests/slavecirepo.pp
Monty Taylor ecab1f6e23 Need proper paths for apt-get build-dep to work.
Change-Id: Ib8211facc9d7cc248b97f3be85179157b2e31112
2011-07-23 15:40:44 -04:00

39 lines
1.3 KiB
Puppet

define slavecirepo($ensure = present) {
$repo_there = "test -d /home/jenkins/openstack-ci"
case $ensure {
present: {
exec { "Clone openstack-ci git repo":
path => "/usr/sbin:/usr/bin:/sbin:/bin",
environment => "HOME=/home/jenkins",
command => "sudo -H -u jenkins -i git clone git://github.com/openstack/openstack-ci.git /home/jenkins/openstack-ci",
user => "root",
group => "root",
unless => "$repo_there",
logoutput => on_failure,
}
exec { "Update openstack-ci git repo":
path => "/usr/sbin:/usr/bin:/sbin:/bin",
environment => "HOME=/home/jenkins",
command => "sudo -H -u jenkins -i bash -c 'cd /home/jenkins/openstack-ci && git pull'",
user => "root",
group => "root",
onlyif => "$repo_there",
logoutput => on_failure,
}
}
absent: {
exec { "Remove OpenStack git repo":
path => "/usr/sbin:/usr/bin:/sbin:/bin",
environment => "HOME=/root",
command => "rm -rf /home/jenkins/openstack-ci",
user => "root",
group => "root",
onlyif => "$repo_there",
}
}
default: {
fail "Invalid 'ensure' value '$ensure' for slavecirepo"
}
}
}