Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Commit

Permalink
Add rack support for puppet 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien Thebo committed Oct 1, 2012
1 parent 82f4ade commit e7698e1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
File renamed without changes.
33 changes: 33 additions & 0 deletions files/config.ru/99-run-3.0.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.

# if puppet is not in your RUBYLIB:
# $LOAD_PATH.unshift('/opt/puppet/lib')

$0 = "master"

# if you want debugging:
# ARGV << "--debug"

ARGV << "--rack"

# Rack applications typically don't start as root. Set --confdir to prevent
# reading configuration from ~/.puppet/puppet.conf
ARGV << "--confdir" << "/etc/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
5 changes: 4 additions & 1 deletion manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@
concat::fragment { "run-puppet-master":
order => '99',
target => "${::puppet::params::puppet_confdir}/config.ru",
source => 'puppet:///modules/puppet/config.ru/99-run.rb',
source => $puppetversion ? {
/^2.7/ => 'puppet:///modules/puppet/config.ru/99-run-2.7.rb',
/^3.0/ => 'puppet:///modules/puppet/config.ru/99-run-3.0.rb',
},
}
}
}
Expand Down

0 comments on commit e7698e1

Please sign in to comment.