From b649e95885719b4f39ba17a1a9bdbc1f35d02c72 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 7 Mar 2014 18:16:53 -0300 Subject: Make sure we have a puppet repo --- manifests/master/update.pp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/manifests/master/update.pp b/manifests/master/update.pp index ddc8ba1..f996f86 100644 --- a/manifests/master/update.pp +++ b/manifests/master/update.pp @@ -2,6 +2,14 @@ class puppet::master::update( $ensure = present, $method = hiera('puppet::master::update::method', 'cron') ) { + # make sure we have a puppet repo + exec { "make-puppet-repo": + command => "/bin/sh -c 'mkdir -p /var/git/repositories/puppet.git && cd /var/git/repositories/puppet.git && git --bare init'", + unless => "/bin/sh -c '[ -e /var/git/repositories/puppet.git ]'", + user => gitolite, + require => [ User['gitolite'], File['/var/git/repositories'] ], + } + # puppet update script file { "/usr/local/sbin/update-puppet-conf.sh": source => "puppet:///modules/puppet/update-puppet-conf.sh", @@ -25,14 +33,15 @@ class puppet::master::update( # use a post-update hook file { '/var/git/repositories/puppet.git/hooks/post-update': - mode => 0750, - owner => gitolite, - group => gitolite, - ensure => $method ? { + mode => 0750, + owner => gitolite, + group => gitolite, + ensure => $method ? { 'cron' => $ensure, default => present, }, - source => "puppet:///modules/puppet/post-update.sh", + source => "puppet:///modules/puppet/post-update.sh", + require => Exec['make-puppet-repo'], } # needed by the post-update hook above -- cgit v1.2.3