puppet 3.0.0 → 3.0.1.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (70) hide show
  1. data/Rakefile +24 -19
  2. data/bin/puppet +0 -6
  3. data/examples/modules/{sample-module.pp → sample_module.pp} +1 -1
  4. data/examples/modules/{sample-module → sample_module}/lib/puppet/parser/functions/hostname_to_dn.rb +0 -0
  5. data/examples/modules/{sample-module → sample_module}/manifests/init.pp +1 -1
  6. data/examples/modules/{sample-module → sample_module}/templates/sample.erb +0 -0
  7. data/ext/debian/puppetmaster.README.debian +1 -2
  8. data/ext/debian/puppetmaster.default +1 -28
  9. data/ext/debian/puppetmaster.init +49 -70
  10. data/ext/project_data.yaml +2 -2
  11. data/ext/rack/README +0 -15
  12. data/ext/rack/files/config.ru +4 -2
  13. data/ext/redhat/logrotate +1 -1
  14. data/ext/redhat/server.init +34 -49
  15. data/ext/redhat/server.sysconfig +2 -20
  16. data/ext/suse/client.init +10 -9
  17. data/ext/suse/puppet.spec +12 -25
  18. data/ext/suse/server.init +25 -15
  19. data/ext/windows/service/daemon.bat +1 -1
  20. data/ext/windows/service/daemon.rb +1 -1
  21. data/lib/puppet.rb +0 -6
  22. data/lib/puppet/application/agent.rb +1 -0
  23. data/lib/puppet/defaults.rb +2 -9
  24. data/lib/puppet/feature/eventlog.rb +0 -1
  25. data/lib/puppet/feature/rack.rb +1 -6
  26. data/lib/puppet/feature/rails.rb +0 -2
  27. data/lib/puppet/feature/rubygems.rb +5 -1
  28. data/lib/puppet/feature/ssh.rb +0 -1
  29. data/lib/puppet/feature/stomp.rb +0 -1
  30. data/lib/puppet/feature/zlib.rb +0 -1
  31. data/lib/puppet/network/http/rack/rest.rb +4 -1
  32. data/lib/puppet/rails/inventory_node.rb +26 -13
  33. data/lib/puppet/run.rb +1 -1
  34. data/lib/puppet/settings.rb +12 -7
  35. data/lib/puppet/util/command_line.rb +11 -0
  36. data/lib/puppet/util/rubygems.rb +7 -6
  37. data/lib/puppet/util/run_mode.rb +12 -11
  38. data/lib/puppet/util/zaml.rb +1 -1
  39. data/lib/puppet/version.rb +1 -1
  40. data/man/man5/puppet.conf.5 +4 -4
  41. data/spec/integration/defaults_spec.rb +4 -4
  42. data/spec/unit/network/http/rack/rest_spec.rb +13 -0
  43. data/spec/unit/run_spec.rb +11 -5
  44. data/spec/unit/util/rubygems_spec.rb +4 -2
  45. data/spec/unit/util/run_mode_spec.rb +9 -0
  46. data/spec/unit/util/zaml_spec.rb +53 -25
  47. metadata +2189 -2210
  48. data/examples/modules/sample-module/README.txt +0 -17
  49. data/ext/packaging/README-Solaris.md +0 -117
  50. data/ext/packaging/README.md +0 -89
  51. data/ext/packaging/tasks/00_utils.rb +0 -290
  52. data/ext/packaging/tasks/10_setupvars.rake +0 -64
  53. data/ext/packaging/tasks/apple.rake +0 -201
  54. data/ext/packaging/tasks/clean.rake +0 -5
  55. data/ext/packaging/tasks/deb.rake +0 -103
  56. data/ext/packaging/tasks/gem.rake +0 -55
  57. data/ext/packaging/tasks/ips.rake +0 -80
  58. data/ext/packaging/tasks/mock.rake +0 -88
  59. data/ext/packaging/tasks/release.rake +0 -56
  60. data/ext/packaging/tasks/rpm.rake +0 -39
  61. data/ext/packaging/tasks/ship.rake +0 -36
  62. data/ext/packaging/tasks/sign.rake +0 -79
  63. data/ext/packaging/tasks/tag.rake +0 -8
  64. data/ext/packaging/tasks/tar.rake +0 -20
  65. data/ext/packaging/tasks/version.rake +0 -20
  66. data/ext/suse/fileserver.conf +0 -12
  67. data/ext/suse/logrotate +0 -10
  68. data/ext/suse/puppet.conf +0 -25
  69. data/lib/puppet/network/http/mongrel/rest.rb +0 -104
  70. data/spec/integration/network/server/mongrel_spec.rb +0 -64
