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
This commit is contained in:
Clark Boylan 2012-06-06 20:31:18 +00:00
parent 5c00b92151
commit 9653ee965a
2 changed files with 21 additions and 11 deletions

@ -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':

@ -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'],