lots of god and varnish work

This commit is contained in:
John Bintz 2012-06-01 14:24:53 -04:00
parent c5372149d8
commit eccb9e1cee
5 changed files with 13 additions and 5 deletions

View File

@ -1,4 +1,4 @@
<%= scope.function_template('base/init-d-header') %>
<%= scope.function_template(['base/init-d-header']) %>
<% bin = scope.lookupvar('god::bin') %>
<%= init_d_prolog %>
@ -36,5 +36,5 @@ stop() {
echo "$NAME."
}
<%= scope.function_template('base/init-d-actions') %>
<%= scope.function_template(['base/init-d-actions']) %>

View File

@ -49,6 +49,7 @@ class varnish($version, $vcl_template, $store_file_mb = 1024) {
god_init { $name:
start => $varnish_start,
stop => $varnish_stop,
dir => config_path('god.d'),
restart => "${varnish_stop} && ${varnish_start}",
pid_file => $pid,
ensure => present,

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 %>
@ -14,6 +14,7 @@ start() {
-f <%= scope.lookupvar('varnish::vcl_path') %> \
-s file,<%= scope.lookupvar('varnish::store_file_path') %>
RETVAL=$?
echo $RETVAL
if [ $RETVAL -eq 0 ]; then
<%= scope.lookupvar('varnish::ncsa_bin') %> \
-P <%= scope.lookupvar('varnish::ncsa_pid') %> \
@ -40,5 +41,5 @@ stop() {
echo "done"
}
<%= scope.function_template('base/init-d-actions') %>
<%= scope.function_template([ 'base/init-d-actions' ]) %>

View File

@ -4,6 +4,8 @@ Puppet::Type.type(:god_init).provide(:install) do
desc "Install a God script"
def create
FileUtils.mkdir_p File.dirname(file)
File.open(file, 'wb') { |fh| fh.print processed_config }
end
@ -21,7 +23,7 @@ Puppet::Type.type(:god_init).provide(:install) do
private
def file
"/etc/god.d/#{@resource[:name]}.god"
File.join(@resource[:dir], "#{@resource[:name]}.god")
end
def start

View File

@ -19,6 +19,10 @@ Puppet::Type.newtype(:god_init) do
desc "The command to restart/reload the process"
end
newparam(:dir) do
desc "The directory where god configs are held"
end
newparam(:pid_file) do
desc "A pid file"
end