Signed-off-by: Markus Roberts <[email protected]>
---
lib/puppet/indirector/indirection.rb | 2 +-
lib/puppet/indirector/ldap.rb | 2 +-
lib/puppet/network/client.rb | 2 +-
lib/puppet/parameter.rb | 6 +++---
lib/puppet/parser/ast/definition.rb | 2 +-
lib/puppet/property.rb | 2 +-
lib/puppet/property/keyvalue.rb | 4 ++--
lib/puppet/property/list.rb | 4 ++--
lib/puppet/resource/catalog.rb | 4 ++--
lib/puppet/simple_graph.rb | 2 +-
lib/puppet/sslcertificates/certificate.rb | 10 +++++-----
lib/puppet/transportable.rb | 2 +-
lib/puppet/type.rb | 6 +++---
lib/puppet/type/cron.rb | 2 +-
lib/puppet/type/file/checksum.rb | 2 +-
lib/puppet/type/file/mode.rb | 2 +-
lib/puppet/util/docs.rb | 2 +-
lib/puppet/util/settings/setting.rb | 2 +-
18 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/lib/puppet/indirector/indirection.rb
b/lib/puppet/indirector/indirection.rb
index dc7e58f..a37a63b 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 @doc
text += scrub(@doc) + "\n\n"
end
diff --git a/lib/puppet/indirector/ldap.rb b/lib/puppet/indirector/ldap.rb
index 7485bd9..0949f72 100644
--- a/lib/puppet/indirector/ldap.rb
+++ b/lib/puppet/indirector/ldap.rb
@@ -59,7 +59,7 @@ class Puppet::Indirector::Ldap < Puppet::Indirector::Terminus
# Create an ldap connection.
def connection
- unless defined? @connection and @connection
+ unless @connection
unless Puppet.features.ldap?
raise Puppet::Error, "Could not set up LDAP Connection:
Missing ruby/ldap libraries"
end
diff --git a/lib/puppet/network/client.rb b/lib/puppet/network/client.rb
index 429e256..52ba1cf 100644
--- a/lib/puppet/network/client.rb
+++ b/lib/puppet/network/client.rb
@@ -112,7 +112,7 @@ class Puppet::Network::Client
# Are we a local client?
def local?
- if defined? @local and @local
+ if @local
true
else
false
diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb
index f408667..76919d0 100644
--- a/lib/puppet/parameter.rb
+++ b/lib/puppet/parameter.rb
@@ -383,11 +383,11 @@ class Puppet::Parameter
error = type.new(args.join(" "))
- if defined? @resource and @resource and @resource.line
+ if @resource and @resource.line
error.line = @resource.line
end
- if defined? @resource and @resource and @resource.file
+ if @resource and @resource.file
error.file = @resource.file
end
@@ -446,7 +446,7 @@ class Puppet::Parameter
# return the full path to us, for logging and rollback; not currently
# used
def pathbuilder
- if defined? @resource and @resource
+ if @resource
return [[email protected], self.name]
else
return [self.name]
diff --git a/lib/puppet/parser/ast/definition.rb
b/lib/puppet/parser/ast/definition.rb
index 00b0416..5d6f078 100644
--- a/lib/puppet/parser/ast/definition.rb
+++ b/lib/puppet/parser/ast/definition.rb
@@ -146,7 +146,7 @@ class Puppet::Parser::AST::Definition <
Puppet::Parser::AST::Branch
return true
elsif param == "name"
return true
-# elsif defined? @parentclass and @parentclass
+# elsif @parentclass
# # Else, check any existing parent
# if parent = @scope.lookuptype(@parentclass) and parent != []
# return parent.validarg?(param)
diff --git a/lib/puppet/property.rb b/lib/puppet/property.rb
index abbc71c..bd62b19 100644
--- a/lib/puppet/property.rb
+++ b/lib/puppet/property.rb
@@ -197,7 +197,7 @@ class Puppet::Property < Puppet::Parameter
def insync?(is)
#debug "%s value is '%s', should be '%s'" %
# [self,self.is.inspect,self.should.inspect]
- unless defined? @should and @should
+ unless @should
return true
end
diff --git a/lib/puppet/property/keyvalue.rb b/lib/puppet/property/keyvalue.rb
index 6c0800c..ab4bb8d 100644
--- a/lib/puppet/property/keyvalue.rb
+++ b/lib/puppet/property/keyvalue.rb
@@ -52,7 +52,7 @@ module Puppet
end
def should
- unless defined? @should and @should
+ unless @should
return nil
end
@@ -81,7 +81,7 @@ module Puppet
end
def insync?(is)
- unless defined? @should and @should
+ unless @should
return true
end
diff --git a/lib/puppet/property/list.rb b/lib/puppet/property/list.rb
index 31af76b..c8efdb5 100644
--- a/lib/puppet/property/list.rb
+++ b/lib/puppet/property/list.rb
@@ -38,7 +38,7 @@ module Puppet
end
def should
- unless defined? @should and @should
+ unless @should
return nil
end
@@ -72,7 +72,7 @@ module Puppet
end
def insync?(is)
- unless defined? @should and @should
+ unless @should
return true
end
diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb
index 561be82..f338d0f 100644
--- a/lib/puppet/resource/catalog.rb
+++ b/lib/puppet/resource/catalog.rb
@@ -160,7 +160,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
ensure
@applying = false
cleanup()
- transaction.cleanup if defined? transaction and transaction
+ transaction.cleanup if transaction
end
# Are we in the middle of applying the catalog?
@@ -318,7 +318,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
# Create a graph of all of the relationships in our catalog.
def relationship_graph
- unless defined? @relationship_graph and @relationship_graph
+ unless @relationship_graph
# It's important that we assign the graph immediately, because
# the debug messages below use the relationships in the
# relationship graph to determine the path to the resources
diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb
index 5e8f5cd..7fe1859 100644
--- a/lib/puppet/simple_graph.rb
+++ b/lib/puppet/simple_graph.rb
@@ -122,7 +122,7 @@ class Puppet::SimpleGraph
def dependencies(resource)
# Cache the reversal graph, because it's somewhat expensive
# to create.
- unless defined? @reversal and @reversal
+ unless @reversal
@reversal = reversal
end
# Strangely, it's significantly faster to search a reversed
diff --git a/lib/puppet/sslcertificates/certificate.rb
b/lib/puppet/sslcertificates/certificate.rb
index 191f553..e73e476 100644
--- a/lib/puppet/sslcertificates/certificate.rb
+++ b/lib/puppet/sslcertificates/certificate.rb
@@ -25,7 +25,7 @@ class Puppet::SSLCertificates::Certificate
end
}
- if defined? @hash and @hash
+ if @hash
if FileTest.symlink?(@hash)
File.unlink(@hash)
end
@@ -137,7 +137,7 @@ class Puppet::SSLCertificates::Certificate
# this only works for servers, not for users
def mkcsr
- unless defined? @key and @key
+ unless @key
self.getkey
end
@@ -196,11 +196,11 @@ class Puppet::SSLCertificates::Certificate
end
def mkselfsigned
- unless defined? @key and @key
+ unless @key
self.getkey
end
- if defined? @cert and @cert
+ if @cert
raise Puppet::Error, "Cannot replace existing certificate"
end
@@ -254,7 +254,7 @@ class Puppet::SSLCertificates::Certificate
end
files.each { |file,thing|
- if defined? thing and thing
+ if thing
if FileTest.exists?(file)
next
end
diff --git a/lib/puppet/transportable.rb b/lib/puppet/transportable.rb
index 85a75d4..70b3d6c 100644
--- a/lib/puppet/transportable.rb
+++ b/lib/puppet/transportable.rb
@@ -162,7 +162,7 @@ module Puppet
# Convert to a parseable manifest
def to_manifest
unless self.top
- unless defined? @keyword and @keyword
+ unless @keyword
raise Puppet::DevError, "No keyword; cannot convert to
manifest"
end
end
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index ee87c26..fabde9e 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -647,7 +647,7 @@ class Type
# Once an object is managed, it always stays managed; but an object
# that is listed as unmanaged might become managed later in the
process,
# so we have to check that every time
- if defined? @managed and @managed
+ if @managed
return @managed
else
@managed = false
@@ -1462,7 +1462,7 @@ class Type
# Find the default provider.
def self.defaultprovider
- unless defined? @defaultprovider and @defaultprovider
+ unless @defaultprovider
suitable = suitableprovider()
# Find which providers are a default for this system.
@@ -2027,7 +2027,7 @@ class Type
# Retrieve the title of an object. If no title was set separately,
# then use the object's name.
def title
- unless defined? @title and @title
+ unless @title
namevar = self.class.namevar
if self.class.validparameter?(namevar)
@title = self[:name]
diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb
index 1269f38..a7f5dba 100755
--- a/lib/puppet/type/cron.rb
+++ b/lib/puppet/type/cron.rb
@@ -54,7 +54,7 @@ Puppet::Type.newtype(:cron) do
# We have to override the parent method, because we consume the entire
# "should" array
def insync?(is)
- if defined? @should and @should
+ if @should
self.is_to_s(is) == self.should_to_s
else
true
diff --git a/lib/puppet/type/file/checksum.rb b/lib/puppet/type/file/checksum.rb
index 23a3e5a..79cb66b 100755
--- a/lib/puppet/type/file/checksum.rb
+++ b/lib/puppet/type/file/checksum.rb
@@ -111,7 +111,7 @@ Puppet::Type.type(:file).newproperty(:checksum) do
return "undefined %s from '%s'" %
[self.name, self.is_to_s(currentvalue)]
else
- if defined? @cached and @cached
+ if @cached
return "%s changed '%s' to '%s'" %
[self.name, @cached, self.is_to_s(currentvalue)]
else
diff --git a/lib/puppet/type/file/mode.rb b/lib/puppet/type/file/mode.rb
index fd9c27a..526e6b1 100755
--- a/lib/puppet/type/file/mode.rb
+++ b/lib/puppet/type/file/mode.rb
@@ -92,7 +92,7 @@ module Puppet
if stat = @resource.stat(false)
unless defined? @fixed
- if defined? @should and @should
+ if @should
@should = @should.collect { |s| self.dirmask(s) }
end
end
diff --git a/lib/puppet/util/docs.rb b/lib/puppet/util/docs.rb
index 860a545..eb871a5 100644
--- a/lib/puppet/util/docs.rb
+++ b/lib/puppet/util/docs.rb
@@ -22,7 +22,7 @@ module Puppet::Util::Docs
self.send(m)
}.join(" ")
- if defined? @doc and @doc
+ if @doc
@doc + extra
else
extra
diff --git a/lib/puppet/util/settings/setting.rb
b/lib/puppet/util/settings/setting.rb
index e64cfd6..5e529c0 100644
--- a/lib/puppet/util/settings/setting.rb
+++ b/lib/puppet/util/settings/setting.rb
@@ -82,7 +82,7 @@ class Puppet::Util::Settings::Setting
str = @desc.gsub(/^/, "# ") + "\n"
# Add in a statement about the default.
- if defined? @default and @default
+ if @default
str += "# The default value is '%s'.\n" % @default
end
--
1.6.4
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---