diff options
Diffstat (limited to 'lib/puppet/network/handler/fileserver.rb')
-rwxr-xr-x | lib/puppet/network/handler/fileserver.rb | 44 |
1 files changed, 11 insertions, 33 deletions
diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb index 756e74909..cb54ca4e4 100755 --- a/lib/puppet/network/handler/fileserver.rb +++ b/lib/puppet/network/handler/fileserver.rb @@ -98,22 +98,16 @@ class Puppet::Network::Handler @local = false end - if hash[:Config] == false - @noreadconfig = true - end + @noreadconfig = true if hash[:Config] == false @passed_configuration_path = hash[:Config] if hash.include?(:Mount) @passedconfig = true - unless hash[:Mount].is_a?(Hash) - raise Puppet::DevError, "Invalid mount hash #{hash[:Mount].inspect}" - end + raise Puppet::DevError, "Invalid mount hash #{hash[:Mount].inspect}" unless hash[:Mount].is_a?(Hash) hash[:Mount].each { |dir, name| - if FileTest.exists?(dir) - self.mount(dir, name) - end + self.mount(dir, name) if FileTest.exists?(dir) } self.mount(nil, MODULES) self.mount(nil, PLUGINS) @@ -179,9 +173,7 @@ class Puppet::Network::Handler mount, path = convert(url, client, clientip) - if client - mount.info "Sending #{url} to #{client}" - end + mount.info "Sending #{url} to #{client}" if client unless mount.path_exists?(path, client) mount.debug "#{mount} reported that #{path} does not exist" @@ -264,9 +256,7 @@ class Puppet::Network::Handler return unless configuration - if check and ! @configuration.changed? - return - end + return if check and ! @configuration.changed? newmounts = {} begin @@ -279,9 +269,7 @@ class Puppet::Network::Handler when /^\s*$/; next # skip blank lines when /\[([-\w]+)\]/ name = $1 - if newmounts.include?(name) - raise FileServerError, "#{newmounts[name]} is already mounted as #{name} in #{@configuration.file}" - end + raise FileServerError, "#{newmounts[name]} is already mounted as #{name} in #{@configuration.file}" if newmounts.include?(name) mount = Mount.new(name) newmounts[name] = mount when /^\s*(\w+)\s+(.+)$/ @@ -379,9 +367,7 @@ class Puppet::Network::Handler # We let the check raise an error, so that it can raise an error # pointing to the specific problem. newmounts.each { |name, mount| - unless mount.valid? - raise FileServerError, "Invalid mount #{name}" - end + raise FileServerError, "Invalid mount #{name}" unless mount.valid? } @mounts = newmounts end @@ -529,9 +515,7 @@ class Puppet::Network::Handler end # This, ah, might be completely redundant - unless obj[:links] == links - obj[:links] = links - end + obj[:links] = links unless obj[:links] == links return obj end @@ -572,15 +556,9 @@ class Puppet::Network::Handler # Mark that we're expandable. @expandable = true else - unless FileTest.exists?(path) - raise FileServerError, "#{path} does not exist" - end - unless FileTest.directory?(path) - raise FileServerError, "#{path} is not a directory" - end - unless FileTest.readable?(path) - raise FileServerError, "#{path} is not readable" - end + raise FileServerError, "#{path} does not exist" unless FileTest.exists?(path) + raise FileServerError, "#{path} is not a directory" unless FileTest.directory?(path) + raise FileServerError, "#{path} is not readable" unless FileTest.readable?(path) @expandable = false end @path = path |