From 9653ee965a5fc5d89d97014bbc145684919ef079 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 6 Jun 2012 20:31:18 +0000 Subject: [PATCH] Fix etherpad lite's use of git. Before this commit etherpad lite would run a git pull or clone every time puppet was run. Make that behavior toggleable. Now etherpad lite will only clone and checkout the branch specified. This makes puppet less chatty to upstream. Also, fix a quoting issue in etherpad lite's mysql manifest. The eplite user's password was being reset each time puppet ran due to having single quotes around backticks in the unless clause. Change-Id: I74418ebaba82902906d04f18386de6f6bd6259bb --- manifests/init.pp | 30 ++++++++++++++++++++---------- manifests/mysql.pp | 2 +- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 7408883..fc1d695 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -3,16 +3,24 @@ define git_repo ( $repo, $dest, $user = 'root', - $branch = 'master' + $branch = 'master', + $clone_only = undef ) { + if $clone_only == 'true' { + $checkout_condition = "false" + } + else { + $checkout_condition = "test -d ${dest}" + } + # if we already have the git repo the pull updates exec { "update_${title}": command => "git pull --ff-only origin ${branch}", cwd => $dest, path => '/bin:/usr/bin', user => $user, - onlyif => "test -d ${dest}", + onlyif => $checkout_condition, before => Exec["clone_${title}"], } @@ -108,10 +116,11 @@ class etherpad_lite ( } git_repo { 'nodejs_repo': - repo => 'https://github.com/joyent/node.git', - dest => "${base_install_dir}/nodejs", - branch => 'v0.6.16-release', - require => Package['git'] + repo => 'https://github.com/joyent/node.git', + dest => "${base_install_dir}/nodejs", + branch => 'v0.6.16-release', + clone_only => 'true', + require => Package['git'] } package { ['gzip', @@ -135,10 +144,11 @@ class etherpad_lite ( } git_repo { 'etherpad_repo': - repo => 'https://github.com/Pita/etherpad-lite.git', - dest => "${base_install_dir}/etherpad-lite", - user => $ep_user, - require => Package['git'] + repo => 'https://github.com/Pita/etherpad-lite.git', + dest => "${base_install_dir}/etherpad-lite", + user => $ep_user, + clone_only => 'true', + require => Package['git'] } exec { 'install_etherpad_dependencies': diff --git a/manifests/mysql.pp b/manifests/mysql.pp index 508c51e..8af56ca 100644 --- a/manifests/mysql.pp +++ b/manifests/mysql.pp @@ -27,7 +27,7 @@ class etherpad_lite::mysql { } -> exec { "grant-etherpad-lite-db": - unless => "mysql -ueplite -p'`grep password ${etherpad_lite::base_install_dir}/etherpad-lite/settings.json | cut -d: -f2 | sed -e 's/.*\"\(.*\)\".*/\1/'`' etherpad-lite", + unless => "mysql -ueplite -p\"`grep password ${etherpad_lite::base_install_dir}/etherpad-lite/settings.json | cut -d: -f2 | sed -e 's/.*\"\(.*\)\".*/\1/'`\" etherpad-lite", path => ['/bin', '/usr/bin'], command => "mysql --defaults-file=/etc/mysql/debian.cnf -e \"grant all on \`etherpad-lite\`.* to 'eplite'@'localhost' identified by '`grep password ${etherpad_lite::base_install_dir}/etherpad-lite/settings.json | cut -d: -f2 | sed -e 's/.*\"\(.*\)\".*/\1/'`';\" mysql", require => [Service['mysql'],