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/network | |
| 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/network')
21 files changed, 71 insertions, 71 deletions
diff --git a/lib/puppet/network/authconfig.rb b/lib/puppet/network/authconfig.rb index 41f8f1c3e..0922393a2 100644 --- a/lib/puppet/network/authconfig.rb +++ b/lib/puppet/network/authconfig.rb @@ -16,7 +16,7 @@ module Puppet [:allow, :deny].each do |method| define_method(method) do |*args| @rights.send(method, *args) - end + end end # Here we add a little bit of semantics. They can set auth on a whole @@ -77,7 +77,7 @@ module Puppet else return end - else + else Puppet.notice "%s and %s" % [@configtimeout, @configstatted] end end diff --git a/lib/puppet/network/client/dipper.rb b/lib/puppet/network/client/dipper.rb index 0ec7087e5..8616d4f73 100644 --- a/lib/puppet/network/client/dipper.rb +++ b/lib/puppet/network/client/dipper.rb @@ -2,7 +2,7 @@ class Puppet::Network::Client::Dipper < Puppet::Network::Client @handler = Puppet::Network::Handler.handler(:filebucket) @drivername = :Bucket - + attr_accessor :name # Create our bucket client diff --git a/lib/puppet/network/format_handler.rb b/lib/puppet/network/format_handler.rb index e03432858..0a7e9dcad 100644 --- a/lib/puppet/network/format_handler.rb +++ b/lib/puppet/network/format_handler.rb @@ -96,7 +96,7 @@ module Puppet::Network::FormatHandler end def supported_formats - result = format_handler.formats.collect { |f| format_handler.format(f) }.find_all { |f| f.supported?(self) }.collect { |f| f.name }.sort do |a, b| + result = format_handler.formats.collect { |f| format_handler.format(f) }.find_all { |f| f.supported?(self) }.collect { |f| f.name }.sort do |a, b| # It's an inverse sort -- higher weight formats go first. format_handler.format(b).weight <=> format_handler.format(a).weight end diff --git a/lib/puppet/network/handler/filebucket.rb b/lib/puppet/network/handler/filebucket.rb index 38ef7f3f2..4973886f7 100755 --- a/lib/puppet/network/handler/filebucket.rb +++ b/lib/puppet/network/handler/filebucket.rb @@ -129,7 +129,7 @@ class Puppet::Network::Handler # :nodoc: File.open(bfile) { |of| contents = of.read } - + if client return Base64.encode64(contents) else diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb index 50e2614aa..6bc6d9d4a 100755 --- a/lib/puppet/network/handler/fileserver.rb +++ b/lib/puppet/network/handler/fileserver.rb @@ -53,7 +53,7 @@ class Puppet::Network::Handler mount = Mount.new(MODULES) mount.allow("*") @mounts[MODULES] = mount - + Puppet.debug "No file server configuration file; autocreating #{PLUGINS} mount with default permissions" mount = PluginMount.new(PLUGINS) mount.allow("*") @@ -145,7 +145,7 @@ class Puppet::Network::Handler desc.collect { |sub| sub.join("\t") }.join("\n") end - + def local? self.local end @@ -349,14 +349,14 @@ class Puppet::Network::Handler mount.allow("*") newmounts[MODULES] = mount end - + unless newmounts[PLUGINS] Puppet.debug "No #{PLUGINS} mount given; autocreating with default permissions" mount = PluginMount.new(PLUGINS) mount.allow("*") newmounts[PLUGINS] = mount end - + unless newmounts[PLUGINS].valid? Puppet.debug "No path given for #{PLUGINS} mount; creating a special PluginMount" # We end up here if the user has specified access rules for @@ -372,7 +372,7 @@ class Puppet::Network::Handler ) newmounts[PLUGINS] = mount end - + # Verify each of the mounts are valid. # We let the check raise an error, so that it can raise an error # pointing to the specific problem. @@ -433,7 +433,7 @@ class Puppet::Network::Handler # Create a map for a specific client. def clientmap(client) { - "h" => client.sub(/\..*$/, ""), + "h" => client.sub(/\..*$/, ""), "H" => client, "d" => client.sub(/[^.]+\./, "") # domain name } @@ -454,7 +454,7 @@ class Puppet::Network::Handler end path.gsub(/%(.)/) do |v| key = $1 - if key == "%" + if key == "%" "%" else map[key] || v @@ -698,7 +698,7 @@ class Puppet::Network::Handler # A special mount class specifically for the plugins mount -- just # has some magic to effectively do a union mount of the 'plugins' # directory of all modules. - # + # class PluginMount < Mount def path(client) '' @@ -719,7 +719,7 @@ class Puppet::Network::Handler def mod_file_path(mod, relpath, client = nil) File.join(mod, PLUGINS, relpath) end - + def file_path(relpath, client = nil) return nil unless mod = valid_modules(client).find { |m| m.plugin(relpath) } mod.plugin(relpath) @@ -746,7 +746,7 @@ class Puppet::Network::Handler def valid_modules(client) Puppet::Node::Environment.new.modules.find_all { |mod| mod.exist? } end - + def add_to_filetree(f, filetree) first, rest = f.split(File::SEPARATOR, 2) end diff --git a/lib/puppet/network/handler/master.rb b/lib/puppet/network/handler/master.rb index 0d36c1e88..e21e1e6e3 100644 --- a/lib/puppet/network/handler/master.rb +++ b/lib/puppet/network/handler/master.rb @@ -74,7 +74,7 @@ class Puppet::Network::Handler end end - # + # def decode_facts(facts) if @local # we don't need to do anything, since we should already diff --git a/lib/puppet/network/handler/report.rb b/lib/puppet/network/handler/report.rb index b92b77ea5..8cfd8d83d 100755 --- a/lib/puppet/network/handler/report.rb +++ b/lib/puppet/network/handler/report.rb @@ -79,7 +79,7 @@ class Puppet::Network::Handler # Handle the parsing of the reports attribute. def reports - # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] + # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] x = Puppet[:reports].gsub(/(^\s+)|(\s+$)/, '').split(/\s*,\s*/) end end diff --git a/lib/puppet/network/handler/resource.rb b/lib/puppet/network/handler/resource.rb index 54391c3de..6f8d3df0a 100755 --- a/lib/puppet/network/handler/resource.rb +++ b/lib/puppet/network/handler/resource.rb @@ -7,7 +7,7 @@ class Puppet::Network::Handler desc "An interface for interacting with client-based resources that can be used for querying or managing remote machines without using Puppet's central server tools. - + The ``describe`` and ``list`` methods return TransBuckets containing TransObject instances (``describe`` returns a single TransBucket), and the ``apply`` method accepts a TransBucket of TransObjects and @@ -44,7 +44,7 @@ class Puppet::Network::Handler # And then apply the catalog. This way we're reusing all # the code in there. It should probably just be separated out, though. transaction = catalog.apply - + # And then clean up catalog.clear(true) @@ -173,14 +173,14 @@ class Puppet::Network::Handler end # Deal with ignore parameters. - def handleignore(children, path, ignore) - ignore.each { |ignore| + def handleignore(children, path, ignore) + ignore.each { |ignore| Dir.glob(File.join(path,ignore), File::FNM_DOTMATCH) { |match| children.delete(File.basename(match)) - } + } } return children - end + end def to_s "resource" diff --git a/lib/puppet/network/http.rb b/lib/puppet/network/http.rb index 844af909f..ee6b70422 100644 --- a/lib/puppet/network/http.rb +++ b/lib/puppet/network/http.rb @@ -7,7 +7,7 @@ module Puppet::Network::HTTP when :mongrel raise ArgumentError, "Mongrel is not installed on this platform" unless Puppet.features.mongrel? require 'puppet/network/http/mongrel' - return Puppet::Network::HTTP::Mongrel + return Puppet::Network::HTTP::Mongrel else raise ArgumentError, "Unknown HTTP server name [#{kind}]" end diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb index 679bb8dcd..9528d39a6 100644 --- a/lib/puppet/network/http/handler.rb +++ b/lib/puppet/network/http/handler.rb @@ -165,7 +165,7 @@ module Puppet::Network::HTTP::Handler def path(request) raise NotImplementedError - end + end def request_key(request) raise NotImplementedError diff --git a/lib/puppet/network/http/mongrel.rb b/lib/puppet/network/http/mongrel.rb index 356402545..6c39bb37f 100644 --- a/lib/puppet/network/http/mongrel.rb +++ b/lib/puppet/network/http/mongrel.rb @@ -6,7 +6,7 @@ class Puppet::Network::HTTP::Mongrel def initialize(args = {}) @listening = false end - + def listen(args = {}) raise ArgumentError, ":protocols must be specified." if !args[:protocols] or args[:protocols].empty? raise ArgumentError, ":address must be specified." unless args[:address] @@ -15,26 +15,26 @@ class Puppet::Network::HTTP::Mongrel @protocols = args[:protocols] @xmlrpc_handlers = args[:xmlrpc_handlers] - @server = Mongrel::HttpServer.new(args[:address], args[:port]) + @server = Mongrel::HttpServer.new(args[:address], args[:port]) setup_handlers @listening = true @server.run end - + def unlisten raise "Mongrel server is not listening" unless listening? @server.stop @server = nil @listening = false end - + def listening? @listening end - + private - + def setup_handlers # Register our REST support at / klass = class_for_protocol(:rest) @@ -49,7 +49,7 @@ class Puppet::Network::HTTP::Mongrel def setup_xmlrpc_handlers @server.register('/RPC2', Puppet::Network::HTTPServer::Mongrel.new(@xmlrpc_handlers)) end - + def class_for_protocol(protocol) return Puppet::Network::HTTP::MongrelREST if protocol.to_sym == :rest raise ArgumentError, "Unknown protocol [#{protocol}]." diff --git a/lib/puppet/network/http/mongrel/rest.rb b/lib/puppet/network/http/mongrel/rest.rb index fe3f51d35..369d4c6c4 100644 --- a/lib/puppet/network/http/mongrel/rest.rb +++ b/lib/puppet/network/http/mongrel/rest.rb @@ -30,7 +30,7 @@ class Puppet::Network::HTTP::MongrelREST < Mongrel::HttpHandler # what path was requested? def path(request) - # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] + # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com] #x = '/' + request.params[Mongrel::Const::REQUEST_PATH] request.params[Mongrel::Const::REQUEST_PATH] end diff --git a/lib/puppet/network/http/webrick.rb b/lib/puppet/network/http/webrick.rb index 46735c0f5..a60a22ba1 100644 --- a/lib/puppet/network/http/webrick.rb +++ b/lib/puppet/network/http/webrick.rb @@ -12,19 +12,19 @@ class Puppet::Network::HTTP::WEBrick @listening = false @mutex = Mutex.new end - + def self.class_for_protocol(protocol) return Puppet::Network::HTTP::WEBrickREST if protocol.to_sym == :rest raise "Unknown protocol [#{protocol}]." end - + def listen(args = {}) raise ArgumentError, ":protocols must be specified." if !args[:protocols] or args[:protocols].empty? raise ArgumentError, ":address must be specified." unless args[:address] raise ArgumentError, ":port must be specified." unless args[:port] - + @protocols = args[:protocols] - @xmlrpc_handlers = args[:xmlrpc_handlers] + @xmlrpc_handlers = args[:xmlrpc_handlers] arguments = {:BindAddress => args[:address], :Port => args[:port]} arguments.merge!(setup_logger) @@ -35,12 +35,12 @@ class Puppet::Network::HTTP::WEBrick setup_handlers @mutex.synchronize do - raise "WEBrick server is already listening" if @listening + raise "WEBrick server is already listening" if @listening @listening = true @thread = Thread.new { @server.start } end end - + def unlisten @mutex.synchronize do raise "WEBrick server is not listening" unless @listening @@ -50,7 +50,7 @@ class Puppet::Network::HTTP::WEBrick @listening = false end end - + def listening? @mutex.synchronize do @listening @@ -110,7 +110,7 @@ class Puppet::Network::HTTP::WEBrick end private - + def setup_handlers # Set up the new-style protocols. klass = self.class.class_for_protocol(:rest) diff --git a/lib/puppet/network/http_pool.rb b/lib/puppet/network/http_pool.rb index 9430457bb..b1206f7f9 100644 --- a/lib/puppet/network/http_pool.rb +++ b/lib/puppet/network/http_pool.rb @@ -10,7 +10,7 @@ module Puppet::Network::HttpPool include Puppet::Util::Cacher private - + cached_attr(:http_cache) { Hash.new } end diff --git a/lib/puppet/network/http_server/mongrel.rb b/lib/puppet/network/http_server/mongrel.rb index 382b4dc58..a10a42928 100644 --- a/lib/puppet/network/http_server/mongrel.rb +++ b/lib/puppet/network/http_server/mongrel.rb @@ -3,7 +3,7 @@ # Author: Manuel Holtgrewe <purestorm at ggnore.net> # # Copyright (c) 2006 Manuel Holtgrewe, 2007 Luke Kanies -# +# # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including @@ -11,10 +11,10 @@ # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: -# +# # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -113,7 +113,7 @@ module Puppet::Network end end end - + private def client_info(request) @@ -144,7 +144,7 @@ module Puppet::Network def parse_content_type(str) a, *b = str.split(";") return a.strip, *b - end + end end end diff --git a/lib/puppet/network/http_server/webrick.rb b/lib/puppet/network/http_server/webrick.rb index 0e835d057..a863d3a20 100644 --- a/lib/puppet/network/http_server/webrick.rb +++ b/lib/puppet/network/http_server/webrick.rb @@ -18,7 +18,7 @@ module Puppet include Puppet::SSLCertificates::Support # Read the CA cert and CRL and populate an OpenSSL::X509::Store - # with them, with flags appropriate for checking client + # with them, with flags appropriate for checking client # certificates for revocation def x509store if Puppet[:cacrl] == 'false' diff --git a/lib/puppet/network/rest_authorization.rb b/lib/puppet/network/rest_authorization.rb index 1294a3dd1..5dd4fb5e6 100644 --- a/lib/puppet/network/rest_authorization.rb +++ b/lib/puppet/network/rest_authorization.rb @@ -16,7 +16,7 @@ module Puppet::Network @authconfig end - # Verify that our client has access. + # Verify that our client has access. def check_authorization(request) authconfig.allowed?(request) end diff --git a/lib/puppet/network/rights.rb b/lib/puppet/network/rights.rb index 14b171081..e8267c927 100755 --- a/lib/puppet/network/rights.rb +++ b/lib/puppet/network/rights.rb @@ -42,7 +42,7 @@ class Rights res = :nomatch right = @rights.find do |acl| found = false - # an acl can return :dunno, which means "I'm not qualified to answer your question, + # an acl can return :dunno, which means "I'm not qualified to answer your question, # please ask someone else". This is used when for instance an acl matches, but not for the # current rest method, where we might think some other acl might be more specific. if match = acl.match?(name) diff --git a/lib/puppet/network/server.rb b/lib/puppet/network/server.rb index 701be54ca..f21254be9 100644 --- a/lib/puppet/network/server.rb +++ b/lib/puppet/network/server.rb @@ -83,7 +83,7 @@ class Puppet::Network::Server @routes[name.to_sym] = true end end - + # Unregister Indirector handlers. def unregister(*indirections) raise "Cannot unregister indirections while server is listening." if listening? @@ -92,7 +92,7 @@ class Puppet::Network::Server indirections.flatten.each do |i| raise(ArgumentError, "Indirection [%s] is unknown." % i) unless @routes[i.to_sym] end - + indirections.flatten.each do |i| @routes.delete(i.to_sym) end @@ -106,7 +106,7 @@ class Puppet::Network::Server @xmlrpc_routes[name.to_sym] = true end end - + # Unregister xmlrpc handlers. def unregister_xmlrpc(*namespaces) raise "Cannot unregister xmlrpc handlers while server is listening." if listening? @@ -115,7 +115,7 @@ class Puppet::Network::Server namespaces.flatten.each do |i| raise(ArgumentError, "XMLRPC handler '%s' is unknown." % i) unless @xmlrpc_routes[i.to_sym] end - + namespaces.flatten.each do |i| @xmlrpc_routes.delete(i.to_sym) end @@ -124,19 +124,19 @@ class Puppet::Network::Server def listening? @listening end - + def listen raise "Cannot listen -- already listening." if listening? @listening = true http_server.listen(:address => address, :port => port, :handlers => @routes.keys, :xmlrpc_handlers => @xmlrpc_routes.keys, :protocols => protocols) end - + def unlisten raise "Cannot unlisten -- not currently listening." unless listening? - http_server.unlisten + http_server.unlisten @listening = false end - + def http_server_class http_server_class_by_type(@server_type) end @@ -152,11 +152,11 @@ class Puppet::Network::Server end private - + def http_server @http_server ||= http_server_class.new end - + def http_server_class_by_type(kind) Puppet::Network::HTTP.server_class_by_type(kind) end diff --git a/lib/puppet/network/xmlrpc/client.rb b/lib/puppet/network/xmlrpc/client.rb index 678ab6c00..ee2c008eb 100644 --- a/lib/puppet/network/xmlrpc/client.rb +++ b/lib/puppet/network/xmlrpc/client.rb @@ -82,7 +82,7 @@ module Puppet::Network if detail.message.include?(str) Puppet.warning "Certificate validation failed; consider using the certname configuration option" end - end + end raise XMLRPCClientError, "Certificates were not trusted: %s" % detail end @@ -90,7 +90,7 @@ module Puppet::Network if detail.message.to_s =~ /^Wrong size\. Was \d+, should be \d+$/ Puppet.warning "XMLRPC returned wrong size. Retrying." return :retry - end + end Puppet.err "Could not call %s.%s: %s" % [namespace, method, detail.inspect] error = XMLRPCClientError.new(detail.to_s) error.set_backtrace detail.backtrace @@ -107,7 +107,7 @@ module Puppet::Network if detail.message.include?(str) Puppet.warning "Certificate validation failed; consider using the certname configuration option" end - end + end raise XMLRPCClientError, "Certificates were not trusted: %s" % detail end @@ -185,7 +185,7 @@ module Puppet::Network ) @http = Puppet::Network::HttpPool.http_instance(@host, @port) end - + # Get rid of our existing connection, replacing it with a new one. # This should only happen if we lose our connection somehow (e.g., an EPIPE) # or we've just downloaded certs and we need to create new http instances @@ -197,7 +197,7 @@ module Puppet::Network @http = nil self.http # force a new one end - + def start begin @http.start unless @http.started? diff --git a/lib/puppet/network/xmlrpc/webrick_servlet.rb b/lib/puppet/network/xmlrpc/webrick_servlet.rb index 9a46ffb7c..ec64c1c60 100644 --- a/lib/puppet/network/xmlrpc/webrick_servlet.rb +++ b/lib/puppet/network/xmlrpc/webrick_servlet.rb @@ -42,7 +42,7 @@ module Puppet::Network::XMLRPC # we need to pass a ClientRequest object to process() so we can do # authorization. It's the only way to stay thread-safe. def service(request, response) - if @valid_ip + if @valid_ip raise WEBrick::HTTPStatus::Forbidden unless @valid_ip.any? { |ip| request.peeraddr[3] =~ ip } end @@ -51,9 +51,9 @@ module Puppet::Network::XMLRPC "unsupported method `#{request.request_method}'." end - if parse_content_type(request['Content-type']).first != "text/xml" + if parse_content_type(request['Content-type']).first != "text/xml" raise WEBrick::HTTPStatus::BadRequest - end + end length = (request['Content-length'] || 0).to_i @@ -66,14 +66,14 @@ module Puppet::Network::XMLRPC end resp = process(data, client_request(request)) - if resp.nil? or resp.size <= 0 + if resp.nil? or resp.size <= 0 raise WEBrick::HTTPStatus::InternalServerError end response.status = 200 response['Content-Length'] = resp.size response['Content-Type'] = "text/xml; charset=utf-8" - response.body = resp + response.body = resp end private @@ -97,7 +97,7 @@ module Puppet::Network::XMLRPC if cert = request.client_cert nameary = cert.subject.to_a.find { |ary| ary[0] == "CN" - } + } if nameary.nil? Puppet.warning "Could not retrieve server name from cert" |
