From 979f22cda0ebda61fe8d14191bfd47ea27c2ccf7 Mon Sep 17 00:00:00 2001 From: Ossi Salmi Date: Mon, 20 Jan 2014 01:26:11 +0200 Subject: [PATCH] puppet: Add passenger config.ru to the module --- puppet/files/config.ru.2 | 17 +++++++++++++++++ puppet/files/config.ru.3 | 29 +++++++++++++++++++++++++++++ puppet/manifests/init.pp | 6 +++++- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 puppet/files/config.ru.2 create mode 100644 puppet/files/config.ru.3 diff --git a/puppet/files/config.ru.2 b/puppet/files/config.ru.2 new file mode 100644 index 0000000..918af94 --- /dev/null +++ b/puppet/files/config.ru.2 @@ -0,0 +1,17 @@ +$0 = "master" + +# if you want debugging: +# ARGV << "--debug" + +ARGV << "--rack" + +# Rack applications typically don't start as root. Set --confdir and --vardir +# to prevent reading configuration from ~puppet/.puppet/puppet.conf and writing +# to ~puppet/.puppet +ARGV << "--confdir" << "/etc/puppet" +ARGV << "--vardir" << "/var/lib/puppet" + +require 'puppet/application/master' +# we're usually running inside a Rack::Builder.new {} block, +# therefore we need to call run *here*. +run Puppet::Application[:master].run diff --git a/puppet/files/config.ru.3 b/puppet/files/config.ru.3 new file mode 100644 index 0000000..26905c8 --- /dev/null +++ b/puppet/files/config.ru.3 @@ -0,0 +1,29 @@ +$0 = "master" + +# if you want debugging: +# ARGV << "--debug" + +ARGV << "--rack" + +# Rack applications typically don't start as root. Set --confdir and --vardir +# to prevent reading configuration from ~puppet/.puppet/puppet.conf and writing +# to ~puppet/.puppet +ARGV << "--confdir" << "/etc/puppet" +ARGV << "--vardir" << "/var/lib/puppet" + +# NOTE: it's unfortunate that we have to use the "CommandLine" class +# here to launch the app, but it contains some initialization logic +# (such as triggering the parsing of the config file) that is very +# important. We should do something less nasty here when we've +# gotten our API and settings initialization logic cleaned up. +# +# Also note that the "$0 = master" line up near the top here is +# the magic that allows the CommandLine class to know that it's +# supposed to be running master. +# +# --cprice 2012-05-22 + +require 'puppet/util/command_line' +# we're usually running inside a Rack::Builder.new {} block, +# therefore we need to call run *here*. +run Puppet::Util::CommandLine.new.execute diff --git a/puppet/manifests/init.pp b/puppet/manifests/init.pp index a937c5d..be11476 100644 --- a/puppet/manifests/init.pp +++ b/puppet/manifests/init.pp @@ -665,6 +665,7 @@ class puppet::server::passenger { owner => "root", group => "root", } + file { "/var/lib/passenger/puppet/config.ru": ensure => present, mode => "0444", @@ -676,7 +677,10 @@ class puppet::server::passenger { "ubuntu" => "puppet", default => "root", }, - source => "/usr/share/puppet/ext/rack/files/config.ru", + source => $::puppetversion ? { + /^[0-2]\./ => "puppet:///modules/puppet/config.ru.2", + default => "puppet:///modules/puppet/config.ru.3", + }, } }