add a clear squid cache and clean a few things up

This commit is contained in:
John Bintz 2012-10-03 18:09:23 -04:00
parent 882ec74fe0
commit 2d5cfed24a
6 changed files with 30 additions and 5 deletions

View File

@ -5,7 +5,7 @@ class god {
require => Class['ruby']
}
$bin = "${ruby::path}//god"
$bin = "${ruby::path}/god"
$dir = config_path("god.d")
$pid = pid_path($name)
$log = log_path($name)

View File

@ -72,6 +72,11 @@ class squid($version = '', $user = 'proxy', $group = 'proxy', $config_template,
path => $::base::path
}
file { "${sbin}/clear-squid-cache":
content => template('squid/clear-squid-cache'),
mode => 0755
}
exec { 'cache_dir_perms_again':
command => "chown -R ${user}:${group} ${cache_dir}",
path => $::base::path,

View File

@ -0,0 +1,20 @@
#!/bin/bash
target="<%= @cache_dir %>$(date +%Y%m%d%H%M%S)"
if [ $UID -ne 0 ]; then
sudo $0
exit
fi
god stop squid
while [ "$(pgrep squid3 | wc -l)" -ne 0 ]; do
sleep 1
done
mv <%= @cache_dir %> "$target"
mkdir <%= @cache_dir %>
chown -R <%= @user %>:<%= @group %> <%= @cache_dir %>
squid3 -z
god start squid
rm -Rf "$target"

View File

@ -1,4 +1,4 @@
<%= scope.function_template('base/init-d-header') %>
<%= scope.function_template([ 'base/init-d-header' ]) %>
<%= init_d_prolog %>
<%= init_d_prerun %>
@ -19,5 +19,5 @@ stop() {
echo "done"
}
<%= scope.function_template('base/init-d-actions') %>
<%= scope.function_template([ 'base/init-d-actions' ]) %>

View File

@ -3,7 +3,7 @@ define remotedeb($url, $version) {
exec { "remotedeb-${name}":
command => "curl -o ${deb} ${url} && dpkg -i ${deb}",
unless => "test $(dpkg -l ${name} | grep ${version} | wc -l) -eq 0",
unless => "test $(dpkg -l ${name} | grep ${version} | wc -l) -ne 0",
path => $base::path
}
}

View File

@ -7,6 +7,6 @@ RUBYLIB="${PWD}/lib:${PWD}/shared/lib" \
--confdir=$PWD \
--modulepath=$PWD/modules:$PWD/shared/modules:$PWD/shared/additional-modules \
--templatedir=$PWD/shared/templates:$PWD/templates \
-v $@ \
-v --no-report $@ \
manifests/site.pp