summaryrefslogtreecommitdiffstats
path: root/lib/puppet/indirector
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/indirector')
-rw-r--r--lib/puppet/indirector/indirection.rb2
-rw-r--r--lib/puppet/indirector/ldap.rb2
-rw-r--r--lib/puppet/indirector/node/ldap.rb58
-rw-r--r--lib/puppet/indirector/report/processor.rb3
-rw-r--r--lib/puppet/indirector/ssl_file.rb2
-rw-r--r--lib/puppet/indirector/yaml.rb2
6 files changed, 34 insertions, 35 deletions
diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb
index 06aa19077..85890f24c 100644
--- a/lib/puppet/indirector/indirection.rb
+++ b/lib/puppet/indirector/indirection.rb
@@ -79,7 +79,7 @@ class Puppet::Indirector::Indirection
def doc
text = ""
- if defined? @doc and @doc
+ if defined?(@doc) and @doc
text += scrub(@doc) + "\n\n"
end
diff --git a/lib/puppet/indirector/ldap.rb b/lib/puppet/indirector/ldap.rb
index ab3c7ef54..390fe6793 100644
--- a/lib/puppet/indirector/ldap.rb
+++ b/lib/puppet/indirector/ldap.rb
@@ -61,7 +61,7 @@ class Puppet::Indirector::Ldap < Puppet::Indirector::Terminus
# Create an ldap connection.
def connection
- unless defined? @connection and @connection
+ unless defined?(@connection) and @connection
unless Puppet.features.ldap?
raise Puppet::Error, "Could not set up LDAP Connection: Missing ruby/ldap libraries"
end
diff --git a/lib/puppet/indirector/node/ldap.rb b/lib/puppet/indirector/node/ldap.rb
index c9c922b5b..2d58df68a 100644
--- a/lib/puppet/indirector/node/ldap.rb
+++ b/lib/puppet/indirector/node/ldap.rb
@@ -21,28 +21,28 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
# with our error handling.
def name2hash(name,name_env,node_type)
info = nil
- ldapsearch(search_filter(name)) {
- |entry| info = entry2hash(entry)
- if info[:environment]
- if name_env == info[:environment]
- return info
- else
+ ldapsearch(search_filter(name)) {
+ |entry| info = entry2hash(entry)
+ if info[:environment]
+ if name_env == info[:environment]
+ return info
+ else
info = nil
- end
- else
- info_env = "production"
- if name_env == info[:environment]
+ end
+ else
+ info_env = "production"
+ if name_env == info[:environment]
return info
- else
+ else
info = nil
- end
- end
- }
+ end
+ end
+ }
if node_type == 'parent'
- raise Puppet::Error.new("Could not find node '%s' with environment '%s'" % [name,name_env])
+ raise Puppet::Error.new("Could not find node '%s' with environment '%s'" % [name,name_env])
end
- info = name2hash('default',name_env,'parent')
+ info = name2hash('default',name_env,'parent')
return info
end
@@ -58,15 +58,15 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
names.each do |name|
facts = Puppet::Node::Facts.find(name)
if facts.values["environment"]
- name_env = facts.values["environment"]
+ name_env = facts.values["environment"]
else
- name_env = "production"
+ name_env = "production"
end
info = name2hash(name,name_env,'child')
next if info == nil
if info
- break if node = info2node(request.key, info)
+ break if node = info2node(request.key, info)
end
end
@@ -205,26 +205,26 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
def find_and_merge_parent(parent, information)
if information[:environment]
- name_env = information[:environment]
+ name_env = information[:environment]
else
- name_env = 'production'
+ name_env = 'production'
end
parent_info = name2hash(parent,name_env,'parent')
if parent_info
- information[:classes] += parent_info[:classes]
- parent_info[:parameters].each do |param, value|
+ information[:classes] += parent_info[:classes]
+ parent_info[:parameters].each do |param, value|
# Specifically test for whether it's set, so false values are handled
# correctly.
information[:parameters][param] = value unless information[:parameters].include?(param)
- end
+ end
- information[:environment] ||= parent_info[:environment]
- parent_info[:parent]
+ information[:environment] ||= parent_info[:environment]
+ parent_info[:parent]
else
- raise Puppet::Error.new("Could not find parent node '%s'" % parent)
- nil
- end
+ raise Puppet::Error.new("Could not find parent node '%s'" % parent)
+ nil
+ end
end
diff --git a/lib/puppet/indirector/report/processor.rb b/lib/puppet/indirector/report/processor.rb
index 9daf14641..1ff2e0e84 100644
--- a/lib/puppet/indirector/report/processor.rb
+++ b/lib/puppet/indirector/report/processor.rb
@@ -34,8 +34,7 @@ class Puppet::Transaction::Report::Processor < Puppet::Indirector::Code
if Puppet[:trace]
puts detail.backtrace
end
- Puppet.err "Report %s failed: %s" %
- [name, detail]
+ Puppet.err "Report %s failed: %s" % [name, detail]
end
else
Puppet.warning "No report named '%s'" % name
diff --git a/lib/puppet/indirector/ssl_file.rb b/lib/puppet/indirector/ssl_file.rb
index fc1e65d22..67202699d 100644
--- a/lib/puppet/indirector/ssl_file.rb
+++ b/lib/puppet/indirector/ssl_file.rb
@@ -91,7 +91,7 @@ class Puppet::Indirector::SslFile < Puppet::Indirector::Terminus
def save(request)
path = path(request.key)
dir = File.dirname(path)
-
+
raise Puppet::Error.new("Cannot save %s; parent directory %s does not exist" % [request.key, dir]) unless FileTest.directory?(dir)
raise Puppet::Error.new("Cannot save %s; parent directory %s is not writable" % [request.key, dir]) unless FileTest.writable?(dir)
diff --git a/lib/puppet/indirector/yaml.rb b/lib/puppet/indirector/yaml.rb
index 39d4751fc..2ff267f06 100644
--- a/lib/puppet/indirector/yaml.rb
+++ b/lib/puppet/indirector/yaml.rb
@@ -55,7 +55,7 @@ class Puppet::Indirector::Yaml < Puppet::Indirector::Terminus
# Do a glob on the yaml directory, loading each file found
def search(request)
- Dir.glob(File.join(base, self.class.indirection_name.to_s, request.key)).collect { |f| YAML.load_file(f) }
+ Dir.glob(File.join(base, self.class.indirection_name.to_s, request.key)).collect { |f| YAML.load_file(f) }
end
private