[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

Markus Roberts Markus at reality.com
Wed Jul 14 10:37:16 UTC 2010


The following commit has been merged in the upstream branch:
commit 889158ad57e33df083613d6f7d136b2e11aaa16a
Author: Markus Roberts <Markus at reality.com>
Date:   Fri Jul 9 18:06:12 2010 -0700

    Code smell: Booleans are first class values.
    
    * Replaced 2 occurances of
    
          def (.*)
              begin
                  (.*) = Integer\((.*)\)
                  return \2
              rescue ArgumentError
                  \2 = nil
              end
              if \2 = (.*)
                  return \2
              else
                  return false
              end
          end
    
      with
    
      2 Examples:
    
          The code:
              def validuser?(value)
                  begin
                      number = Integer(value)
                      return number
                  rescue ArgumentError
                      number = nil
                  end
                  if number = uid(value)
                      return number
                  else
                      return false
                  end
              end
          becomes:
              def validuser?(value)
                  Integer(value) rescue uid(value) || false
              end
          The code:
              def validgroup?(value)
                  begin
                      number = Integer(value)
                      return number
                  rescue ArgumentError
                      number = nil
                  end
                  if number = gid(value)
                      return number
                  else
                      return false
                  end
              end
          becomes:
              def validgroup?(value)
                  Integer(value) rescue gid(value) || false
              end
    
    * Replaced 28 occurances of
    
          return (.*?) if (.*)
          return (.*)
    
      with
    
      3 Examples:
    
          The code:
              return send(options[:mode]) if [:rdoc, :trac, :markdown].include?(options[:mode])
              return other
          becomes:
              return[:rdoc, :trac, :markdown].include?(options[:mode]) ? send(options[:mode]) : other
          The code:
              return true if known_resource_types.definition(name)
              return false
          becomes:
              return(known_resource_types.definition(name) ? true : false)
          The code:
              return :rest if request.protocol == 'https'
              return Puppet::FileBucket::File.indirection.terminus_class
          becomes:
              return(request.protocol == 'https' ? :rest : Puppet::FileBucket::File.indirection.terminus_class)
    
    * Replaced no occurances of
    
          return (.*?) unless (.*)
          return (.*)
    
      with
    
    * Replaced 7 occurances of
    
          if (.*)
              (.*[^:])false
          else
              \2true
          end
    
      with
    
      3 Examples:
    
          The code:
              if RUBY_PLATFORM == "i386-mswin32"
                  InstallOptions.ri  = false
              else
                  InstallOptions.ri  = true
              end
          becomes:
              InstallOptions.ri  = RUBY_PLATFORM != "i386-mswin32"
          The code:
              if options[:references].length > 1
                  with_contents = false
              else
                  with_contents = true
              end
          becomes:
              with_contents = options[:references].length <= 1
          The code:
              if value == false or value == "" or value == :undef
                  return false
              else
                  return true
              end
          becomes:
              return (value != false and value != "" and value != :undef)
    
    * Replaced 19 occurances of
    
          if (.*)
              (.*[^:])true
          else
              \2false
          end
    
      with
    
      3 Examples:
    
          The code:
              if Puppet::Util::Log.level == :debug
                  return true
              else
                  return false
              end
          becomes:
              return Puppet::Util::Log.level == :debug
          The code:
              if satisfies?(*features)
                  return true
              else
                  return false
              end
          becomes:
              return !!satisfies?(*features)
          The code:
              if self.class.parsed_auth_db.has_key?(resource[:name])
                  return true
              else
                  return false
              end
          becomes:
              return !!self.class.parsed_auth_db.has_key?(resource[:name])
    
    * Replaced 1 occurance of
    
          if ([a-z_]) = (.*)
              (.*[^:])\1
          else
              \3(.*)
          end
    
      with
    
      1 Example:
    
          The code:
              if c = self.send(@subclassname, method)
                  return c
              else
                  return nil
              end
          becomes:
              return self.send(@subclassname, method) || nil
    
    * Replaced 2 occurances of
    
          if (.*)
              (.*[^:])\1
          else
              \2false
          end
    
      with
    
      2 Examples:
    
          The code:
              if hash[:Local]
                  @local = hash[:Local]
              else
                  @local = false
              end
          becomes:
              @local = hash[:Local]
          The code:
              if hash[:Local]
                  @local = hash[:Local]
              else
                  @local = false
              end
          becomes:
              @local = hash[:Local]
    
    * Replaced 10 occurances of
    
          if (.*)
              (.*[^:])(.*)
          else
              \2false
          end
    
      with
    
      3 Examples:
    
          The code:
              if defined?(@isnamevar)
                  return @isnamevar
              else
                  return false
              end
          becomes:
              return defined?(@isnamevar) && @isnamevar
          The code:
              if defined?(@required)
                  return @required
              else
                  return false
              end
          becomes:
              return defined?(@required) && @required
          The code:
              if number = uid(value)
                  return number
              else
                  return false
              end
          becomes:
              return (number = uid(value)) && number
    
    * Replaced no occurances of
    
          if (.*)
              (.*[^:])nil
          else
              \2(true)
          end
    
      with
    
    * Replaced no occurances of
    
          if (.*)
              (.*[^:])true
          else
              \2nil
          end
    
      with
    
    * Replaced no occurances of
    
          if (.*)
              (.*[^:])\1
          else
              \2nil
          end
    
      with
    
    * Replaced 23 occurances of
    
          if (.*)
              (.*[^:])(.*)
          else
              \2nil
          end
    
      with
    
      3 Examples:
    
          The code:
              if node = Puppet::Node.find(hostname)
                  env = node.environment
              else
                  env = nil
              end
          becomes:
              env = (node = Puppet::Node.find(hostname)) ? node.environment : nil
          The code:
              if mod = Puppet::Node::Environment.new(env).module(module_name) and mod.files?
                  return @mounts[MODULES].copy(mod.name, mod.file_directory)
              else
                  return nil
              end
          becomes:
              return (mod = Puppet::Node::Environment.new(env).module(module_name) and mod.files?) ? @mounts[MODULES].copy(mod.name, mod.file_directory) : nil
          The code:
              if hash.include?(:CA) and hash[:CA]
                  @ca = Puppet::SSLCertificates::CA.new()
              else
                  @ca = nil
              end
          becomes:
              @ca = (hash.include?(:CA) and hash[:CA]) ? Puppet::SSLCertificates::CA.new() : nil

diff --git a/install.rb b/install.rb
index c0ac957..a4abcb9 100755
--- a/install.rb
+++ b/install.rb
@@ -157,11 +157,7 @@ def prepare_installation
     # Only try to do docs if we're sure they have rdoc
     if $haverdoc
         InstallOptions.rdoc  = true
-        if RUBY_PLATFORM == "i386-mswin32"
-            InstallOptions.ri  = false
-        else
-            InstallOptions.ri  = true
-        end
+        InstallOptions.ri  = RUBY_PLATFORM != "i386-mswin32"
     else
         InstallOptions.rdoc  = false
         InstallOptions.ri  = false
diff --git a/lib/puppet.rb b/lib/puppet.rb
index 7293ce2..2f036e2 100644
--- a/lib/puppet.rb
+++ b/lib/puppet.rb
@@ -61,11 +61,7 @@ module Puppet
     def self.[](param)
         case param
         when :debug
-            if Puppet::Util::Log.level == :debug
-                return true
-            else
-                return false
-            end
+            return Puppet::Util::Log.level == :debug
         else
             return @@settings[param]
         end
diff --git a/lib/puppet/application/doc.rb b/lib/puppet/application/doc.rb
index e4c2474..ba07f73 100644
--- a/lib/puppet/application/doc.rb
+++ b/lib/puppet/application/doc.rb
@@ -56,8 +56,7 @@ class Puppet::Application::Doc < Puppet::Application
     end
 
     def run_command
-        return send(options[:mode]) if [:rdoc, :trac, :markdown].include?(options[:mode])
-        return other
+        return[:rdoc, :trac, :markdown].include?(options[:mode]) ? send(options[:mode]) : other
     end
 
     def rdoc
@@ -129,11 +128,7 @@ class Puppet::Application::Doc < Puppet::Application
 
     def other
         text = ""
-        if options[:references].length > 1
-            with_contents = false
-        else
-            with_contents = true
-        end
+        with_contents = options[:references].length <= 1
         exit_code = 0
         require 'puppet/util/reference'
         options[:references].sort { |a,b| a.to_s <=> b.to_s }.each do |name|
diff --git a/lib/puppet/dsl/resource_api.rb b/lib/puppet/dsl/resource_api.rb
index 5556eb8..71230d1 100644
--- a/lib/puppet/dsl/resource_api.rb
+++ b/lib/puppet/dsl/resource_api.rb
@@ -97,8 +97,7 @@ class Puppet::DSL::ResourceAPI
     def valid_type?(name)
         return true if [:class, :node].include?(name)
         return true if Puppet::Type.type(name)
-        return true if known_resource_types.definition(name)
-        return false
+        return(known_resource_types.definition(name) ? true : false)
     end
 
     private
diff --git a/lib/puppet/file_bucket/file/indirection_hooks.rb b/lib/puppet/file_bucket/file/indirection_hooks.rb
index ec2bb34..ab0912b 100644
--- a/lib/puppet/file_bucket/file/indirection_hooks.rb
+++ b/lib/puppet/file_bucket/file/indirection_hooks.rb
@@ -4,7 +4,6 @@ require 'puppet/file_bucket/file'
 # in filebucket indirections.
 module Puppet::FileBucket::File::IndirectionHooks
     def select_terminus(request)
-        return :rest if request.protocol == 'https'
-        return Puppet::FileBucket::File.indirection.terminus_class
+        return(request.protocol == 'https' ? :rest : Puppet::FileBucket::File.indirection.terminus_class)
     end
 end
diff --git a/lib/puppet/file_serving/mount/plugins.rb b/lib/puppet/file_serving/mount/plugins.rb
index c860e52..4815429 100644
--- a/lib/puppet/file_serving/mount/plugins.rb
+++ b/lib/puppet/file_serving/mount/plugins.rb
@@ -17,8 +17,7 @@ class Puppet::FileServing::Mount::Plugins < Puppet::FileServing::Mount
         # We currently only support one kind of search on plugins - return
         # them all.
         paths = request.environment.modules.find_all { |mod| mod.plugins? }.collect { |mod| mod.plugin_directory }
-        return nil if paths.empty?
-        return paths
+        return(paths.empty? ? nil : paths)
     end
 
     def valid?
diff --git a/lib/puppet/indirector/file_bucket_file/file.rb b/lib/puppet/indirector/file_bucket_file/file.rb
index 0cd3cda..34237b4 100644
--- a/lib/puppet/indirector/file_bucket_file/file.rb
+++ b/lib/puppet/indirector/file_bucket_file/file.rb
@@ -85,8 +85,7 @@ module Puppet::FileBucketFile
             return [request.key, nil] if checksum?(request.key)
 
             checksum_type, checksum, path = request.key.split(/\//, 3)
-            return nil if checksum_type.to_s == ""
-            return [ "{#{checksum_type}}#{checksum}", path ]
+            return(checksum_type.to_s == "" ? nil : [ "{#{checksum_type}}#{checksum}", path ])
         end
 
         def path_for(bucket_file, subfile = nil)
diff --git a/lib/puppet/indirector/node/ldap.rb b/lib/puppet/indirector/node/ldap.rb
index 71bca58..2ca44c3 100644
--- a/lib/puppet/indirector/node/ldap.rb
+++ b/lib/puppet/indirector/node/ldap.rb
@@ -287,8 +287,7 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
             raise Puppet::Error,
                 "Node entry #{entry.dn} specifies more than one parent: #{values.inspect}"
         end
-        return nil if values.empty?
-        return values.shift
+        return(values.empty? ? nil : values.shift)
     end
 
     def get_stacked_values_from_entry(entry)
diff --git a/lib/puppet/indirector/request.rb b/lib/puppet/indirector/request.rb
index 373d4a2..898722f 100644
--- a/lib/puppet/indirector/request.rb
+++ b/lib/puppet/indirector/request.rb
@@ -147,8 +147,7 @@ class Puppet::Indirector::Request
     end
 
     def to_s
-        return uri if uri
-        return "/#{indirection_name}/#{key}"
+        return(uri ? uri : "/#{indirection_name}/#{key}")
     end
 
     private
diff --git a/lib/puppet/network/format.rb b/lib/puppet/network/format.rb
index fb5a74a..243671d 100644
--- a/lib/puppet/network/format.rb
+++ b/lib/puppet/network/format.rb
@@ -106,7 +106,6 @@ class Puppet::Network::Format
 
         method = send(name)
 
-        return klass.respond_to?(method) if type == :class
-        return klass.instance_methods.include?(method)
+        return(type == :class ? klass.respond_to?(method) : klass.instance_methods.include?(method))
     end
 end
diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb
index cb54ca4..b7a0c13 100755
--- a/lib/puppet/network/handler/fileserver.rb
+++ b/lib/puppet/network/handler/fileserver.rb
@@ -92,11 +92,7 @@ class Puppet::Network::Handler
             @mounts = {}
             @files = {}
 
-            if hash[:Local]
-                @local = hash[:Local]
-            else
-                @local = false
-            end
+            @local = hash[:Local]
 
             @noreadconfig = true if hash[:Config] == false
 
@@ -236,18 +232,10 @@ class Puppet::Network::Handler
             unless hostname = (client || Facter.value("hostname"))
                 raise ArgumentError, "Could not find hostname"
             end
-            if node = Puppet::Node.find(hostname)
-                env = node.environment
-            else
-                env = nil
-            end
+            env = (node = Puppet::Node.find(hostname)) ? node.environment : nil
 
             # And use the environment to look up the module.
-            if mod = Puppet::Node::Environment.new(env).module(module_name) and mod.files?
-                return @mounts[MODULES].copy(mod.name, mod.file_directory)
-            else
-                return nil
-            end
+            return (mod = Puppet::Node::Environment.new(env).module(module_name) and mod.files?) ? @mounts[MODULES].copy(mod.name, mod.file_directory) : nil
         end
 
         # Read the configuration file.
diff --git a/lib/puppet/network/handler/master.rb b/lib/puppet/network/handler/master.rb
index d55046b..690e707 100644
--- a/lib/puppet/network/handler/master.rb
+++ b/lib/puppet/network/handler/master.rb
@@ -29,19 +29,11 @@ class Puppet::Network::Handler
         def initialize(hash = {})
             args = {}
 
-            if hash[:Local]
-                @local = hash[:Local]
-            else
-                @local = false
-            end
+            @local = hash[:Local]
 
             args[:Local] = true
 
-            if hash.include?(:CA) and hash[:CA]
-                @ca = Puppet::SSLCertificates::CA.new()
-            else
-                @ca = nil
-            end
+            @ca = (hash.include?(:CA) and hash[:CA]) ? Puppet::SSLCertificates::CA.new() : nil
 
             # This is only used by the cfengine module, or if --loadclasses was
             # specified in +puppet+.
diff --git a/lib/puppet/network/http/api/v1.rb b/lib/puppet/network/http/api/v1.rb
index 347da93..265b297 100644
--- a/lib/puppet/network/http/api/v1.rb
+++ b/lib/puppet/network/http/api/v1.rb
@@ -49,8 +49,7 @@ module Puppet::Network::HTTP::API::V1
     end
 
     def pluralize(indirection)
-        return "statuses" if indirection == "status"
-        return indirection + "s"
+        return(indirection == "status" ? "statuses" : indirection + "s")
     end
 
     def plurality(indirection)
diff --git a/lib/puppet/network/http/compression.rb b/lib/puppet/network/http/compression.rb
index 722ecfe..923262b 100644
--- a/lib/puppet/network/http/compression.rb
+++ b/lib/puppet/network/http/compression.rb
@@ -5,8 +5,7 @@ module Puppet::Network::HTTP::Compression
     # this module function allows to use the right underlying
     # methods depending on zlib presence
     def module
-        return Active if Puppet.features.zlib?
-        return None
+        return(Puppet.features.zlib? ? Active : None)
     end
     module_function :module
 
diff --git a/lib/puppet/network/rights.rb b/lib/puppet/network/rights.rb
index 509a923..2c781b3 100755
--- a/lib/puppet/network/rights.rb
+++ b/lib/puppet/network/rights.rb
@@ -258,8 +258,7 @@ class Rights
         end
 
         def ==(name)
-            return self.key == namespace_to_key(name) if acl_type == :name
-            return self.name == name.gsub(/^~\s+/,'')
+            return(acl_type == :name ? self.key == namespace_to_key(name) : self.name == name.gsub(/^~\s+/,''))
         end
 
     end
diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb
index 5b9ecf5..46a37b7 100644
--- a/lib/puppet/parameter.rb
+++ b/lib/puppet/parameter.rb
@@ -90,11 +90,7 @@ class Puppet::Parameter
 
         # Is this parameter the namevar?  Defaults to false.
         def isnamevar?
-            if defined?(@isnamevar)
-                return @isnamevar
-            else
-                return false
-            end
+            return defined?(@isnamevar) && @isnamevar
         end
 
         # This parameter is required.
@@ -109,11 +105,7 @@ class Puppet::Parameter
 
         # Is this parameter required?  Defaults to false.
         def required?
-            if defined?(@required)
-                return @required
-            else
-                return false
-            end
+            return defined?(@required) && @required
         end
 
         # Verify that we got a good value
diff --git a/lib/puppet/parameter/value.rb b/lib/puppet/parameter/value.rb
index 5171f25..3482c2c 100644
--- a/lib/puppet/parameter/value.rb
+++ b/lib/puppet/parameter/value.rb
@@ -39,8 +39,7 @@ class Puppet::Parameter::Value
         if regex?
             return true if name =~ value.to_s
         else
-            return true if name == convert(value)
-            return @aliases.include?(convert(value))
+            return(name == convert(value) ? true : @aliases.include?(convert(value)))
         end
     end
 
diff --git a/lib/puppet/parser/ast/ifstatement.rb b/lib/puppet/parser/ast/ifstatement.rb
index 36da50c..cbb61bf 100644
--- a/lib/puppet/parser/ast/ifstatement.rb
+++ b/lib/puppet/parser/ast/ifstatement.rb
@@ -24,11 +24,7 @@ class Puppet::Parser::AST
                 if Puppet::Parser::Scope.true?(value)
                     return @statements.safeevaluate(scope)
                 else
-                    if defined?(@else)
-                        return @else.safeevaluate(scope)
-                    else
-                        return nil
-                    end
+                    return defined?(@else) ? @else.safeevaluate(scope) : nil
                 end
             ensure
                 scope.unset_ephemeral_var(level)
diff --git a/lib/puppet/parser/ast/match_operator.rb b/lib/puppet/parser/ast/match_operator.rb
index 9a12351..2ab2bef 100644
--- a/lib/puppet/parser/ast/match_operator.rb
+++ b/lib/puppet/parser/ast/match_operator.rb
@@ -16,8 +16,7 @@ class Puppet::Parser::AST
         def evaluate(scope)
             lval = @lval.safeevaluate(scope)
 
-            return @operator == "=~" if rval.evaluate_match(lval, scope)
-            return @operator == "!~"
+            return(rval.evaluate_match(lval, scope) ? @operator == "=~" : @operator == "!~")
         end
 
         def initialize(hash)
diff --git a/lib/puppet/parser/ast/resource_override.rb b/lib/puppet/parser/ast/resource_override.rb
index f9071fe..7f7047d 100644
--- a/lib/puppet/parser/ast/resource_override.rb
+++ b/lib/puppet/parser/ast/resource_override.rb
@@ -54,8 +54,7 @@ class Puppet::Parser::AST
                 res
             end
             # decapsulate array in case of only one item
-            return resource.pop if resource.length == 1
-            return resource
+            return(resource.length == 1 ? resource.pop : resource)
         end
 
         # Create our ResourceDef.  Handles type checking for us.
diff --git a/lib/puppet/parser/ast/resource_reference.rb b/lib/puppet/parser/ast/resource_reference.rb
index d2f9b2c..37e82d5 100644
--- a/lib/puppet/parser/ast/resource_reference.rb
+++ b/lib/puppet/parser/ast/resource_reference.rb
@@ -8,8 +8,7 @@ class Puppet::Parser::AST::ResourceReference < Puppet::Parser::AST::Branch
     # and name.
     def evaluate(scope)
         titles = Array(title.safeevaluate(scope)).collect { |t| Puppet::Resource.new(type, t, :namespaces => scope.namespaces) }
-        return titles.pop if titles.length == 1
-        return titles
+        return(titles.length == 1 ? titles.pop : titles)
     end
 
     def to_s
diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb
index 121dae1..7ed000e 100644
--- a/lib/puppet/parser/compiler.rb
+++ b/lib/puppet/parser/compiler.rb
@@ -120,11 +120,7 @@ class Puppet::Parser::Compiler
     # Return the node's environment.
     def environment
         unless defined?(@environment)
-            if node.environment and node.environment != ""
-                @environment = node.environment
-            else
-                @environment = nil
-            end
+            @environment = (node.environment and node.environment != "") ? node.environment : nil
         end
         Puppet::Node::Environment.current = @environment
         @environment
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index 5a0dbfe..f0c7d77 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -65,11 +65,7 @@ class Puppet::Parser::Scope
     # Is the value true?  This allows us to control the definition of truth
     # in one place.
     def self.true?(value)
-        if value == false or value == "" or value == :undef
-            return false
-        else
-            return true
-        end
+        return (value != false and value != "" and value != :undef)
     end
 
     # Is the value a number?, return the correct object or nil if not a number
diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb
index 78c9b86..9bfbf8a 100644
--- a/lib/puppet/provider.rb
+++ b/lib/puppet/provider.rb
@@ -189,11 +189,7 @@ class Puppet::Provider
         end
         return true unless features = klass.required_features
 
-        if satisfies?(*features)
-            return true
-        else
-            return false
-        end
+        return !!satisfies?(*features)
     end
 
 #    def self.to_s
diff --git a/lib/puppet/provider/confiner.rb b/lib/puppet/provider/confiner.rb
index 1649336..bb26ea4 100644
--- a/lib/puppet/provider/confiner.rb
+++ b/lib/puppet/provider/confiner.rb
@@ -12,7 +12,6 @@ module Puppet::Provider::Confiner
 
     # Check whether this implementation is suitable for our platform.
     def suitable?(short = true)
-        return confine_collection.valid? if short
-        return confine_collection.summary
+        return(short ? confine_collection.valid? : confine_collection.summary)
     end
 end
diff --git a/lib/puppet/provider/file/posix.rb b/lib/puppet/provider/file/posix.rb
index a2d1021..ecfd5a6 100644
--- a/lib/puppet/provider/file/posix.rb
+++ b/lib/puppet/provider/file/posix.rb
@@ -52,17 +52,7 @@ Puppet::Type.type(:file).provide :posix do
 
     # Determine if the user is valid, and if so, return the UID
     def validuser?(value)
-        begin
-            number = Integer(value)
-            return number
-        rescue ArgumentError
-            number = nil
-        end
-        if number = uid(value)
-            return number
-        else
-            return false
-        end
+        Integer(value) rescue uid(value) || false
     end
 
     def retrieve(resource)
diff --git a/lib/puppet/provider/file/win32.rb b/lib/puppet/provider/file/win32.rb
index d2b3921..a3613ca 100644
--- a/lib/puppet/provider/file/win32.rb
+++ b/lib/puppet/provider/file/win32.rb
@@ -47,11 +47,7 @@ Puppet::Type.type(:file).provide :microsoft_windows do
         rescue ArgumentError
             number = nil
         end
-        if number = uid(value)
-            return number
-        else
-            return false
-        end
+        return (number = uid(value)) && number
     end
 
     def retrieve(resource)
diff --git a/lib/puppet/provider/macauthorization/macauthorization.rb b/lib/puppet/provider/macauthorization/macauthorization.rb
index a372618..2e941ec 100644
--- a/lib/puppet/provider/macauthorization/macauthorization.rb
+++ b/lib/puppet/provider/macauthorization/macauthorization.rb
@@ -109,11 +109,7 @@ Puppet::Type.type(:macauthorization).provide :macauthorization, :parent => Puppe
     end
 
     def exists?
-        if self.class.parsed_auth_db.has_key?(resource[:name])
-            return true
-        else
-            return false
-        end
+        return !!self.class.parsed_auth_db.has_key?(resource[:name])
     end
 
 
diff --git a/lib/puppet/provider/nameservice.rb b/lib/puppet/provider/nameservice.rb
index 4a7c38b..1dda05d 100644
--- a/lib/puppet/provider/nameservice.rb
+++ b/lib/puppet/provider/nameservice.rb
@@ -6,11 +6,7 @@ require 'puppet'
 class Puppet::Provider::NameService < Puppet::Provider
     class << self
         def autogen_default(param)
-            if defined?(@autogen_defaults)
-                return @autogen_defaults[symbolize(param)]
-            else
-                return nil
-            end
+            return defined?(@autogen_defaults) ? @autogen_defaults[symbolize(param)] : nil
         end
 
         def autogen_defaults(hash)
@@ -36,11 +32,7 @@ class Puppet::Provider::NameService < Puppet::Provider
 
         def option(name, option)
             name = name.intern if name.is_a? String
-            if defined?(@options) and @options.include? name and @options[name].include? option
-                return @options[name][option]
-            else
-                return nil
-            end
+            return (defined?(@options) and @options.include? name and @options[name].include? option) ? @options[name][option] : nil
         end
 
         def options(name, hash)
@@ -202,20 +194,12 @@ class Puppet::Provider::NameService < Puppet::Provider
 
     # Does our object exist?
     def exists?
-        if getinfo(true)
-            return true
-        else
-            return false
-        end
+        return !!getinfo(true)
     end
 
     # Retrieve a specific value by name.
     def get(param)
-        if hash = getinfo(false)
-            return hash[param]
-        else
-            return nil
-        end
+        return (hash = getinfo(false)) ? hash[param] : nil
     end
 
     # Retrieve what we can about our object
@@ -230,11 +214,7 @@ class Puppet::Provider::NameService < Puppet::Provider
         end
 
         # Now convert our Etc struct into a hash.
-        if @objectinfo
-            return info2hash(@objectinfo)
-        else
-            return nil
-        end
+        return @objectinfo ? info2hash(@objectinfo) : nil
     end
 
     # The list of all groups the user is a member of.  Different
diff --git a/lib/puppet/provider/package/appdmg.rb b/lib/puppet/provider/package/appdmg.rb
index a07b43f..011a5f5 100644
--- a/lib/puppet/provider/package/appdmg.rb
+++ b/lib/puppet/provider/package/appdmg.rb
@@ -93,11 +93,7 @@ Puppet::Type.type(:package).provide(:appdmg, :parent => Puppet::Provider::Packag
     end # def self.installpkgdmg
 
     def query
-        if FileTest.exists?("/var/db/.puppet_appdmg_installed_#{@resource[:name]}")
-            return {:name => @resource[:name], :ensure => :present}
-        else
-            return nil
-        end
+        return FileTest.exists?("/var/db/.puppet_appdmg_installed_#{@resource[:name]}") ? {:name => @resource[:name], :ensure => :present} : nil
     end
 
     def install
diff --git a/lib/puppet/provider/package/apple.rb b/lib/puppet/provider/package/apple.rb
index 9214d4e..49875da 100755
--- a/lib/puppet/provider/package/apple.rb
+++ b/lib/puppet/provider/package/apple.rb
@@ -36,11 +36,7 @@ Puppet::Type.type(:package).provide :apple, :parent => Puppet::Provider::Package
     end
 
     def query
-        if FileTest.exists?("/Library/Receipts/#{@resource[:name]}.pkg")
-            return {:name => @resource[:name], :ensure => :present}
-        else
-            return nil
-        end
+        return FileTest.exists?("/Library/Receipts/#{@resource[:name]}.pkg") ? {:name => @resource[:name], :ensure => :present} : nil
     end
 
     def install
diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb
index afbff62..a26b611 100755
--- a/lib/puppet/provider/package/apt.rb
+++ b/lib/puppet/provider/package/apt.rb
@@ -21,11 +21,7 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
     def checkforcdrom
         unless defined?(@@checkedforcdrom)
             if FileTest.exists? "/etc/apt/sources.list"
-                if File.read("/etc/apt/sources.list") =~ /^[^#]*cdrom:/
-                    @@checkedforcdrom = true
-                else
-                    @@checkedforcdrom = false
-                end
+                @@checkedforcdrom = !!(File.read("/etc/apt/sources.list") =~ /^[^#]*cdrom:/)
             else
                 # This is basically a pathalogical case, but we'll just
                 # ignore it
diff --git a/lib/puppet/provider/parsedfile.rb b/lib/puppet/provider/parsedfile.rb
index 65842a2..1ca3e31 100755
--- a/lib/puppet/provider/parsedfile.rb
+++ b/lib/puppet/provider/parsedfile.rb
@@ -322,11 +322,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
     end
 
     def exists?
-        if @property_hash[:ensure] == :absent or @property_hash[:ensure].nil?
-            return false
-        else
-            return true
-        end
+        return !(@property_hash[:ensure] == :absent or @property_hash[:ensure].nil?)
     end
 
     # Write our data to disk.
diff --git a/lib/puppet/rails/resource.rb b/lib/puppet/rails/resource.rb
index 0a9172a..3b2e78b 100644
--- a/lib/puppet/rails/resource.rb
+++ b/lib/puppet/rails/resource.rb
@@ -48,11 +48,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base
     end
 
     def file
-        if f = self.source_file
-            return f.filename
-        else
-            return nil
-        end
+        return (f = self.source_file) ? f.filename : nil
     end
 
     def file=(file)
@@ -179,11 +175,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base
 
     def parameter(param)
         if pn = param_names.find_by_name(param)
-            if pv = param_values.find(:first, :conditions => [ 'param_name_id = ?', pn])
-                return pv.value
-            else
-                return nil
-            end
+            return (pv = param_values.find(:first, :conditions => [ 'param_name_id = ?', pn])) ? pv.value : nil
         end
     end
 
diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb
index 6cd35b0..b41763a 100644
--- a/lib/puppet/resource.rb
+++ b/lib/puppet/resource.rb
@@ -183,8 +183,7 @@ class Puppet::Resource
 
     # Find our resource.
     def resolve
-        return catalog.resource(to_s) if catalog
-        return nil
+        return(catalog ? catalog.resource(to_s) : nil)
     end
 
     def title=(value)
@@ -215,8 +214,7 @@ class Puppet::Resource
     end
 
     def key_attributes
-        return resource_type.key_attributes if resource_type.respond_to? :key_attributes
-        return [:name]
+        return(resource_type.respond_to? :key_attributes) ? resource_type.key_attributes : [:name]
     end
 
     # Convert our resource to Puppet code.
diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb
index 684d2c2..b118849 100644
--- a/lib/puppet/resource/type.rb
+++ b/lib/puppet/resource/type.rb
@@ -57,8 +57,7 @@ class Puppet::Resource::Type
     def child_of?(klass)
         return false unless parent
 
-        return true if klass == parent_type
-        return parent_type.child_of?(klass)
+        return(klass == parent_type ? true : parent_type.child_of?(klass))
     end
 
     # Now evaluate the code associated with this class or definition.
@@ -230,8 +229,7 @@ class Puppet::Resource::Type
         return true if param == "name"
         return true if Puppet::Type.metaparam?(param)
         return false unless defined?(@arguments)
-        return true if arguments.include?(param)
-        return false
+        return(arguments.include?(param) ? true : false)
     end
 
     def set_arguments(arguments)
diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb
index ea18946..e0d9695 100644
--- a/lib/puppet/simple_graph.rb
+++ b/lib/puppet/simple_graph.rb
@@ -45,8 +45,7 @@ class Puppet::SimpleGraph
 
         # Test whether we share an edge with a given vertex.
         def has_edge?(direction, vertex)
-            return true if vertex_adjacencies(direction, vertex).length > 0
-            return false
+            return(vertex_adjacencies(direction, vertex).length > 0 ? true : false)
         end
 
         # Create methods for returning the degree and edges.
diff --git a/lib/puppet/ssl/certificate_authority.rb b/lib/puppet/ssl/certificate_authority.rb
index 8a3d0b4..1c6e76f 100644
--- a/lib/puppet/ssl/certificate_authority.rb
+++ b/lib/puppet/ssl/certificate_authority.rb
@@ -75,11 +75,7 @@ class Puppet::SSL::CertificateAuthority
         return true if ['true', true].include?(auto)
 
         raise ArgumentError, "The autosign configuration '#{auto}' must be a fully qualified file" unless auto =~ /^\//
-        if FileTest.exist?(auto)
-            return auto
-        else
-            return false
-        end
+        return FileTest.exist?(auto) && auto
     end
 
     # Create an AuthStore for autosigning.
@@ -204,11 +200,7 @@ class Puppet::SSL::CertificateAuthority
 
     # Print a given host's certificate as text.
     def print(name)
-        if cert = Puppet::SSL::Certificate.find(name)
-            return cert.to_text
-        else
-            return nil
-        end
+        return (cert = Puppet::SSL::Certificate.find(name)) ? cert.to_text : nil
     end
 
     # Revoke a given certificate.
diff --git a/lib/puppet/sslcertificates/certificate.rb b/lib/puppet/sslcertificates/certificate.rb
index 11276bf..e4278bc 100644
--- a/lib/puppet/sslcertificates/certificate.rb
+++ b/lib/puppet/sslcertificates/certificate.rb
@@ -115,11 +115,7 @@ class Puppet::SSLCertificates::Certificate
             @password = nil
         end
 
-        if hash.include?(:selfsign)
-            @selfsign = hash[:selfsign]
-        else
-            @selfsign = false
-        end
+        @selfsign = hash.include?(:selfsign) && hash[:selfsign]
     end
 
     # this only works for servers, not for users
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index b063e1d..e2445b1 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -309,11 +309,7 @@ class Type
         @validattrs ||= {}
 
         unless @validattrs.include?(name)
-            if self.validproperty?(name) or self.validparameter?(name) or self.metaparam?(name)
-                @validattrs[name] = true
-            else
-                @validattrs[name] = false
-            end
+            @validattrs[name] = !!(self.validproperty?(name) or self.validparameter?(name) or self.metaparam?(name))
         end
 
         @validattrs[name]
@@ -322,11 +318,7 @@ class Type
     # does the name reflect a valid property?
     def self.validproperty?(name)
         name = symbolize(name)
-        if @validproperties.include?(name)
-            return @validproperties[name]
-        else
-            return false
-        end
+        return @validproperties.include?(name) && @validproperties[name]
     end
 
     # Return the list of validproperties
@@ -339,11 +331,7 @@ class Type
     # does the name reflect a valid parameter?
     def self.validparameter?(name)
         raise Puppet::DevError, "Class #{self} has not defined parameters" unless defined?(@parameters)
-        if @paramhash.include?(name) or @@metaparamhash.include?(name)
-            return true
-        else
-            return false
-        end
+        return !!(@paramhash.include?(name) or @@metaparamhash.include?(name))
     end
 
     # This is a forward-compatibility method - it's the validity interface we'll use in Puppet::Resource.
@@ -468,11 +456,7 @@ class Type
     # retrieve the 'should' value for a specified property
     def should(name)
         name = attr_alias(name)
-        if prop = @parameters[name] and prop.is_a?(Puppet::Property)
-            return prop.should
-        else
-            return nil
-        end
+        return (prop = @parameters[name] and prop.is_a?(Puppet::Property)) ? prop.should : nil
     end
 
     # Create the actual attribute instance.  Requires either the attribute
@@ -512,11 +496,7 @@ class Type
     # LAK:NOTE(20081028) Since the 'parameter' method is now a superset of this method,
     # this one should probably go away at some point.
     def property(name)
-        if obj = @parameters[symbolize(name)] and obj.is_a?(Puppet::Property)
-            return obj
-        else
-            return nil
-        end
+        return (obj = @parameters[symbolize(name)] and obj.is_a?(Puppet::Property)) ? obj : nil
     end
 
     # For any parameters or properties that have defaults and have not yet been
@@ -555,11 +535,7 @@ class Type
     def value(name)
         name = attr_alias(name)
 
-        if obj = @parameters[name] and obj.respond_to?(:value)
-            return obj.value
-        else
-            return nil
-        end
+        return (obj = @parameters[name] and obj.respond_to?(:value)) ? obj.value : nil
     end
 
     def version
@@ -617,11 +593,7 @@ class Type
     # this is a retarded hack method to get around the difference between
     # component children and file children
     def self.depthfirst?
-        if defined?(@depthfirst)
-            return @depthfirst
-        else
-            return false
-        end
+        return defined?(@depthfirst) && @depthfirst
     end
 
     def depthfirst?
diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb
index 0a6788e..3f6448b 100755
--- a/lib/puppet/type/cron.rb
+++ b/lib/puppet/type/cron.rb
@@ -77,11 +77,7 @@ Puppet::Type.newtype(:cron) do
         # Verify that a number is within the specified limits.  Return the
         # number if it is, or false if it is not.
         def limitcheck(num, lower, upper)
-            if num >= lower and num <= upper
-                return num
-            else
-                return false
-            end
+            return (num >= lower and num <= upper) && num
         end
 
         # Verify that a value falls within the specified array.  Does case
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index bf79893..aeb651f 100644
--- a/lib/puppet/type/file.rb
+++ b/lib/puppet/type/file.rb
@@ -514,11 +514,7 @@ Puppet::Type.newtype(:file) do
 
         val = @parameters[:recurse].value
 
-        if val and (val == true or val == :remote)
-            return true
-        else
-            return false
-        end
+        return !!(val and (val == true or val == :remote))
     end
 
     # Recurse the target of the link.
@@ -666,8 +662,7 @@ Puppet::Type.newtype(:file) do
         # The user doesn't really care, apparently
         if self[:ensure] == :present
             return true unless s = stat
-            return true if s.ftype == "file"
-            return false
+            return(s.ftype == "file" ? true : false)
         end
 
         # If we've gotten here, then :ensure isn't set
diff --git a/lib/puppet/type/file/ensure.rb b/lib/puppet/type/file/ensure.rb
index ab2419c..a1152c0 100755
--- a/lib/puppet/type/file/ensure.rb
+++ b/lib/puppet/type/file/ensure.rb
@@ -137,11 +137,7 @@ module Puppet
             end
 
             if self.should == :present
-                if currentvalue.nil? or currentvalue == :absent
-                    return false
-                else
-                    return true
-                end
+                return !(currentvalue.nil? or currentvalue == :absent)
             else
                 return super(currentvalue)
             end
diff --git a/lib/puppet/type/file/group.rb b/lib/puppet/type/file/group.rb
index ddfe838..a5129ae 100755
--- a/lib/puppet/type/file/group.rb
+++ b/lib/puppet/type/file/group.rb
@@ -79,17 +79,7 @@ module Puppet
 
         # Determine if the group is valid, and if so, return the GID
         def validgroup?(value)
-            begin
-                number = Integer(value)
-                return number
-            rescue ArgumentError
-                number = nil
-            end
-            if number = gid(value)
-                return number
-            else
-                return false
-            end
+            Integer(value) rescue gid(value) || false
         end
 
         # Normal users will only be able to manage certain groups.  Right now,
diff --git a/lib/puppet/type/resources.rb b/lib/puppet/type/resources.rb
index dc620bb..a301c9b 100644
--- a/lib/puppet/type/resources.rb
+++ b/lib/puppet/type/resources.rb
@@ -127,11 +127,7 @@ Puppet::Type.newtype(:resources) do
 
         return false if system_users().include?(resource[:name])
 
-        if current_values[resource.property(:uid)] <= self[:unless_system_user]
-            return false
-        else
-            return true
-        end
+        return current_values[resource.property(:uid)] > self[:unless_system_user]
     end
 
     def system_users
diff --git a/lib/puppet/type/sshkey.rb b/lib/puppet/type/sshkey.rb
index 31473e3..7dc627c 100755
--- a/lib/puppet/type/sshkey.rb
+++ b/lib/puppet/type/sshkey.rb
@@ -35,11 +35,7 @@ module Puppet
             # We actually want to return the whole array here, not just the first
             # value.
             def should
-                if defined?(@should)
-                    return @should
-                else
-                    return nil
-                end
+                return defined?(@should) ? @should : nil
             end
 
             validate do |value|
diff --git a/lib/puppet/type/tidy.rb b/lib/puppet/type/tidy.rb
index d1235b1..1f7ae46 100755
--- a/lib/puppet/type/tidy.rb
+++ b/lib/puppet/type/tidy.rb
@@ -80,8 +80,7 @@ Puppet::Type.newtype(:tidy) do
         def tidy?(path, stat)
             basename = File.basename(path)
             flags = File::FNM_DOTMATCH | File::FNM_PATHNAME
-            return true if value.find {|pattern| File.fnmatch(pattern, basename, flags) }
-            return false
+            return(value.find {|pattern| File.fnmatch(pattern, basename, flags) } ? true : false)
         end
     end
 
@@ -118,11 +117,7 @@ Puppet::Type.newtype(:tidy) do
 
         def tidy?(path, stat)
             # If the file's older than we allow, we should get rid of it.
-            if (Time.now.to_i - stat.send(resource[:type]).to_i) > value
-                return true
-            else
-                return false
-            end
+            return (Time.now.to_i - stat.send(resource[:type]).to_i) > value
         end
 
         munge do |age|
@@ -167,11 +162,7 @@ Puppet::Type.newtype(:tidy) do
         end
 
         def tidy?(path, stat)
-            if stat.size >= value
-                return true
-            else
-                return false
-            end
+            return stat.size >= value
         end
 
         munge do |size|
diff --git a/lib/puppet/util/autoload/file_cache.rb b/lib/puppet/util/autoload/file_cache.rb
index 873dc8f..44d9889 100644
--- a/lib/puppet/util/autoload/file_cache.rb
+++ b/lib/puppet/util/autoload/file_cache.rb
@@ -48,8 +48,7 @@ module Puppet::Util::Autoload::FileCache
 
     def found_file?(path, type = nil)
         if data = found_files[path] and ! data_expired?(data[:time])
-            return false if type and ! data[:stat].send(type)
-            return true
+            return(type and ! data[:stat].send(type)) ? false : true
         else
             return false
         end
@@ -60,11 +59,7 @@ module Puppet::Util::Autoload::FileCache
     end
 
     def missing_file?(path)
-        if time = missing_files[path] and ! data_expired?(time)
-            return true
-        else
-            return false
-        end
+        return !!(time = missing_files[path] and ! data_expired?(time))
     end
 
     def missing_file(path)
diff --git a/lib/puppet/util/backups.rb b/lib/puppet/util/backups.rb
index e08bf57..1e05149 100644
--- a/lib/puppet/util/backups.rb
+++ b/lib/puppet/util/backups.rb
@@ -12,8 +12,7 @@ module Puppet::Util::Backups
         file ||= self[:path]
         return true unless FileTest.exists?(file)
 
-        return perform_backup_with_bucket(file) if self.bucket
-        return perform_backup_with_backuplocal(file, self[:backup])
+        return(self.bucket ? perform_backup_with_bucket(file) : perform_backup_with_backuplocal(file, self[:backup]))
     end
 
     private
diff --git a/lib/puppet/util/checksums.rb b/lib/puppet/util/checksums.rb
index 41f8786..7b3ef6e 100644
--- a/lib/puppet/util/checksums.rb
+++ b/lib/puppet/util/checksums.rb
@@ -8,20 +8,12 @@ module Puppet::Util::Checksums
 
     # Strip the checksum type from an existing checksum
     def sumdata(checksum)
-        if checksum =~ /^\{(\w+)\}(.+)/
-            return $2
-        else
-            return nil
-        end
+        return checksum =~ /^\{(\w+)\}(.+)/ ? $2 : nil
     end
 
     # Strip the checksum type from an existing checksum
     def sumtype(checksum)
-        if checksum =~ /^\{(\w+)\}/
-            return $1
-        else
-            return nil
-        end
+        return checksum =~ /^\{(\w+)\}/ ? $1 : nil
     end
 
     # Calculate a checksum using Digest::MD5.
diff --git a/lib/puppet/util/feature.rb b/lib/puppet/util/feature.rb
index 30422ce..8e2f81f 100644
--- a/lib/puppet/util/feature.rb
+++ b/lib/puppet/util/feature.rb
@@ -48,11 +48,7 @@ class Puppet::Util::Feature
         feature = method.to_s.sub(/\?$/, '')
         @loader.load(feature)
 
-        if respond_to?(method)
-            return self.send(method)
-        else
-            return false
-        end
+        return respond_to?(method) && self.send(method)
     end
 
     # Actually test whether the feature is present.  We only want to test when
diff --git a/lib/puppet/util/fileparsing.rb b/lib/puppet/util/fileparsing.rb
index 7348b89..c8ab53d 100644
--- a/lib/puppet/util/fileparsing.rb
+++ b/lib/puppet/util/fileparsing.rb
@@ -137,11 +137,7 @@ module Puppet::Util::FileParsing
 
     # Try to match a specific text line.
     def handle_text_line(line, record)
-        if line =~ record.match
-            return {:record_type => record.name, :line => line}
-        else
-            return nil
-        end
+        return line =~ record.match ? {:record_type => record.name, :line => line} : nil
     end
 
     # Try to match a record.
diff --git a/lib/puppet/util/inifile.rb b/lib/puppet/util/inifile.rb
index b901348..3488ce5 100644
--- a/lib/puppet/util/inifile.rb
+++ b/lib/puppet/util/inifile.rb
@@ -56,8 +56,7 @@ module Puppet::Util::IniConfig
         # exists, return nil
         def [](key)
             entry = find_entry(key)
-            return nil if entry.nil?
-            return entry[1]
+            return(entry.nil? ? nil : entry[1])
         end
 
         # Format the section as text in the way it should be
diff --git a/lib/puppet/util/ldap/manager.rb b/lib/puppet/util/ldap/manager.rb
index cfa7cb3..93e8baa 100644
--- a/lib/puppet/util/ldap/manager.rb
+++ b/lib/puppet/util/ldap/manager.rb
@@ -103,8 +103,7 @@ class Puppet::Util::Ldap::Manager
 
     # Create our normal search filter.
     def filter
-        return "objectclass=#{objectclasses[0]}" if objectclasses.length == 1
-        return "(&(objectclass=" + objectclasses.join(")(objectclass=") + "))"
+        return(objectclasses.length == 1 ? "objectclass=#{objectclasses[0]}" : "(&(objectclass=" + objectclasses.join(")(objectclass=") + "))")
     end
 
     # Find the associated entry for a resource.  Returns a hash, minus
@@ -209,8 +208,7 @@ class Puppet::Util::Ldap::Manager
                 result << entry2provider(entry)
             end
         end
-        return nil if result.empty?
-        return result
+        return(result.empty? ? nil : result)
     end
 
     # Update the ldap entry with the desired state.
diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb
index 5dea6d6..16a4eb2 100644
--- a/lib/puppet/util/log.rb
+++ b/lib/puppet/util/log.rb
@@ -71,11 +71,7 @@ class Puppet::Util::Log
     def Log.create(hash)
         raise Puppet::DevError, "Logs require a level" unless hash.include?(:level)
         raise Puppet::DevError, "Invalid log level #{hash[:level]}" unless @levels.index(hash[:level])
-        if @levels.index(hash[:level]) >= @loglevel
-            return Puppet::Util::Log.new(hash)
-        else
-            return nil
-        end
+        return @levels.index(hash[:level]) >= @loglevel ? Puppet::Util::Log.new(hash) : nil
     end
 
     def Log.destinations
diff --git a/lib/puppet/util/provider_features.rb b/lib/puppet/util/provider_features.rb
index d106d47..37f11aa 100644
--- a/lib/puppet/util/provider_features.rb
+++ b/lib/puppet/util/provider_features.rb
@@ -15,11 +15,7 @@ module Puppet::Util::ProviderFeatures
         # Are all of the requirements met?
         def available?(obj)
             if self.methods
-                if methods_available?(obj)
-                    return true
-                else
-                    return false
-                end
+                return !!methods_available?(obj)
             else
                 # In this case, the provider has to declare support for this
                 # feature, and that's been checked before we ever get to the
@@ -116,11 +112,7 @@ module Puppet::Util::ProviderFeatures
             # determine if the feature is present.
             @feature_module.send(:define_method, :feature?) do |name|
                 method = name.to_s + "?"
-                if respond_to?(method) and send(method)
-                    return true
-                else
-                    return false
-                end
+                return !!(respond_to?(method) and send(method))
             end
 
             # Create a method that will list all functional features.
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb
index b8f4eff..055492c 100644
--- a/lib/puppet/util/settings.rb
+++ b/lib/puppet/util/settings.rb
@@ -54,11 +54,7 @@ class Puppet::Util::Settings
     # Is our parameter a boolean parameter?
     def boolean?(param)
         param = param.to_sym
-        if @config.include?(param) and @config[param].kind_of? BooleanSetting
-            return true
-        else
-            return false
-        end
+        return !!(@config.include?(param) and @config[param].kind_of? BooleanSetting)
     end
 
     # Remove all set values, potentially skipping cli values.
diff --git a/lib/puppet/util/settings/setting.rb b/lib/puppet/util/settings/setting.rb
index c3a0371..848c778 100644
--- a/lib/puppet/util/settings/setting.rb
+++ b/lib/puppet/util/settings/setting.rb
@@ -50,19 +50,11 @@ class Puppet::Util::Settings::Setting
     end
 
     def iscreated?
-        if defined?(@iscreated)
-            return @iscreated
-        else
-            return false
-        end
+        return defined?(@iscreated) && @iscreated
     end
 
     def set?
-        if defined?(@value) and ! @value.nil?
-            return true
-        else
-            return false
-        end
+        return !!(defined?(@value) and ! @value.nil?)
     end
 
     # short name for the celement
diff --git a/lib/puppet/util/subclass_loader.rb b/lib/puppet/util/subclass_loader.rb
index 505c4b0..02d4af1 100644
--- a/lib/puppet/util/subclass_loader.rb
+++ b/lib/puppet/util/subclass_loader.rb
@@ -63,11 +63,7 @@ module Puppet::Util::SubclassLoader
             super
         end
         return nil unless defined?(@subclassname)
-        if c = self.send(@subclassname, method)
-            return c
-        else
-            return nil
-        end
+        return self.send(@subclassname, method) || nil
     end
 
     # Retrieve or calculate a name.
diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb
index 38bb042..e5a1dce 100755
--- a/test/lib/puppettest.rb
+++ b/test/lib/puppettest.rb
@@ -241,11 +241,7 @@ module PuppetTest
     end
 
     def textmate?
-        if ENV["TM_FILENAME"]
-            return true
-        else
-            return false
-        end
+        return !!ENV["TM_FILENAME"]
     end
 
     def tstdir
diff --git a/test/network/handler/ca.rb b/test/network/handler/ca.rb
index 4d15312..6a4506a 100755
--- a/test/network/handler/ca.rb
+++ b/test/network/handler/ca.rb
@@ -6,11 +6,7 @@ require 'puppettest'
 require 'puppet/network/handler/ca'
 require 'mocha'
 
-if ARGV.length > 0 and ARGV[0] == "short"
-    $short = true
-else
-    $short = false
-end
+$short = (ARGV.length > 0 and ARGV[0] == "short")
 
 class TestCA < Test::Unit::TestCase
     include PuppetTest::ServerTest
diff --git a/test/ral/manager/attributes.rb b/test/ral/manager/attributes.rb
index 7e9f34b..95a0776 100755
--- a/test/ral/manager/attributes.rb
+++ b/test/ral/manager/attributes.rb
@@ -276,11 +276,7 @@ class TestTypeAttributes < Test::Unit::TestCase
         $yep = :absent
         type.provide(:only) do
             def self.supports_parameter?(param)
-                if param.name == :nope
-                    return false
-                else
-                    return true
-                end
+                return param.name != :nope
             end
 
             def yep
diff --git a/test/ral/providers/group.rb b/test/ral/providers/group.rb
index d6783bf..6a0d202 100755
--- a/test/ral/providers/group.rb
+++ b/test/ral/providers/group.rb
@@ -49,11 +49,7 @@ class TestGroupProvider < Test::Unit::TestCase
         def missing?(group)
             output = %x{nidump -r /groups/#{group} / 2>/dev/null}.chomp
 
-            if output == ""
-                return true
-            else
-                return false
-            end
+            return output == ""
 
             assert_equal("", output, "Group #{group} is present:\n#{output}")
         end
diff --git a/test/ral/providers/user.rb b/test/ral/providers/user.rb
index e4ec3c1..793b649 100755
--- a/test/ral/providers/user.rb
+++ b/test/ral/providers/user.rb
@@ -34,11 +34,7 @@ class TestUserProvider < Test::Unit::TestCase
         def missing?(user)
             output = %x{nidump -r /users/#{user} / 2>/dev/null}.chomp
 
-            if output == ""
-                return true
-            else
-                return false
-            end
+            return output == ""
 
             assert_equal("", output, "User #{user} is present:\n#{output}")
         end
diff --git a/test/ral/type/cron.rb b/test/ral/type/cron.rb
index 6b561c3..37cba1b 100755
--- a/test/ral/type/cron.rb
+++ b/test/ral/type/cron.rb
@@ -40,11 +40,7 @@ class TestCron < Test::Unit::TestCase
             tab = Puppet::Type.type(:cron).filetype.read(@me)
         }
 
-        if $CHILD_STATUS == 0
-            @currenttab = tab
-        else
-            @currenttab = nil
-        end
+        @currenttab = $CHILD_STATUS == 0 ? tab : nil
     end
 
     # Restore the cron tab to its original form.

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list