diff options
| author | Ian Taylor <ian@lorf.org> | 2009-06-05 12:39:04 -0400 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-06-06 09:12:00 +1000 |
| commit | 4f2c066a97e59a89df64af4b25beac6f3f0553c2 (patch) | |
| tree | 126540beec3c65448e01e1b48d27275ec4ee6ea4 /lib/puppet/util | |
| parent | 97e6975d69f239e24993315a25a3117b1daa48c3 (diff) | |
| download | puppet-4f2c066a97e59a89df64af4b25beac6f3f0553c2.tar.gz puppet-4f2c066a97e59a89df64af4b25beac6f3f0553c2.tar.xz puppet-4f2c066a97e59a89df64af4b25beac6f3f0553c2.zip | |
Removed extra whitespace from end of lines
Diffstat (limited to 'lib/puppet/util')
24 files changed, 84 insertions, 84 deletions
diff --git a/lib/puppet/util/classgen.rb b/lib/puppet/util/classgen.rb index 4e1e57c85..1aa961399 100644 --- a/lib/puppet/util/classgen.rb +++ b/lib/puppet/util/classgen.rb @@ -95,7 +95,7 @@ module Puppet::Util::ClassGen end @name = name end - else + else options[:parent] ||= self evalmethod = :class_eval # Create the class, with the correct name. diff --git a/lib/puppet/util/config_store.rb b/lib/puppet/util/config_store.rb index 668d73f6e..ad18259bd 100644 --- a/lib/puppet/util/config_store.rb +++ b/lib/puppet/util/config_store.rb @@ -54,8 +54,8 @@ module Puppet::Util def collect_exported(client, conditions) raise Puppet::DevError, "%s has not overridden collect_exported" % self.class.name - end - + end + end end diff --git a/lib/puppet/util/constant_inflector.rb b/lib/puppet/util/constant_inflector.rb index eeeaa0632..29d334348 100644 --- a/lib/puppet/util/constant_inflector.rb +++ b/lib/puppet/util/constant_inflector.rb @@ -5,7 +5,7 @@ # file names. module Puppet::Util::ConstantInflector def file2constant(file) - # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] + # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] x = file.split("/").collect { |name| name.capitalize }.join("::").gsub(/_+(.)/) { |term| $1.capitalize } end diff --git a/lib/puppet/util/diff.rb b/lib/puppet/util/diff.rb index f37ea0850..ac3a1c3c9 100644 --- a/lib/puppet/util/diff.rb +++ b/lib/puppet/util/diff.rb @@ -35,8 +35,8 @@ module Puppet::Util::Diff diffs.each do |piece| begin - hunk = ::Diff::LCS::Hunk.new(data_old, data_new, piece, - context_lines, + hunk = ::Diff::LCS::Hunk.new(data_old, data_new, piece, + context_lines, file_length_difference) file_length_difference = hunk.file_length_difference next unless oldhunk diff --git a/lib/puppet/util/execution.rb b/lib/puppet/util/execution.rb index b8dcde58d..7db7137fb 100644 --- a/lib/puppet/util/execution.rb +++ b/lib/puppet/util/execution.rb @@ -1,5 +1,5 @@ module Puppet::Util::Execution - module_function + module_function # Run some code with a specific environment. Resets the environment back to # what it was at the end of the code. diff --git a/lib/puppet/util/feature.rb b/lib/puppet/util/feature.rb index 2669d1ab1..94ee3be8b 100644 --- a/lib/puppet/util/feature.rb +++ b/lib/puppet/util/feature.rb @@ -26,7 +26,7 @@ class Puppet::Util::Feature end @results[name] = result end - + meta_def(method) do unless @results.include?(name) @results[name] = test(name, options) @@ -34,14 +34,14 @@ class Puppet::Util::Feature @results[name] end end - + # Create a new feature collection. def initialize(path) @path = path @results = {} @loader = Puppet::Util::Autoload.new(self, @path) end - + def load @loader.loadall end @@ -66,12 +66,12 @@ class Puppet::Util::Feature result = true if ary = options[:libs] ary = [ary] unless ary.is_a?(Array) - + ary.each do |lib| unless lib.is_a?(String) raise ArgumentError, "Libraries must be passed as strings not %s" % lib.class end - + begin require lib rescue Exception diff --git a/lib/puppet/util/fileparsing.rb b/lib/puppet/util/fileparsing.rb index dca0d51c0..06f8a2e7d 100644 --- a/lib/puppet/util/fileparsing.rb +++ b/lib/puppet/util/fileparsing.rb @@ -169,7 +169,7 @@ module Puppet::Util::FileParsing fields = [] ret = {} record.fields.zip(match.captures).each do |field, value| - if value == record.absent + if value == record.absent ret[field] = :absent else ret[field] = value @@ -223,7 +223,7 @@ module Puppet::Util::FileParsing # Split text into separate lines using the record separator. def lines(text) # Remove any trailing separators, and then split based on them - # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] + # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] x = text.sub(/#{self.line_separator}\Q/,'').split(self.line_separator) end diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb index 34feeab90..93c002fa9 100755 --- a/lib/puppet/util/filetype.rb +++ b/lib/puppet/util/filetype.rb @@ -111,9 +111,9 @@ class Puppet::Util::FileType # Overwrite the file. def write(text) require "tempfile" - tf = Tempfile.new("puppet") - tf.print text; tf.flush - FileUtils.cp(tf.path, @path) + tf = Tempfile.new("puppet") + tf.print text; tf.flush + FileUtils.cp(tf.path, @path) tf.close # If SELinux is present, we need to ensure the file has its expected context set_selinux_default_context(@path) @@ -217,7 +217,7 @@ class Puppet::Util::FileType raise Puppet::Error, "User %s not authorized to use cron" % @path if output.include?("you are not authorized to use cron") return output rescue => detail - raise Puppet::Error, "Could not read crontab for %s: %s" % [@path, detail] + raise Puppet::Error, "Could not read crontab for %s: %s" % [@path, detail] end end diff --git a/lib/puppet/util/graph.rb b/lib/puppet/util/graph.rb index fc05cafd9..a052bf8f1 100644 --- a/lib/puppet/util/graph.rb +++ b/lib/puppet/util/graph.rb @@ -13,11 +13,11 @@ module Puppet::Util::Graph # Allow our calling function to send in a graph, so that we # can call this recursively with one graph. graph ||= Puppet::SimpleGraph.new - + self.each do |child| unless block_given? and ! yield(child) graph.add_edge(self, child) - + if child.respond_to?(:to_graph) child.to_graph(graph, &block) end @@ -25,7 +25,7 @@ module Puppet::Util::Graph end # Do a topsort, which will throw an exception if the graph is cyclic. - + graph end end diff --git a/lib/puppet/util/inifile.rb b/lib/puppet/util/inifile.rb index f5fab8530..3c82f7d37 100644 --- a/lib/puppet/util/inifile.rb +++ b/lib/puppet/util/inifile.rb @@ -5,7 +5,7 @@ # something has changed are written back to disk # Great care is taken to preserve comments and blank lines from the original # files -# +# # The parsing tries to stay close to python's ConfigParser require 'puppet/util/filetype' @@ -79,7 +79,7 @@ module Puppet::Util::IniConfig return text end - private + private def find_entry(key) @entries.each do |entry| if entry.is_a?(Array) && entry[0] == key @@ -88,7 +88,7 @@ module Puppet::Util::IniConfig end return nil end - + end # A logical .ini-file that can be spread across several physical @@ -113,7 +113,7 @@ module Puppet::Util::IniConfig text.each_line do |l| line += 1 if l.strip.empty? || "#;".include?(l[0,1]) || - (l.split(nil, 2)[0].downcase == "rem" && + (l.split(nil, 2)[0].downcase == "rem" && l[0,1].downcase == "r") # Whitespace or comment if section.nil? @@ -146,7 +146,7 @@ module Puppet::Util::IniConfig end # Store all modifications made to sections in this file back - # to the physical files. If no modifications were made to + # to the physical files. If no modifications were made to # a physical file, nothing is written def store @files.each do |file, lines| diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb index 8f8d46097..94b0bcffa 100644 --- a/lib/puppet/util/log.rb +++ b/lib/puppet/util/log.rb @@ -129,7 +129,7 @@ class Puppet::Util::Log unless @levels.index(hash[:level]) raise Puppet::DevError, "Invalid log level %s" % hash[:level] end - if @levels.index(hash[:level]) >= @loglevel + if @levels.index(hash[:level]) >= @loglevel return Puppet::Util::Log.new(hash) else return nil @@ -251,8 +251,8 @@ class Puppet::Util::Log end newdesttype :console do - - + + RED = {:console => "[0;31m", :html => "FFA0A0"} GREEN = {:console => "[0;32m", :html => "00CD00"} YELLOW = {:console => "[0;33m", :html => "FFFF60"} @@ -279,7 +279,7 @@ class Puppet::Util::Log :emerg => HRED, :crit => HRED } - + def colorize(level, str) case Puppet[:color] when false; str @@ -287,11 +287,11 @@ class Puppet::Util::Log when :html, "html"; html_color(level, str) end end - + def console_color(level, str) @@colormap[level][:console] + str + RESET[:console] end - + def html_color(level, str) %{<span style="color: %s">%s</span>} % [@@colormap[level][:html], str] end @@ -432,7 +432,7 @@ class Puppet::Util::Log # for a loop here, if the machine somehow gets the destination set as # itself. def Log.newmessage(msg) - if @levels.index(msg.level) < @loglevel + if @levels.index(msg.level) < @loglevel return end @@ -444,7 +444,7 @@ class Puppet::Util::Log end def Log.sendlevel?(level) - @levels.index(level) >= @loglevel + @levels.index(level) >= @loglevel end # Reopen all of our logs. diff --git a/lib/puppet/util/metric.rb b/lib/puppet/util/metric.rb index f352462cd..b713246d5 100644 --- a/lib/puppet/util/metric.rb +++ b/lib/puppet/util/metric.rb @@ -3,7 +3,7 @@ require 'puppet' # A class for handling metrics. This is currently ridiculously hackish. class Puppet::Util::Metric - + attr_accessor :type, :name, :value, :label attr_writer :values @@ -32,7 +32,7 @@ class Puppet::Util::Metric start ||= Time.now.to_i - 5 @rrd = RRDtool.new(self.path) - args = [] + args = [] values.each { |value| # the 7200 is the heartbeat -- this means that any data that isn't @@ -81,7 +81,7 @@ class Puppet::Util::Metric args << defs args << lines args.flatten! - if range + if range args.push("--start",range[0],"--end",range[1]) else args.push("--start", Time.now.to_i - time, "--end", Time.now.to_i) @@ -147,7 +147,7 @@ class Puppet::Util::Metric end private - + # Convert a name into a label. def labelize(name) name.to_s.capitalize.gsub("_", " ") diff --git a/lib/puppet/util/package.rb b/lib/puppet/util/package.rb index 613aa6b1e..9beed3d00 100644 --- a/lib/puppet/util/package.rb +++ b/lib/puppet/util/package.rb @@ -11,10 +11,10 @@ module Puppet::Util::Package b = bx.shift if( a == b ) then next - elsif (a == '-' && b == '-') then next + elsif (a == '-' && b == '-') then next elsif (a == '-') then return -1 elsif (b == '-') then return 1 - elsif (a == '.' && b == '.') then next + elsif (a == '.' && b == '.') then next elsif (a == '.' ) then return -1 elsif (b == '.' ) then return 1 elsif (a =~ /^\d+$/ && b =~ /^\d+$/) then @@ -22,12 +22,12 @@ module Puppet::Util::Package return a.to_s.upcase <=> b.to_s.upcase end return a.to_i <=> b.to_i - else + else return a.upcase <=> b.upcase end end return version_a <=> version_b; end - + module_function :versioncmp end diff --git a/lib/puppet/util/posix.rb b/lib/puppet/util/posix.rb index 40a175eb3..837c37a07 100755 --- a/lib/puppet/util/posix.rb +++ b/lib/puppet/util/posix.rb @@ -28,7 +28,7 @@ module Puppet::Util::POSIX end # A degenerate method of retrieving name/id mappings. The job of this method is - # to retrieve all objects of a certain type, search for a specific entry + # to retrieve all objects of a certain type, search for a specific entry # and then return a given field from that entry. def search_posix_field(type, field, id) idmethod = idfield(type) @@ -57,7 +57,7 @@ module Puppet::Util::POSIX end return nil end - + # Determine what the field name is for users and groups. def idfield(space) case Puppet::Util.symbolize(space) @@ -67,7 +67,7 @@ module Puppet::Util::POSIX raise ArgumentError.new("Can only handle users and groups") end end - + # Determine what the method is to get users and groups by id def methodbyid(space) case Puppet::Util.symbolize(space) @@ -77,7 +77,7 @@ module Puppet::Util::POSIX raise ArgumentError.new("Can only handle users and groups") end end - + # Determine what the method is to get users and groups by name def methodbyname(space) case Puppet::Util.symbolize(space) @@ -87,7 +87,7 @@ module Puppet::Util::POSIX raise ArgumentError.new("Can only handle users and groups") end end - + # Get the GID of a given group, provided either a GID or a name def gid(group) begin diff --git a/lib/puppet/util/provider_features.rb b/lib/puppet/util/provider_features.rb index 5b0c99525..7986f6eae 100644 --- a/lib/puppet/util/provider_features.rb +++ b/lib/puppet/util/provider_features.rb @@ -14,7 +14,7 @@ module Puppet::Util::ProviderFeatures # Are all of the requirements met? def available?(obj) - if self.methods + if self.methods if methods_available?(obj) return true else @@ -126,8 +126,8 @@ module Puppet::Util::ProviderFeatures # Create a method that will list all functional features. @feature_module.send(:define_method, :features) do return false unless defined?(features) - features.keys.find_all { |n| feature?(n) }.sort { |a,b| - a.to_s <=> b.to_s + features.keys.find_all { |n| feature?(n) }.sort { |a,b| + a.to_s <=> b.to_s } end diff --git a/lib/puppet/util/queue.rb b/lib/puppet/util/queue.rb index ce462ac66..329b07b22 100644 --- a/lib/puppet/util/queue.rb +++ b/lib/puppet/util/queue.rb @@ -5,7 +5,7 @@ require 'puppet/util/instance_loader' # Implements a message queue client type plugin registry for use by the indirector facility. # Client modules for speaking a particular protocol (e.g. Stomp::Client for Stomp message # brokers, Memcached for Starling and Sparrow, etc.) register themselves with this module. -# +# # Client classes are expected to live under the Puppet::Util::Queue namespace and corresponding # directory; the attempted use of a client via its typename (see below) will cause Puppet::Util::Queue # to attempt to load the corresponding plugin if it is not yet loaded. The client class registers itself @@ -43,7 +43,7 @@ module Puppet::Util::Queue # # # register with default name +:you+ # register_queue_type(Foo::You) - # + # # # register with explicit queue type name +:myself+ # register_queue_type(Foo::Me, :myself) # diff --git a/lib/puppet/util/rdoc/code_objects.rb b/lib/puppet/util/rdoc/code_objects.rb index 52df2193e..312fe0c9b 100644 --- a/lib/puppet/util/rdoc/code_objects.rb +++ b/lib/puppet/util/rdoc/code_objects.rb @@ -4,7 +4,7 @@ module RDoc # This modules contains various class that are used to hold information # about the various Puppet language structures we found while parsing. - # + # # Those will be mapped to their html counterparts which are defined in # PuppetGenerator. diff --git a/lib/puppet/util/rdoc/generators/puppet_generator.rb b/lib/puppet/util/rdoc/generators/puppet_generator.rb index 22f001164..bf2609fd6 100644 --- a/lib/puppet/util/rdoc/generators/puppet_generator.rb +++ b/lib/puppet/util/rdoc/generators/puppet_generator.rb @@ -4,14 +4,14 @@ module Generators # This module holds all the classes needed to generate the HTML documentation # of a bunch of puppet manifests. - # - # It works by traversing all the code objects defined by the Puppet RDoc::Parser + # + # It works by traversing all the code objects defined by the Puppet RDoc::Parser # and produces HTML counterparts objects that in turns are used by RDoc template engine # to produce the final HTML. - # + # # It is also responsible of creating the whole directory hierarchy, and various index # files. - # + # # It is to be noted that the whole system is built on top of ruby RDoc. As such there # is an implicit mapping of puppet entities to ruby entitites: # @@ -20,7 +20,7 @@ module Generators # Module Module # Class Class # Definition Method - # Resource + # Resource # Node # Plugin # Fact diff --git a/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb b/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb index c71f81915..e12b6519c 100644 --- a/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +++ b/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb @@ -239,11 +239,11 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } ##################################################################### -### H E A D E R T E M P L A T E +### H E A D E R T E M P L A T E ##################################################################### XHTML_PREAMBLE = %{<?xml version="1.0" encoding="%charset%"?> -<!DOCTYPE html +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> } @@ -271,7 +271,7 @@ HEADER = XHTML_PREAMBLE + %{ return false; elemStyle = elem.style; - + if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else { @@ -280,10 +280,10 @@ HEADER = XHTML_PREAMBLE + %{ return true; } - + // Make codeblocks hidden by default document.writeln( "<style type=\\"text/css\\">div.method-source-code { display: none }</style>" ) - + // ]]> </script> @@ -516,7 +516,7 @@ IF:sectitle IF:seccomment <div class="section-comment"> %seccomment% - </div> + </div> ENDIF:seccomment ENDIF:sectitle END:sections @@ -608,7 +608,7 @@ IF:sectitle IF:seccomment <div class="section-comment"> %seccomment% - </div> + </div> ENDIF:seccomment ENDIF:sectitle @@ -720,7 +720,7 @@ END:attributes </div> </div> ENDIF:attributes - + <!-- if method_list --> @@ -755,7 +755,7 @@ IF:sourcecode </a> ENDIF:sourcecode </div> - + <div class="method-description"> IF:m_desc %m_desc% @@ -797,7 +797,7 @@ START:params END:params ENDIF:params </div> - + <div class="method-description"> IF:m_desc %m_desc% @@ -935,7 +935,7 @@ METHOD_INDEX = FILE_INDEX COMBO_INDEX = XHTML_PREAMBLE + %{ <!-- - %classes_title% & %defines_title% + %classes_title% & %defines_title% --> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> @@ -950,7 +950,7 @@ COMBO_INDEX = XHTML_PREAMBLE + %{ parent.docwin.location.href = url; } //--></SCRIPT> - + </head> <body> <div id="index"> @@ -1019,7 +1019,7 @@ ENDIF:plugins } INDEX = %{<?xml version="1.0" encoding="%charset%"?> -<!DOCTYPE html +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb index f13600680..7be119c6f 100644 --- a/lib/puppet/util/selinux.rb +++ b/lib/puppet/util/selinux.rb @@ -122,7 +122,7 @@ module Puppet::Util::SELinux else context = value end - + retval = Selinux.lsetfilecon(file, context) if retval == 0 return true @@ -179,12 +179,12 @@ module Puppet::Util::SELinux unless mnts = read_mounts() return nil end - + # For a given file: - # Check if the filename is in the data structure; + # Check if the filename is in the data structure; # return the fstype if it is. # Just in case: return something if you're down to "/" or "" - # Remove the last slash and everything after it, + # Remove the last slash and everything after it, # and repeat with that as the file for the next loop through. ary = file.split('/') while not ary.empty? do diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index 0871ee869..4fbf602f6 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -168,7 +168,7 @@ class Puppet::Util::Settings def initialize @config = {} @shortnames = {} - + @created = [] @searchpath = nil @@ -332,7 +332,7 @@ class Puppet::Util::Settings parse_file(file).each do |area, values| @values[area] = values end - + # Determine our environment, if we have one. if @config[:environment] env = self.value(:environment).to_sym @@ -616,7 +616,7 @@ Generated on #{Time.now}. if transaction.any_failed? report = transaction.report failures = report.logs.find_all { |log| log.level == :err } - raise "Got %s failure(s) while initializing: %s" % [failures.length, failures.collect { |l| l.to_s }.join("; ")] + raise "Got %s failure(s) while initializing: %s" % [failures.length, failures.collect { |l| l.to_s }.join("; ")] end end end @@ -663,7 +663,7 @@ Generated on #{Time.now}. end throw :foundval, nil end - + # If we didn't get a value, use the default val = @config[param].default if val.nil? @@ -759,7 +759,7 @@ Generated on #{Time.now}. return obj end - + # Create the transportable objects for users and groups. def add_user_resources(catalog, sections) return unless Puppet.features.root? diff --git a/lib/puppet/util/subclass_loader.rb b/lib/puppet/util/subclass_loader.rb index dd0d6dd03..8776e855c 100644 --- a/lib/puppet/util/subclass_loader.rb +++ b/lib/puppet/util/subclass_loader.rb @@ -31,7 +31,7 @@ module Puppet::Util::SubclassLoader # that we're defining a class method here, not an instance. meta_def(name) do |subname| subname = subname.to_s.downcase - + unless c = @subclasses.find { |c| c.name.to_s.downcase == subname } loader.load(subname) c = @subclasses.find { |c| c.name.to_s.downcase == subname } diff --git a/lib/puppet/util/suidmanager.rb b/lib/puppet/util/suidmanager.rb index b071dca6f..c5df0d198 100644 --- a/lib/puppet/util/suidmanager.rb +++ b/lib/puppet/util/suidmanager.rb @@ -29,14 +29,14 @@ module Puppet::Util::SUIDManager begin self.egid = convert_xid :gid, new_gid if new_gid self.euid = convert_xid :uid, new_uid if new_uid - + yield ensure self.euid, self.egid = old_euid, old_egid end end module_function :asuser - + # Make sure the passed argument is a number. def convert_xid(type, id) map = {:gid => :group, :uid => :user} diff --git a/lib/puppet/util/tagging.rb b/lib/puppet/util/tagging.rb index e06e13a2c..f421d18d8 100644 --- a/lib/puppet/util/tagging.rb +++ b/lib/puppet/util/tagging.rb @@ -16,7 +16,7 @@ module Puppet::Util::Tagging @tags << tag unless @tags.include?(tag) end - # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] + # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] qualified.collect { |name| x = name.split("::") }.flatten.each { |tag| @tags << tag unless @tags.include?(tag) } end |
