From 4bf4a1ea7f9cd0752f9b9bf01e9c1ba1d09f2337 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sat, 4 Aug 2012 09:55:37 -0500 Subject: [PATCH] Replace manual git work with vcsrepo module. Change-Id: Ia0f3acd50aab07cc83d13cd12c8f7fc67f1c697d Reviewed-on: https://review.openstack.org/10832 Reviewed-by: Clark Boylan Reviewed-by: James E. Blair Approved: Monty Taylor Tested-by: Jenkins --- manifests/init.pp | 32 ++++++++------------------------ manifests/site.pp | 9 ++++++--- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index e0440c4..a28bd1e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,26 +1,9 @@ -class vcs { -# if we already have the git repo the pull updates - - exec { "update_meetbot_repo": - command => "git pull --ff-only", - cwd => "/opt/meetbot", - path => "/bin:/usr/bin", - onlyif => "test -d /opt/meetbot" - } - -# otherwise get a new clone of it - - exec { "clone_meebot_repo": - command => "git clone https://github.com/openstack-ci/meetbot.git /opt/meetbot", - path => "/bin:/usr/bin", - onlyif => "test ! -d /opt/meetbot" - } -} - class meetbot { - stage { 'first': before => Stage['main'] } - class { 'vcs': - stage => 'first' + + vcsrepo { "/opt/meetbot": + ensure => latest, + provider => git, + source => "https://github.com/openstack-ci/meetbot.git", } user { "meetbot": @@ -41,7 +24,7 @@ class meetbot { service { "nginx": ensure => running, - hasrestart => true + hasrestart => true, } file { "/var/lib/meetbot": @@ -54,7 +37,8 @@ class meetbot { ensure => directory, recurse => true, source => "/opt/meetbot/MeetBot", - require => Package["supybot"] + require => [Package["supybot"], + Vcsrepo["/opt/meetbot"]] } file { "/etc/nginx/sites-enabled/default": diff --git a/manifests/site.pp b/manifests/site.pp index 12d6928..feafdca 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -88,7 +88,8 @@ define meetbot::site($nick, $nickpass, $network, $server, $url=$fqdn, $channels, recurse => true, source => "/opt/meetbot/ircmeeting", owner => 'meetbot', - require => File["/var/lib/meetbot/${name}"] + require => [Vcsrepo["/opt/meetbot"], + File["/var/lib/meetbot/${name}"]] } file { "/var/lib/meetbot/${name}/ircmeeting/meetingLocalConfig.py": @@ -114,7 +115,9 @@ define meetbot::site($nick, $nickpass, $network, $server, $url=$fqdn, $channels, service { "${name}-meetbot": provider => upstart, ensure => running, - require => File["/etc/init/${name}-meetbot.conf"], - subscribe => [File["/usr/share/pyshared/supybot/plugins/MeetBot"], File["/var/lib/meetbot/${name}/ircmeeting"]] + require => [Vcsrepo["/opt/meetbot"], + File["/etc/init/${name}-meetbot.conf"]], + subscribe => [File["/usr/share/pyshared/supybot/plugins/MeetBot"], + File["/var/lib/meetbot/${name}/ircmeeting"]] } }