@@ -1,88 +0,0 @@
1
-
2
- def mock(mock_config, srpm)
3
- check_tool('mock')
4
- sh "mock -r #{mock_config} #{srpm}"
5
- end
6
-
7
- def srpm_file
8
- srpm = Dir["pkg/srpm/*.rpm"][0]
9
- check_file(srpm)
10
- srpm
11
- end
12
-
13
- def mock_el_family(mock_config)
14
- family = mock_config.split('-')[0]
15
- family = 'el' if family == 'pl'
16
- family
17
- end
18
-
19
- def mock_el_ver(mock_config)
20
- version = mock_config.split('-')[1]
21
- version = "f#{version}" if mock_config.split('-')[0] == 'fedora'
22
- version
23
- end
24
-
25
- def build_rpm_with_mock(is_rc, subdir)
26
- if is_rc
27
- mocks = @rc_mocks
28
- else
29
- mocks = @final_mocks
30
- end
31
-
32
- mocks.split(' ').each do |mock_config|
33
- family = mock_el_family(mock_config)
34
- version = mock_el_ver(mock_config)
35
- arch = mock_config.split('-')[2]
36
- result = "/var/lib/mock/#{mock_config}/result/*.rpm"
37
-
38
- mock(mock_config, srpm_file)
39
-
40
- Dir[result].each do |rpm|
41
- rpm.strip!
42
- unless ENV['RC_OVERRIDE'] == '1'
43
- if is_rc == FALSE and rpm =~ /[0-9]+rc[0-9]+\./
44
- puts "It looks like you might be trying to ship an RC to the production repos. Leaving rpm in #{result}. Pass RC_OVERRIDE=1 to override."
45
- next
46
- elsif is_rc and rpm !~ /[0-9]+rc[0-9]+\./
47
- puts "It looks like you might be trying to ship a production release to the development repos. Leaving rpm in #{result}. Pass RC_OVERRIDE=1 to override."
48
- next
49
- end
50
- end
51
-
52
- case File.basename(rpm)
53
- when /debuginfo/
54
- rm_rf(rpm)
55
- when /src\.rpm/
56
- cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/SRPMS")
57
- when /i.?86/
58
- cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/i386")
59
- when /x86_64/
60
- cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/x86_64")
61
- when /noarch/
62
- cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/i386")
63
- ln("pkg/#{family}/#{version}/#{subdir}/i386/#{File.basename(rpm)}", "pkg/#{family}/#{version}/#{subdir}/x86_64/")
64
- end
65
- end
66
- end
67
- end
68
-
69
-
70
- namespace :pl do
71
- task :setup_el_dirs do
72
- %x{mkdir -p pkg/el/{5,6}/{products,devel,dependencies}/{SRPMS,i386,x86_64}}
73
- %x{mkdir -p pkg/fedora/{f15,f16,f17}/{products,devel,dependencies}/{SRPMS,i386,x86_64}}
74
- end
75
-
76
- desc "Use specified mocks to make final rpms, keyed to PL infrastructure, pass MOCK to specifiy config"
77
- task :mock_final => [ "package:srpm", "pl:setup_el_dirs" ] do
78
- subdir = ENV['subdir'] || 'products'
79
- build_rpm_with_mock(FALSE, subdir)
80
- end
81
-
82
- desc "Use specified mocks to make RC rpms, keyed to PL infrastructure, pass MOCK to specify config"
83
- task :mock_rc => [ "package:srpm", "pl:setup_el_dirs" ] do
84
- subdir = 'devel'
85
- build_rpm_with_mock(TRUE, subdir)
86
- end
87
- end
88
-
@@ -1,56 +0,0 @@
1
- # These tasks are "release" chains that couple as much of the release process for a package as possible
2
-
3
- namespace :pl do
4
- if @build_gem
5
- desc "Build and ship a gem"
6
- task :release_gem do
7
- invoke_task("package:gem")
8
- if confirm_ship(FileList["pkg/*.gem"])
9
- invoke_task("pl:ship_gem")
10
- end
11
- end
12
- end
13
-
14
- desc "Release deb RCs, e.g. package:tar, pl:{deb_all_rc, sign_deb_changes, ship_debs}"
15
- task :release_deb_rc do
16
- load_keychain if has_tool('keychain')
17
- invoke_task("pl:deb_all_rc")
18
- invoke_task("pl:sign_deb_changes")
19
- if confirm_ship(FileList["pkg/deb/**/*"])
20
- invoke_task("pl:ship_debs")
21
- end
22
- end
23
-
24
- desc "Release deb FINALs, e.g. package:tar, pl:{deb_all, sign_deb_changes, ship_debs}"
25
- task :release_deb_final do
26
- load_keychain if has_tool('keychain')
27
- invoke_task("pl:deb_all")
28
- invoke_task("pl:sign_deb_changes")
29
- if confirm_ship(FileList["pkg/deb/**/*"])
30
- invoke_task("pl:ship_debs")
31
- end
32
- end
33
-
34
- desc "Release rpm RCs, e.g. package:tar, pl:{mock_rc, sign_rpms, ship_rpms, update_yum_repo}"
35
- task :release_rpm_rc do
36
- invoke_task("pl:mock_rc")
37
- invoke_task("pl:sign_rpms")
38
- if confirm_ship(FileList["pkg/el/**/*", "pkg/fedora/**/*"])
39
- invoke_task("pl:ship_rpms")
40
- invoke_task("pl:update_yum_repo")
41
- end
42
- end
43
-
44
- desc "Release rpm FINALs, e.g. package:tar, pl:{mock_final, sign_rpms, ship_rpms, update_yum_repo}"
45
- task :release_rpm_final do
46
- invoke_task("pl:mock_final")
47
- invoke_task("pl:sign_rpms")
48
- if confirm_ship(FileList["pkg/el/**/*", "pkg/fedora/**/*"])
49
- invoke_task("pl:ship_rpms")
50
- invoke_task("pl:update_yum_repo")
51
- end
52
- end
53
- end
54
-
55
-
56
-
@@ -1,39 +0,0 @@
1
- def build_rpm(buildarg = "-bs")
2
- check_tool('rpmbuild')
3
- temp = get_temp
4
- rpm_define = "--define \"%dist .el5\" --define \"%_topdir #{temp}\" "
5
- rpm_old_version = '--define "_source_filedigest_algorithm 1" --define "_binary_filedigest_algorithm 1" \
6
- --define "_binary_payload w9.gzdio" --define "_source_payload w9.gzdio" \
7
- --define "_default_patch_fuzz 2"'
8
- args = rpm_define + ' ' + rpm_old_version
9
- mkdir_pr temp, 'pkg/rpm', 'pkg/srpm', "#{temp}/SOURCES", "#{temp}/SPECS"
10
- if @sign_tar
11
- Rake::Task["pl:sign_tar"].invoke
12
- cp_p "pkg/#{@name}-#{@version}.tar.gz.asc", "#{temp}/SOURCES"
13
- end
14
- cp_p "pkg/#{@name}-#{@version}.tar.gz", "#{temp}/SOURCES"
15
- erb "ext/redhat/#{@name}.spec.erb", "#{temp}/SPECS/#{@name}.spec"
16
- sh "rpmbuild #{args} #{buildarg} --nodeps #{temp}/SPECS/#{@name}.spec"
17
- mv FileList["#{temp}/SRPMS/*.rpm"], "pkg/srpm"
18
- mv FileList["#{temp}/RPMS/*/*.rpm"], "pkg/rpm"
19
- rm_rf temp
20
- puts
21
- output = FileList['pkg/*/*.rpm']
22
- puts "Wrote:"
23
- output.each do | line |
24
- puts line
25
- end
26
- end
27
-
28
- namespace :package do
29
- desc "Create srpm from this git repository (unsigned)"
30
- task :srpm => :tar do
31
- build_rpm("-bs")
32
- end
33
-
34
- desc "Create .rpm from this git repository (unsigned)"
35
- task :rpm => :tar do
36
- build_rpm("-ba")
37
- end
38
- end
39
-
@@ -1,36 +0,0 @@
1
- namespace :pl do
2
- desc "Ship mocked rpms to #{@yum_host}"
3
- task :ship_rpms do
4
- rsync_to('pkg/el', @yum_host, @yum_repo_path)
5
- rsync_to('pkg/fedora', @yum_host, @yum_repo_path)
6
- end
7
-
8
- desc "Update remote rpm repodata on #{@yum_host}"
9
- task :update_yum_repo do
10
- remote_ssh_cmd(@yum_host, '/var/lib/gems/1.8/gems/rake-0.9.2.2/bin/rake -f /opt/repository/Rakefile mk_repo')
11
- end
12
-
13
- desc "Ship cow-built debs to #{@apt_host}"
14
- task :ship_debs do
15
- rsync_to('pkg/deb/', @apt_host, @apt_repo_path)
16
- end
17
-
18
- if @build_ips
19
- desc "Update remote ips repository on #{@ips_host}"
20
- task :update_ips_repo do
21
- rsync_to('pkg/ips/pkgs', @ips_host, @ips_store)
22
- remote_ssh_cmd(@ips_host, "pkgrecv -s #{@ips_store}/pkgs/#{@name}@#{@ipsversion}.p5p -d #{@ips_repo} \\*")
23
- remote_ssh_cmd(@ips_host, "pkgrepo refresh -s #{@ips_repo}")
24
- remote_ssh_cmd(@ips_host, "/usr/sbin/svcadm restart svc:/application/pkg/server")
25
- end
26
- end
27
-
28
- if @build_gem
29
- desc "Ship built gem to rubygems"
30
- task :ship_gem do
31
- ship_gem("pkg/#{@name}-#{@gemversion}.gem")
32
- end
33
- end
34
- end
35
-
36
-
@@ -1,79 +0,0 @@
1
- def sign_el5(rpm)
2
- %x{rpm --define '%_gpg_name #{@gpg_name}' --define '%__gpg_sign_cmd %{__gpg} gpg --force-v3-sigs --digest-algo=sha1 --batch --no-verbose --no-armor --passphrase-fd 3 --no-secmem-warning -u %{_gpg_name} -sbo %{__signature_filename} %{__plaintext_filename}' --addsign #{rpm} > /dev/null}
3
- end
4
-
5
- def sign_modern(rpm)
6
- %x{rpm --define '%_gpg_name #{@gpg_name}' --addsign #{rpm} > /dev/null}
7
- end
8
-
9
- def rpm_has_sig(rpm)
10
- %x{rpm -Kv #{rpm} | grep "#{@gpg_key.downcase}" &> /dev/null}
11
- $?.success?
12
- end
13
-
14
- def sign_deb_changes(file)
15
- %x{debsign --re-sign -k#{@gpg_key} #{file}}
16
- end
17
-
18
- # requires atleast a self signed prvate key and certificate pair
19
- def sign_ips(pkg)
20
- %x{pkgsign -s pkg/ips/repo/ -k #{@privatekey_pem} -c #{@certificate_pem} #{@name}@#{@ipsversion}}
21
- %x{rm -f #{pkg}}
22
- %x{pkgrecv -s pkg/ips/repo -a -d #{pkg} #{@name}@#{@ipsversion}}
23
- end
24
-
25
- namespace :pl do
26
- desc "Sign the tarball, defaults to PL key, pass GPG_KEY to override or edit build_defaults"
27
- task :sign_tar do
28
- unless File.exist? "pkg/#{@name}-#{@version}.tar.gz"
29
- STDERR.puts "No tarball exists. Try rake package:tar?"
30
- exit 1
31
- end
32
- load_keychain if has_tool('keychain')
33
- gpg_sign_file "pkg/#{@name}-#{@version}.tar.gz"
34
- end
35
-
36
- desc "Sign mocked rpms, Defaults to PL Key, pass KEY to override"
37
- task :sign_rpms do
38
- el5_rpms = Dir["pkg/el/5/**/*.rpm"].join(' ')
39
- modern_rpms = (Dir["pkg/el/6/**/*.rpm"] + Dir["pkg/fedora/**/*.rpm"]).join(' ')
40
- puts "Signing el5 rpms..."
41
- sign_el5 el5_rpms
42
- puts "Signing el6 and fedora rpms..."
43
- sign_modern modern_rpms
44
- end
45
-
46
- if @build_ips
47
- desc "Sign ips package, Defaults to PL Key, pass KEY to override"
48
- task :sign_ips do
49
- ips_pkgs = Dir["pkg/ips/pkgs/*.p5p"].join(' ')
50
- puts "Signing ips packages..."
51
- sign_ips ips_pkgs
52
- end
53
- end
54
-
55
- desc "Check if all rpms are signed"
56
- task :check_rpm_sigs do
57
- signed = TRUE
58
- rpms = Dir["pkg/el/5/**/*.rpm"] + Dir["pkg/el/6/**/*.rpm"] + Dir["pkg/fedora/**/*.rpm"]
59
- print 'Checking rpm signatures'
60
- rpms.each do |rpm|
61
- if rpm_has_sig rpm
62
- print '.'
63
- else
64
- puts "#{rpm} is unsigned."
65
- signed = FALSE
66
- end
67
- end
68
- exit 1 unless signed
69
- puts "All rpms signed"
70
- end
71
-
72
- desc "Sign generated debian changes files. Defaults to PL Key, pass KEY to override"
73
- task :sign_deb_changes do
74
- load_keychain if has_tool('keychain')
75
- sign_deb_changes("pkg/deb/*/*.changes") unless Dir["pkg/deb/*/*.changes"].empty?
76
- sign_deb_changes("pkg/deb/*.changes") unless Dir["pkg/deb/*.changes"].empty?
77
- end
78
- end
79
-
@@ -1,8 +0,0 @@
1
- namespace 'pl' do
2
- desc "Tag this repository, requires a TAG, e.g. TAG=1.1.1"
3
- task "tag" do
4
- check_var('TAG', ENV['TAG'])
5
- git_tag(ENV['TAG'])
6
- end
7
- end
8
-
@@ -1,20 +0,0 @@
1
- namespace :package do
2
- desc "Create a source tar archive"
3
- task :tar => [ :clean ] do
4
- tar = ENV['TAR'] || 'tar'
5
- workdir = "pkg/#{@name}-#{@version}"
6
- mkdir_p(workdir)
7
- FileList[@files.split(' ')].each do |f|
8
- cp_pr(f, workdir)
9
- end
10
- erb("#{workdir}/ext/redhat/#{@name}.spec.erb", "#{workdir}/ext/redhat/#{@name}.spec")
11
- erb("#{workdir}/ext/debian/changelog.erb", "#{workdir}/ext/debian/changelog")
12
- rm_rf(FileList["#{workdir}/ext/debian/*.erb", "#{workdir}/ext/redhat/*.erb"])
13
- cd "pkg" do
14
- sh "#{tar} --exclude=.gitignore --exclude=ext/#{@packaging_repo} -zcf #{@name}-#{@version}.tar.gz #{@name}-#{@version}"
15
- end
16
- rm_rf(workdir)
17
- puts
18
- puts "Wrote #{`pwd`.strip}/pkg/#{@name}-#{@version}.tar.gz"
19
- end
20
- end
@@ -1,20 +0,0 @@
1
- namespace :package do
2
- desc "Update the version in #{@version_file} to current and commit."
3
- task :versionbump do
4
- old_version = get_version_file_version
5
- contents = IO.read(@version_file)
6
- new_version = '"' + @version.to_s.strip + '"'
7
- if contents.match("VERSION = #{old_version}")
8
- contents.gsub!("VERSION = #{old_version}", "VERSION = #{new_version}")
9
- elsif contents.match("#{@name.upcase}VERSION = #{old_version}")
10
- contents.gsub!("#{@name.upcase}VERSION = #{old_version}", "#{@name.upcase}VERSION = #{new_version}")
11
- else
12
- contents.gsub!(old_version, @version)
13
- end
14
- file = File.open(@version_file, 'w')
15
- file.write contents
16
- file.close
17
- git_commit_file(@version_file)
18
- end
19
- end
20
-
@@ -1,12 +0,0 @@
1
- # This file consists of arbitrarily named sections/modules
2
- # defining where files are served from and to whom
3
-
4
- # Define a section 'files'
5
- # Adapt the allow/deny settings to your needs. Order
6
- # for allow/deny does not matter, allow always takes precedence
7
- # over deny
8
- # [files]
9
- # path /var/lib/puppet/files
10
- # allow *.example.com
11
- # deny *.evil.example.com
12
- # allow 192.168.0.0/24
@@ -1,10 +0,0 @@
1
- /var/log/puppet/*log {
2
- missingok
3
- notifempty
4
- create 0644 puppet puppet
5
- sharedscripts
6
- postrotate
7
- [ -e /etc/init.d/puppetmaster ] && /etc/init.d/puppetmaster condrestart >/dev/null 2>&1 || true
8
- [ -e /etc/init.d/puppet ] && /etc/init.d/puppet reload > /dev/null 2>&1 || true
9
- endscript
10
- }
@@ -1,25 +0,0 @@
1
- [main]
2
- # The Puppet log directory.
3
- # The default value is '$vardir/log'.
4
- logdir = /var/log/puppet
5
-
6
- # Where Puppet PID files are kept.
7
- # The default value is '$vardir/run'.
8
- rundir = /var/run/puppet
9
-
10
- # Where SSL certificates are kept.
11
- # The default value is '$confdir/ssl'.
12
- ssldir = $vardir/ssl
13
-
14
- [agent]
15
- # The file in which puppetd stores a list of the classes
16
- # associated with the retrieved configuratiion. Can be loaded in
17
- # the separate ``puppet`` executable using the ``--loadclasses``
18
- # option.
19
- # The default value is '$confdir/classes.txt'.
20
- classfile = $vardir/classes.txt
21
-
22
- # Where puppetd caches the local configuration. An
23
- # extension indicating the cache format is added automatically.
24
- # The default value is '$confdir/localconfig'.
25
- localconfig = $vardir/localconfig
@@ -1,104 +0,0 @@
1
- require 'puppet/network/http/handler'
2
-
3
- class Puppet::Network::HTTP::MongrelREST < Mongrel::HttpHandler
4
-
5
- include Puppet::Network::HTTP::Handler
6
-
7
- ACCEPT_HEADER = "HTTP_ACCEPT".freeze # yay, zed's a crazy-man
8
-
9
- def initialize(args={})
10
- super()
11
- initialize_for_puppet(args)
12
- end
13
-
14
- def accept_header(request)
15
- request.params[ACCEPT_HEADER]
16
- end
17
-
18
- def content_type_header(request)
19
- request.params["HTTP_CONTENT_TYPE"]
20
- end
21
-
22
- # which HTTP verb was used in this request
23
- def http_method(request)
24
- request.params[Mongrel::Const::REQUEST_METHOD]
25
- end
26
-
27
- # Return the query params for this request. We had to expose this method for
28
- # testing purposes.
29
- def params(request)
30
- params = Mongrel::HttpRequest.query_parse(request.params["QUERY_STRING"])
31
- params.merge!(Mongrel::HttpRequest.query_parse(body(request))) if http_method(request).upcase == 'POST'
32
-
33
- params = decode_params(params)
34
- params.merge(client_info(request))
35
- end
36
-
37
- # what path was requested?
38
- def path(request)
39
- # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
40
- #x = '/' + request.params[Mongrel::Const::REQUEST_PATH]
41
- request.params[Mongrel::Const::REQUEST_PATH]
42
- end
43
-
44
- # return the request body
45
- def body(request)
46
- body = request.body.read
47
- # We rewind the body, since read on a StringIO is destructive, and
48
- # subsequent reads will return an empty string.
49
- request.body.rewind
50
-
51
- body
52
- end
53
-
54
- # There is no standard way of retrieving the client certificate since it is completely
55
- # dictated by the web server environment; this is a stub to prevent a NotImplementedError
56
- def client_cert(request)
57
- end
58
-
59
- def set_content_type(response, format)
60
- response.header['Content-Type'] = format_to_mime(format)
61
- end
62
-
63
- # produce the body of the response
64
- def set_response(response, result, status = 200)
65
- # Set the 'reason' (or 'message', as it's called in Webrick), when
66
- # we have a failure, unless we're on a version of mongrel that doesn't
67
- # support this.
68
- if status < 300
69
- unless result.is_a?(File)
70
- response.start(status) { |head, body| body.write(result) }
71
- else
72
- response.start(status) { |head, body| }
73
- response.send_status(result.stat.size)
74
- response.send_header
75
- response.send_file(result.path)
76
- end
77
- else
78
- begin
79
- response.start(status,false,result) { |head, body| body.write(result) }
80
- rescue ArgumentError
81
- response.start(status) { |head, body| body.write(result) }
82
- end
83
- end
84
- end
85
-
86
- def client_info(request)
87
- result = {}
88
- params = request.params
89
- result[:ip] = params["HTTP_X_FORWARDED_FOR"] ? params["HTTP_X_FORWARDED_FOR"].split(',').last.strip : params["REMOTE_ADDR"]
90
-
91
- # JJM #906 The following dn.match regular expression is forgiving
92
- # enough to match the two Distinguished Name string contents
93
- # coming from Apache, Pound or other reverse SSL proxies.
94
- if dn = params[Puppet[:ssl_client_header]] and dn_matchdata = dn.match(/^.*?CN\s*=\s*(.*)/)
95
- result[:node] = dn_matchdata[1].to_str
96
- result[:authenticated] = (params[Puppet[:ssl_client_verify_header]] == 'SUCCESS')
97
- else
98
- result[:node] = resolve_node(result)
99
- result[:authenticated] = false
100
- end
101
-
102
- result
103
- end
104
- end