summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-05-12 18:25:14 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commitac7efc8f0284d6b35f5428da06ba371cf94998ec (patch)
treec1a6a6df5dd2d533c1d0b12b869a0758b8c4cb6f /lib/puppet
parent5665e3984f73c70b90f65dd8bf4445b5adda5121 (diff)
downloadpuppet-ac7efc8f0284d6b35f5428da06ba371cf94998ec.tar.gz
puppet-ac7efc8f0284d6b35f5428da06ba371cf94998ec.tar.xz
puppet-ac7efc8f0284d6b35f5428da06ba371cf94998ec.zip
Feature #2935 Puppet::Mode#master?
Use a predicate function on the Mode object instead of comparing with the executable name everywhere Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/application/doc.rb2
-rw-r--r--lib/puppet/indirector/catalog/compiler.rb2
-rw-r--r--lib/puppet/indirector/file.rb2
-rw-r--r--lib/puppet/indirector/yaml.rb2
-rw-r--r--lib/puppet/network/authorization.rb3
-rw-r--r--lib/puppet/network/http/webrick.rb2
-rw-r--r--lib/puppet/network/http_server/webrick.rb2
-rw-r--r--lib/puppet/ssl/certificate_authority.rb2
8 files changed, 7 insertions, 10 deletions
diff --git a/lib/puppet/application/doc.rb b/lib/puppet/application/doc.rb
index 0f4381f4b..5da7040ae 100644
--- a/lib/puppet/application/doc.rb
+++ b/lib/puppet/application/doc.rb
@@ -207,8 +207,6 @@ class Puppet::Application::Doc < Puppet::Application
end
end
- # hack to get access to puppetmasterd modulepath and manifestdir
- Puppet[:name] = "puppetmasterd"
# Now parse the config
Puppet.parse_config
diff --git a/lib/puppet/indirector/catalog/compiler.rb b/lib/puppet/indirector/catalog/compiler.rb
index f83245a27..0dccf3613 100644
--- a/lib/puppet/indirector/catalog/compiler.rb
+++ b/lib/puppet/indirector/catalog/compiler.rb
@@ -53,7 +53,7 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
# Is our compiler part of a network, or are we just local?
def networked?
- $0 =~ /puppetmasterd/
+ Puppet.mode.master?
end
private
diff --git a/lib/puppet/indirector/file.rb b/lib/puppet/indirector/file.rb
index cc7ad9b07..0aedccf91 100644
--- a/lib/puppet/indirector/file.rb
+++ b/lib/puppet/indirector/file.rb
@@ -4,7 +4,7 @@ require 'puppet/indirector/terminus'
class Puppet::Indirector::File < Puppet::Indirector::Terminus
# Where do we store our data?
def data_directory
- name = Puppet[:name] == "puppetmasterd" ? :server_datadir : :client_datadir
+ name = Puppet.mode.master? ? :server_datadir : :client_datadir
File.join(Puppet.settings[name], self.class.indirection_name.to_s)
end
diff --git a/lib/puppet/indirector/yaml.rb b/lib/puppet/indirector/yaml.rb
index 782112ebd..710246686 100644
--- a/lib/puppet/indirector/yaml.rb
+++ b/lib/puppet/indirector/yaml.rb
@@ -45,7 +45,7 @@ class Puppet::Indirector::Yaml < Puppet::Indirector::Terminus
# Get the yaml directory
def base
- (Puppet[:name] == "puppetmasterd") ? Puppet[:yamldir] : Puppet[:clientyamldir]
+ Puppet.mode.master? ? Puppet[:yamldir] : Puppet[:clientyamldir]
end
# Return the path to a given node's file.
diff --git a/lib/puppet/network/authorization.rb b/lib/puppet/network/authorization.rb
index 9ea4bf69e..7a61ab9b9 100644
--- a/lib/puppet/network/authorization.rb
+++ b/lib/puppet/network/authorization.rb
@@ -34,8 +34,7 @@ module Puppet::Network
return false
end
else
- # This is a hack way of seeing if we're a config master.
- if Puppet[:name] == "puppetmasterd"
+ if Puppet.mode.master?
Puppet.debug "Allowing " + msg
return true
else
diff --git a/lib/puppet/network/http/webrick.rb b/lib/puppet/network/http/webrick.rb
index 1a3f5ddce..a97add0c0 100644
--- a/lib/puppet/network/http/webrick.rb
+++ b/lib/puppet/network/http/webrick.rb
@@ -70,7 +70,7 @@ class Puppet::Network::HTTP::WEBrick
# Make sure the settings are all ready for us.
Puppet.settings.use(:main, :ssl, Puppet[:name])
- if Puppet[:name] == "puppetmasterd"
+ if Puppet.mode.master?
file = Puppet[:masterhttplog]
else
file = Puppet[:httplog]
diff --git a/lib/puppet/network/http_server/webrick.rb b/lib/puppet/network/http_server/webrick.rb
index 051a35234..aa930681b 100644
--- a/lib/puppet/network/http_server/webrick.rb
+++ b/lib/puppet/network/http_server/webrick.rb
@@ -45,7 +45,7 @@ module Puppet
# yuck; separate http logs
file = nil
Puppet.settings.use(:main, :ssl, Puppet[:name])
- if Puppet[:name] == "puppetmasterd"
+ if Puppet.mode.master?
file = Puppet[:masterhttplog]
else
file = Puppet[:httplog]
diff --git a/lib/puppet/ssl/certificate_authority.rb b/lib/puppet/ssl/certificate_authority.rb
index 111b72009..bd081c914 100644
--- a/lib/puppet/ssl/certificate_authority.rb
+++ b/lib/puppet/ssl/certificate_authority.rb
@@ -33,7 +33,7 @@ class Puppet::SSL::CertificateAuthority
def self.ca?
return false unless Puppet[:ca]
- return false unless Puppet[:name] == "puppetmasterd"
+ return false unless Puppet.mode.master?
return true
end