From 543225970225de5697734bfaf0a6eee996802c04 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Fri, 9 Jul 2010 18:07:15 -0700 Subject: Code smell: Avoid needless decorations * Replaced 704 occurances of (.*)\b([a-z_]+)\(\) with \1\2 3 Examples: The code: ctx = OpenSSL::SSL::SSLContext.new() becomes: ctx = OpenSSL::SSL::SSLContext.new The code: skip() becomes: skip The code: path = tempfile() becomes: path = tempfile * Replaced 31 occurances of ^( *)end *#.* with \1end 3 Examples: The code: becomes: The code: end # Dir.foreach becomes: end The code: end # def becomes: end --- ext/puppetlisten/puppetlisten.rb | 2 +- ext/puppetlisten/puppetrun.rb | 2 +- ext/regexp_nodes/regexp_nodes.rb | 32 +++---- install.rb | 2 +- lib/puppet/agent.rb | 2 +- lib/puppet/application/queue.rb | 2 +- lib/puppet/configurer.rb | 14 ++-- lib/puppet/configurer/fact_handler.rb | 4 +- lib/puppet/daemon.rb | 6 +- lib/puppet/external/dot.rb | 12 +-- lib/puppet/external/nagios/parser.rb | 10 +-- lib/puppet/feature/rack.rb | 2 +- lib/puppet/file_serving/base.rb | 2 +- lib/puppet/file_serving/configuration.rb | 2 +- lib/puppet/file_serving/configuration/parser.rb | 2 +- lib/puppet/file_serving/content.rb | 6 +- lib/puppet/file_serving/metadata.rb | 2 +- lib/puppet/file_serving/mount/file.rb | 2 +- lib/puppet/indirector/indirection.rb | 2 +- lib/puppet/indirector/node/ldap.rb | 2 +- lib/puppet/indirector/report/processor.rb | 2 +- lib/puppet/indirector/request.rb | 2 +- lib/puppet/metatype/manager.rb | 4 +- lib/puppet/module.rb | 2 +- lib/puppet/network/authconfig.rb | 8 +- lib/puppet/network/authorization.rb | 2 +- lib/puppet/network/client.rb | 2 +- lib/puppet/network/client/runner.rb | 2 +- lib/puppet/network/format.rb | 2 +- lib/puppet/network/handler/fileserver.rb | 4 +- lib/puppet/network/handler/master.rb | 2 +- lib/puppet/network/handler/report.rb | 2 +- lib/puppet/network/http/compression.rb | 2 +- lib/puppet/network/http/rack.rb | 6 +- lib/puppet/network/http/rack/httphandler.rb | 2 +- lib/puppet/network/http/rack/xmlrpc.rb | 4 +- lib/puppet/network/http/webrick/rest.rb | 2 +- lib/puppet/network/rest_authconfig.rb | 4 +- lib/puppet/network/rights.rb | 2 +- lib/puppet/network/server.rb | 4 +- lib/puppet/network/xmlrpc/processor.rb | 2 +- lib/puppet/network/xmlrpc/server.rb | 2 +- lib/puppet/network/xmlrpc/webrick_servlet.rb | 4 +- lib/puppet/parameter.rb | 2 +- lib/puppet/parser/compiler.rb | 18 ++-- lib/puppet/parser/functions/shellquote.rb | 6 +- lib/puppet/parser/functions/sprintf.rb | 4 +- lib/puppet/parser/lexer.rb | 10 +-- lib/puppet/parser/parser_support.rb | 4 +- lib/puppet/parser/resource.rb | 8 +- lib/puppet/parser/scope.rb | 2 +- lib/puppet/parser/yaml_trimmer.rb | 2 +- lib/puppet/property.rb | 2 +- lib/puppet/provider.rb | 4 +- lib/puppet/provider/cron/crontab.rb | 2 +- lib/puppet/provider/mailalias/aliases.rb | 4 +- lib/puppet/provider/mount.rb | 4 +- lib/puppet/provider/nameservice.rb | 2 +- .../provider/nameservice/directoryservice.rb | 6 +- lib/puppet/provider/package/appdmg.rb | 10 +-- lib/puppet/provider/package/apt.rb | 2 +- lib/puppet/provider/package/darwinport.rb | 2 +- lib/puppet/provider/package/openbsd.rb | 6 +- lib/puppet/provider/package/ports.rb | 2 +- lib/puppet/provider/package/portupgrade.rb | 2 +- lib/puppet/provider/parsedfile.rb | 6 +- lib/puppet/provider/service/debian.rb | 2 +- lib/puppet/provider/user/ldap.rb | 4 +- lib/puppet/provider/zone/solaris.rb | 4 +- lib/puppet/rails.rb | 6 +- lib/puppet/rails/host.rb | 2 +- lib/puppet/rails/resource.rb | 4 +- lib/puppet/reports/rrdgraph.rb | 2 +- lib/puppet/resource.rb | 4 +- lib/puppet/resource/catalog.rb | 8 +- lib/puppet/run.rb | 2 +- lib/puppet/simple_graph.rb | 2 +- lib/puppet/ssl/certificate_authority.rb | 4 +- lib/puppet/ssl/certificate_factory.rb | 2 +- lib/puppet/ssl/host.rb | 4 +- lib/puppet/sslcertificates/certificate.rb | 2 +- lib/puppet/transaction.rb | 10 +-- lib/puppet/transaction/change.rb | 4 +- lib/puppet/type.rb | 18 ++-- lib/puppet/type/augeas.rb | 2 +- lib/puppet/type/cron.rb | 4 +- lib/puppet/type/exec.rb | 2 +- lib/puppet/type/file.rb | 2 +- lib/puppet/type/file/target.rb | 6 +- lib/puppet/type/filebucket.rb | 2 +- lib/puppet/type/mount.rb | 6 +- lib/puppet/type/package.rb | 2 +- lib/puppet/type/resources.rb | 2 +- lib/puppet/type/user.rb | 2 +- lib/puppet/type/yumrepo.rb | 4 +- lib/puppet/type/zone.rb | 4 +- lib/puppet/util.rb | 6 +- lib/puppet/util/checksums.rb | 8 +- lib/puppet/util/docs.rb | 4 +- lib/puppet/util/filetype.rb | 8 +- lib/puppet/util/ldap/manager.rb | 2 +- lib/puppet/util/loadedfile.rb | 6 +- lib/puppet/util/log.rb | 2 +- lib/puppet/util/logging.rb | 2 +- lib/puppet/util/queue.rb | 2 +- lib/puppet/util/rdoc/parser.rb | 4 +- lib/puppet/util/reference.rb | 2 +- lib/puppet/util/resource_template.rb | 2 +- lib/puppet/util/selinux.rb | 4 +- lib/puppet/util/settings.rb | 10 +-- lib/puppet/util/warnings.rb | 2 +- lib/puppet/util/zaml.rb | 2 +- .../indirector/bucket_file/rest_spec.rb | 2 +- spec/integration/transaction_spec.rb | 2 +- spec/spec_helper.rb | 2 +- spec/unit/agent_spec.rb | 2 +- spec/unit/file_serving/content_spec.rb | 4 +- spec/unit/file_serving/metadata_spec.rb | 4 +- spec/unit/file_serving/mount/file_spec.rb | 2 +- spec/unit/indirector/indirection_spec.rb | 4 +- spec/unit/indirector/node/exec_spec.rb | 2 +- spec/unit/network/handler/fileserver_spec.rb | 20 ++--- spec/unit/network/http/compression_spec.rb | 4 +- spec/unit/network/http/rack/rest_spec.rb | 2 +- spec/unit/network/http/rack/xmlrpc_spec.rb | 16 ++-- spec/unit/network/http_pool_spec.rb | 2 +- spec/unit/network/rest_authconfig_spec.rb | 2 +- spec/unit/network/server_spec.rb | 2 +- spec/unit/node/environment_spec.rb | 2 +- spec/unit/other/transbucket_spec.rb | 2 +- spec/unit/parser/ast/arithmetic_operator_spec.rb | 2 +- spec/unit/parser/ast/astarray_spec.rb | 2 +- spec/unit/parser/ast/asthash_spec.rb | 2 +- spec/unit/parser/ast/boolean_operator_spec.rb | 2 +- spec/unit/parser/ast/casestatement_spec.rb | 4 +- spec/unit/parser/ast/collexpr_spec.rb | 2 +- spec/unit/parser/ast/comparison_operator_spec.rb | 2 +- spec/unit/parser/ast/ifstatement_spec.rb | 2 +- spec/unit/parser/ast/in_operator_spec.rb | 2 +- spec/unit/parser/ast/match_operator_spec.rb | 2 +- spec/unit/parser/ast/minus_spec.rb | 2 +- spec/unit/parser/ast/not_spec.rb | 2 +- spec/unit/parser/ast/resource_reference_spec.rb | 2 +- spec/unit/parser/ast/selector_spec.rb | 2 +- spec/unit/parser/ast/vardef_spec.rb | 2 +- spec/unit/parser/collector_spec.rb | 12 +-- spec/unit/parser/functions/fqdn_rand_spec.rb | 2 +- spec/unit/parser/functions/generate_spec.rb | 2 +- spec/unit/parser/functions/inline_template_spec.rb | 2 +- spec/unit/parser/functions/realize_spec.rb | 2 +- spec/unit/parser/functions/regsubst_spec.rb | 2 +- spec/unit/parser/functions/require_spec.rb | 2 +- spec/unit/parser/functions/shellquote_spec.rb | 2 +- spec/unit/parser/functions/split_spec.rb | 2 +- spec/unit/parser/functions/sprintf_spec.rb | 2 +- spec/unit/parser/functions/tag_spec.rb | 2 +- spec/unit/parser/functions/template_spec.rb | 2 +- spec/unit/parser/functions/versioncmp_spec.rb | 2 +- spec/unit/parser/functions_spec.rb | 2 +- spec/unit/parser/lexer_spec.rb | 10 +-- spec/unit/parser/parser_spec.rb | 2 +- spec/unit/parser/scope_spec.rb | 6 +- spec/unit/parser/templatewrapper_spec.rb | 6 +- spec/unit/provider/augeas/augeas_spec.rb | 4 +- spec/unit/provider/confine/false_spec.rb | 2 +- spec/unit/provider/confine/feature_spec.rb | 2 +- spec/unit/provider/confine/true_spec.rb | 2 +- spec/unit/provider/confine/variable_spec.rb | 2 +- spec/unit/provider/confine_spec.rb | 2 +- spec/unit/provider/macauthorization_spec.rb | 4 +- spec/unit/provider/mount/parsed_spec.rb | 2 +- spec/unit/ssl/host_spec.rb | 2 +- spec/unit/transaction/change_spec.rb | 2 +- spec/unit/util/ldap/generator_spec.rb | 2 +- spec/unit/util/ldap/manager_spec.rb | 2 +- spec/unit/util/rdoc/parser_spec.rb | 4 +- spec/unit/util/selinux_spec.rb | 2 +- spec/unit/util/storage_spec.rb | 90 ++++++++++---------- spec/unit/util/warnings_spec.rb | 2 +- test/certmgr/certmgr.rb | 8 +- test/certmgr/inventory.rb | 2 +- test/language/functions.rb | 16 ++-- test/language/parser.rb | 42 +++++----- test/language/scope.rb | 2 +- test/language/snippets.rb | 6 +- test/lib/puppettest.rb | 14 ++-- test/lib/puppettest/certificates.rb | 2 +- test/lib/puppettest/exetest.rb | 4 +- test/lib/puppettest/parsertesting.rb | 22 ++--- test/lib/puppettest/servertest.rb | 6 +- test/network/authconfig.rb | 2 +- test/network/handler/ca.rb | 8 +- test/network/handler/fileserver.rb | 46 +++++----- test/network/handler/report.rb | 4 +- test/network/server/webrick.rb | 6 +- test/network/xmlrpc/processor.rb | 4 +- test/other/puppet.rb | 4 +- test/other/relationships.rb | 4 +- test/other/report.rb | 4 +- test/other/transactions.rb | 20 ++--- test/ral/manager/type.rb | 10 +-- test/ral/providers/cron/crontab.rb | 4 +- test/ral/providers/group.rb | 2 +- test/ral/providers/host/parsed.rb | 12 +-- test/ral/providers/package.rb | 2 +- test/ral/providers/parsedfile.rb | 12 +-- test/ral/providers/provider.rb | 4 +- test/ral/providers/service/base.rb | 2 +- test/ral/providers/user.rb | 4 +- test/ral/type/cron.rb | 2 +- test/ral/type/exec.rb | 52 ++++++------ test/ral/type/file.rb | 98 +++++++++++----------- test/ral/type/file/target.rb | 36 ++++---- test/ral/type/fileignoresource.rb | 6 +- test/ral/type/filesources.rb | 44 +++++----- test/ral/type/host.rb | 10 +-- test/ral/type/mailalias.rb | 2 +- test/ral/type/port.rb | 6 +- test/ral/type/resources.rb | 2 +- test/ral/type/sshkey.rb | 10 +-- test/ral/type/user.rb | 8 +- test/ral/type/yumrepo.rb | 8 +- test/ral/type/zone.rb | 6 +- test/util/inifile.rb | 2 +- test/util/log.rb | 22 ++--- test/util/settings.rb | 38 ++++----- test/util/storage.rb | 8 +- test/util/subclass_loader.rb | 2 +- test/util/utiltest.rb | 14 ++-- 229 files changed, 713 insertions(+), 713 deletions(-) diff --git a/ext/puppetlisten/puppetlisten.rb b/ext/puppetlisten/puppetlisten.rb index d1d6e8e44..fd187c81b 100755 --- a/ext/puppetlisten/puppetlisten.rb +++ b/ext/puppetlisten/puppetlisten.rb @@ -15,7 +15,7 @@ Puppet[:config] = "/etc/puppet/puppet.conf" Puppet.parse_config # set the SSL environment -ctx = OpenSSL::SSL::SSLContext.new() +ctx = OpenSSL::SSL::SSLContext.new ctx.key = OpenSSL::PKey::RSA.new(File::read(Puppet[:hostprivkey])) ctx.cert = OpenSSL::X509::Certificate.new(File::read(Puppet[:hostcert])) ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT diff --git a/ext/puppetlisten/puppetrun.rb b/ext/puppetlisten/puppetrun.rb index 192016c8d..7aa0919cb 100755 --- a/ext/puppetlisten/puppetrun.rb +++ b/ext/puppetlisten/puppetrun.rb @@ -20,7 +20,7 @@ Puppet[:config] = "/etc/puppet/puppet.conf" Puppet.parse_config # establish the certificate -ctx = OpenSSL::SSL::SSLContext.new() +ctx = OpenSSL::SSL::SSLContext.new ctx.key = OpenSSL::PKey::RSA.new(File::read(Puppet[:hostprivkey])) ctx.cert = OpenSSL::X509::Certificate.new(File::read(Puppet[:hostcert])) ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER diff --git a/ext/regexp_nodes/regexp_nodes.rb b/ext/regexp_nodes/regexp_nodes.rb index ff851bc4a..7633e5cea 100644 --- a/ext/regexp_nodes/regexp_nodes.rb +++ b/ext/regexp_nodes/regexp_nodes.rb @@ -54,14 +54,14 @@ $LOG.level = Logger::DEBUG WORKINGDIR = Dir.pwd # This class holds all the methods for creating and accessing the properties -# of an external node. There are really only two public methods: initialize() -# and a special version of to_yaml() +# of an external node. There are really only two public methods: initialize +# and a special version of to_yaml class ExternalNode # Make these instance variables get/set-able with eponymous methods attr_accessor :classes, :parameters, :hostname - # initialize() takes three arguments: + # initialize takes three arguments: # hostname:: usually passed in via ARGV[0] but it could be anything # classdir:: directory under WORKINGDIR to look for files named after # classes @@ -78,7 +78,7 @@ class ExternalNode self.match_parameters(WORKINGDIR + "/#{parameterdir}") end - # private method called by initialize() which sanity-checks our hostname. + # private method called by initialize which sanity-checks our hostname. # good candidate for overriding in a subclass if you need different checks def parse_argv(hostname) if hostname =~ /^([-\w]+?)\.([-\w\.]+)/ # non-greedy up to the first . is hostname @@ -132,7 +132,7 @@ class ExternalNode return nil end - end # def + end # private method - takes a path to look for files, iterates through all # readable, regular files it finds, and matches this instance's @hostname @@ -146,9 +146,9 @@ class ExternalNode if matched_in_patternfile?(filepath,@hostname) @classes << patternfile.to_s $LOG.debug("Appended #{patternfile.to_s} to classes instance variable") - end # if - end # Dir.foreach - end # def + end + end + end # Parameters are handled slightly differently; we make another level of # directories to get the parameter name, then use the names of the files @@ -177,12 +177,12 @@ class ExternalNode if matched_in_patternfile?(secondlevel, @hostname) @parameters[ parametername.to_s ] = patternfile.to_s $LOG.debug("Set @parameters[#{parametername.to_s}] = #{patternfile.to_s}") - end # if - end # Dir.foreach #{filepath} - end # Dir.foreach #{fullpath} - end # def + end + end + end + end -end # Class +end # Logic for local hacks that don't fit neatly into the autoloading model can # happen as we initialize a subclass @@ -202,10 +202,10 @@ class MyExternalNode < ExternalNode @parameters[ "hostclass" ] = hostclass else $LOG.debug("hostclass couldn't figure out class from #{@hostname}") - end # if - end # def + end + end -end # Class +end # Here we begin actual execution by calling methods defined above diff --git a/install.rb b/install.rb index 293a4c4b4..42c62f1b7 100755 --- a/install.rb +++ b/install.rb @@ -413,7 +413,7 @@ def install_binfile(from, op_file, target) op.puts "#!#{ruby}" contents = ip.readlines contents.shift if contents[0] =~ /^#!/ - op.write contents.join() + op.write contents.join end end diff --git a/lib/puppet/agent.rb b/lib/puppet/agent.rb index 8d131fbc8..a01da483b 100644 --- a/lib/puppet/agent.rb +++ b/lib/puppet/agent.rb @@ -73,7 +73,7 @@ class Puppet::Agent def start # Create our timer. Puppet will handle observing it and such. timer = EventLoop::Timer.new(:interval => Puppet[:runinterval], :tolerance => 1, :start? => true) do - run() + run end # Run once before we start following the timer diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb index 6bbff75f9..6531f6f92 100644 --- a/lib/puppet/application/queue.rb +++ b/lib/puppet/application/queue.rb @@ -40,7 +40,7 @@ class Puppet::Application::Queue < Puppet::Application def main Puppet.notice "Starting puppetqd #{Puppet.version}" Puppet::Resource::Catalog::Queue.subscribe do |catalog| - # Once you have a Puppet::Resource::Catalog instance, calling save() on it should suffice + # Once you have a Puppet::Resource::Catalog instance, calling save on it should suffice # to put it through to the database via its active_record indirector (which is determined # by the terminus_class = :active_record setting above) Puppet::Util.benchmark(:notice, "Processing queued catalog for #{catalog.name}") do diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index 82158e0fd..5b8174588 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -78,11 +78,11 @@ class Puppet::Configurer # Prepare for catalog retrieval. Downloads everything necessary, etc. def prepare - dostorage() + dostorage - download_plugins() + download_plugins - download_fact_plugins() + download_fact_plugins execute_prerun_command end @@ -93,7 +93,7 @@ class Puppet::Configurer # This is a bit complicated. We need the serialized and escaped facts, # and we need to know which format they're encoded in. Thus, we # get a hash with both of these pieces of information. - fact_options = facts_for_uploading() + fact_options = facts_for_uploading else fact_options = {} end @@ -126,7 +126,7 @@ class Puppet::Configurer # which accepts :tags and :ignoreschedules. def run(options = {}) begin - prepare() + prepare rescue SystemExit,NoMemoryError raise rescue Exception => detail @@ -134,7 +134,7 @@ class Puppet::Configurer Puppet.err "Failed to prepare catalog: #{detail}" end - options[:report] ||= initialize_report() + options[:report] ||= initialize_report report = options[:report] Puppet::Util::Log.newdestination(report) @@ -171,7 +171,7 @@ class Puppet::Configurer def send_report(report, trans = nil) trans.generate_report if trans puts report.summary if Puppet[:summarize] - report.save() if Puppet[:report] + report.save if Puppet[:report] rescue => detail puts detail.backtrace if Puppet[:trace] Puppet.err "Could not send report: #{detail}" diff --git a/lib/puppet/configurer/fact_handler.rb b/lib/puppet/configurer/fact_handler.rb index 74bea1998..2d1565ae7 100644 --- a/lib/puppet/configurer/fact_handler.rb +++ b/lib/puppet/configurer/fact_handler.rb @@ -15,7 +15,7 @@ module Puppet::Configurer::FactHandler # finding facts and the 'rest' terminus for caching them. Thus, we'll # compile them and then "cache" them on the server. begin - reload_facter() + reload_facter Puppet::Node::Facts.find(Puppet[:certname]) rescue SystemExit,NoMemoryError raise @@ -67,6 +67,6 @@ module Puppet::Configurer::FactHandler # This loads all existing facts and any new ones. We have to remove and # reload because there's no way to unload specific facts. - Puppet::Node::Facts::Facter.load_fact_plugins() + Puppet::Node::Facts::Facter.load_fact_plugins end end diff --git a/lib/puppet/daemon.rb b/lib/puppet/daemon.rb index 7e2fc7555..b0c2b56ea 100755 --- a/lib/puppet/daemon.rb +++ b/lib/puppet/daemon.rb @@ -14,12 +14,12 @@ class Puppet::Daemon # Put the daemon into the background. def daemonize - if pid = fork() + if pid = fork Process.detach(pid) exit(0) end - create_pidfile() + create_pidfile # Get rid of console logging Puppet::Util::Log.close(:console) @@ -108,7 +108,7 @@ class Puppet::Daemon server.stop if server - remove_pidfile() + remove_pidfile Puppet::Util::Log.close_all diff --git a/lib/puppet/external/dot.rb b/lib/puppet/external/dot.rb index 77d66e92e..5d89ddbc9 100644 --- a/lib/puppet/external/dot.rb +++ b/lib/puppet/external/dot.rb @@ -229,7 +229,7 @@ module DOT t + "]\n" end - end # class DOTNode + end # A subgraph element is the same to graph, but has another header in dot # notation. @@ -276,7 +276,7 @@ module DOT hdr + options + nodes + t + "}\n" end - end # class DOTSubgraph + end # This is a graph. @@ -287,7 +287,7 @@ module DOT @dot_string = 'digraph' end - end # class DOTDigraph + end # This is an edge. @@ -314,7 +314,7 @@ module DOT }.compact.join( "\n" ) + "\n#{t}]\n" end - end # class DOTEdge + end class DOTDirectedEdge < DOTEdge @@ -322,5 +322,5 @@ module DOT '->' end - end # class DOTDirectedEdge -end # module DOT + end +end diff --git a/lib/puppet/external/nagios/parser.rb b/lib/puppet/external/nagios/parser.rb index 934af146e..43444cccb 100644 --- a/lib/puppet/external/nagios/parser.rb +++ b/lib/puppet/external/nagios/parser.rb @@ -99,7 +99,7 @@ module Racc ### def do_parse - __send__(Racc_Main_Parsing_Routine, _racc_setup(), false) + __send__(Racc_Main_Parsing_Routine, _racc_setup, false) end def next_token @@ -121,7 +121,7 @@ module Racc if i = action_pointer[@racc_state[-1]] if @racc_read_next if @racc_t != 0 # not EOF - tok, @racc_val = next_token() + tok, @racc_val = next_token unless tok # EOF @racc_t = 0 else @@ -152,7 +152,7 @@ module Racc ### def yyparse(recv, mid) - __send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), true) + __send__(Racc_YY_Parse_Method, recv, mid, _racc_setup, true) end def _racc_yyparse_rb(recv, mid, arg, c_debug) @@ -770,6 +770,6 @@ def _reduce_none( val, _values, result ) result end - end # class Parser + end -end # module Nagios +end diff --git a/lib/puppet/feature/rack.rb b/lib/puppet/feature/rack.rb index 081b9e9fb..b91aa13b7 100644 --- a/lib/puppet/feature/rack.rb +++ b/lib/puppet/feature/rack.rb @@ -13,7 +13,7 @@ Puppet.features.add(:rack) do if ! (defined?(::Rack) and defined?(::Rack.release)) false else - major_version = ::Rack.release().split('.')[0].to_i + major_version = ::Rack.release.split('.')[0].to_i if major_version >= 1 true else diff --git a/lib/puppet/file_serving/base.rb b/lib/puppet/file_serving/base.rb index 707713082..379012f76 100644 --- a/lib/puppet/file_serving/base.rb +++ b/lib/puppet/file_serving/base.rb @@ -68,7 +68,7 @@ class Puppet::FileServing::Base # Stat our file, using the appropriate link-sensitive method. def stat @stat_method ||= self.links == :manage ? :lstat : :stat - File.send(@stat_method, full_path()) + File.send(@stat_method, full_path) end def to_pson_data_hash diff --git a/lib/puppet/file_serving/configuration.rb b/lib/puppet/file_serving/configuration.rb index 5f958eb1d..425213e77 100644 --- a/lib/puppet/file_serving/configuration.rb +++ b/lib/puppet/file_serving/configuration.rb @@ -15,7 +15,7 @@ class Puppet::FileServing::Configuration class << self include Puppet::Util::Cacher - cached_attr(:configuration) { new() } + cached_attr(:configuration) { new } end Mount = Puppet::FileServing::Mount diff --git a/lib/puppet/file_serving/configuration/parser.rb b/lib/puppet/file_serving/configuration/parser.rb index b86ff1ac9..8e25933e4 100644 --- a/lib/puppet/file_serving/configuration/parser.rb +++ b/lib/puppet/file_serving/configuration/parser.rb @@ -44,7 +44,7 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile } } - validate() + validate @mounts end diff --git a/lib/puppet/file_serving/content.rb b/lib/puppet/file_serving/content.rb index cacd908e8..a7fd2045d 100644 --- a/lib/puppet/file_serving/content.rb +++ b/lib/puppet/file_serving/content.rb @@ -37,14 +37,14 @@ class Puppet::FileServing::Content < Puppet::FileServing::Base def content unless @content # This stat can raise an exception, too. - raise(ArgumentError, "Cannot read the contents of links unless following links") if stat().ftype == "symlink" + raise(ArgumentError, "Cannot read the contents of links unless following links") if stat.ftype == "symlink" - @content = ::File.read(full_path()) + @content = ::File.read(full_path) end @content end def to_raw - File.new(full_path(), "r") + File.new(full_path, "r") end end diff --git a/lib/puppet/file_serving/metadata.rb b/lib/puppet/file_serving/metadata.rb index 87d3f138e..ca58669ac 100644 --- a/lib/puppet/file_serving/metadata.rb +++ b/lib/puppet/file_serving/metadata.rb @@ -45,7 +45,7 @@ class Puppet::FileServing::Metadata < Puppet::FileServing::Base # Note that File.stat raises Errno::ENOENT if the file is absent and this # method does not catch that exception. def collect - real_path = full_path() + real_path = full_path stat = stat() @owner = stat.uid @group = stat.gid diff --git a/lib/puppet/file_serving/mount/file.rb b/lib/puppet/file_serving/mount/file.rb index d934d1d10..1daaceaed 100644 --- a/lib/puppet/file_serving/mount/file.rb +++ b/lib/puppet/file_serving/mount/file.rb @@ -94,7 +94,7 @@ class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount else Puppet.notice "No client; expanding '#{path}' with local host" # Else, use the local information - map = localmap() + map = localmap end path.gsub(/%(.)/) do |v| diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb index 3a59f3ec5..2b7da22ec 100644 --- a/lib/puppet/indirector/indirection.rb +++ b/lib/puppet/indirector/indirection.rb @@ -78,7 +78,7 @@ class Puppet::Indirector::Indirection text += scrub(@doc) + "\n\n" if @doc - if s = terminus_setting() + if s = terminus_setting text += "* **Terminus Setting**: #{terminus_setting}" end diff --git a/lib/puppet/indirector/node/ldap.rb b/lib/puppet/indirector/node/ldap.rb index 93da5a831..9e4326273 100644 --- a/lib/puppet/indirector/node/ldap.rb +++ b/lib/puppet/indirector/node/ldap.rb @@ -14,7 +14,7 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap end # Separate this out so it's relatively atomic. It's tempting to call - # process() instead of name2hash() here, but it ends up being + # process instead of name2hash() here, but it ends up being # difficult to test because all exceptions get caught by ldapsearch. # LAK:NOTE Unfortunately, the ldap support is too stupid to throw anything # but LDAP::ResultError, even on bad connections, so we are rough handed diff --git a/lib/puppet/indirector/report/processor.rb b/lib/puppet/indirector/report/processor.rb index 80570d9c3..2f8e9f3c1 100644 --- a/lib/puppet/indirector/report/processor.rb +++ b/lib/puppet/indirector/report/processor.rb @@ -22,7 +22,7 @@ class Puppet::Transaction::Report::Processor < Puppet::Indirector::Code def process(report) return if Puppet[:reports] == "none" - reports().each do |name| + reports.each do |name| if mod = Puppet::Reports.report(name) # We have to use a dup because we're including a module in the # report. diff --git a/lib/puppet/indirector/request.rb b/lib/puppet/indirector/request.rb index ffc2d3189..759b44211 100644 --- a/lib/puppet/indirector/request.rb +++ b/lib/puppet/indirector/request.rb @@ -21,7 +21,7 @@ class Puppet::Indirector::Request end def environment - @environment ||= Puppet::Node::Environment.new() + @environment ||= Puppet::Node::Environment.new end def environment=(env) diff --git a/lib/puppet/metatype/manager.rb b/lib/puppet/metatype/manager.rb index 118862bc7..51068f6be 100644 --- a/lib/puppet/metatype/manager.rb +++ b/lib/puppet/metatype/manager.rb @@ -42,7 +42,7 @@ module Manager newmethod = "new#{name.to_s}" # Used for method manipulation. - selfobj = singleton_class() + selfobj = singleton_class @types ||= {} @@ -94,7 +94,7 @@ module Manager ) # We have to load everything so that we can figure out the default type. - klass.providerloader.loadall() + klass.providerloader.loadall klass end diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb index a7883bcdd..b4184dde5 100644 --- a/lib/puppet/module.rb +++ b/lib/puppet/module.rb @@ -48,7 +48,7 @@ class Puppet::Module def initialize(name, environment = nil) @name = name - assert_validity() + assert_validity if environment.is_a?(Puppet::Node::Environment) @environment = environment diff --git a/lib/puppet/network/authconfig.rb b/lib/puppet/network/authconfig.rb index 932d6da6d..ba2caa473 100644 --- a/lib/puppet/network/authconfig.rb +++ b/lib/puppet/network/authconfig.rb @@ -6,7 +6,7 @@ module Puppet class Network::AuthConfig < Puppet::Util::LoadedFile def self.main - @main ||= self.new() + @main ||= self.new end # Just proxy the setting methods to our rights stuff @@ -23,7 +23,7 @@ module Puppet namespace = request.handler.intern method = request.method.intern - read() + read if @rights.include?(name) return @rights[name].allowed?(request.name, request.ip) @@ -49,7 +49,7 @@ module Puppet @configstamp = @configstatted = nil @configtimeout = 60 - read() if parsenow + read if parsenow end # Read the configuration file. @@ -75,7 +75,7 @@ module Puppet end end - parse() + parse @configstamp = File.stat(@file).ctime @configstatted = Time.now diff --git a/lib/puppet/network/authorization.rb b/lib/puppet/network/authorization.rb index 3d47ea315..12459a5d1 100644 --- a/lib/puppet/network/authorization.rb +++ b/lib/puppet/network/authorization.rb @@ -10,7 +10,7 @@ module Puppet::Network # Create our config object if necessary. This works even if # there's no configuration file. def authconfig - @authconfig ||= Puppet::Network::AuthConfig.main() + @authconfig ||= Puppet::Network::AuthConfig.main @authconfig end diff --git a/lib/puppet/network/client.rb b/lib/puppet/network/client.rb index f9c50cd60..e406ae8cf 100644 --- a/lib/puppet/network/client.rb +++ b/lib/puppet/network/client.rb @@ -146,7 +146,7 @@ class Puppet::Network::Client else self.stopping = true Puppet::Util::Storage.store if self.respond_to? :running? and self.running? - rmpidfile() + rmpidfile end end diff --git a/lib/puppet/network/client/runner.rb b/lib/puppet/network/client/runner.rb index c6ba328b4..68005c9f0 100644 --- a/lib/puppet/network/client/runner.rb +++ b/lib/puppet/network/client/runner.rb @@ -2,7 +2,7 @@ class Puppet::Network::Client::Runner < Puppet::Network::Client::ProxyClient self.mkmethods def initialize(hash = {}) - hash[:Runner] = self.class.handler.new() if hash.include?(:Runner) + hash[:Runner] = self.class.handler.new if hash.include?(:Runner) super(hash) end diff --git a/lib/puppet/network/format.rb b/lib/puppet/network/format.rb index bdaee0fec..2b5b89279 100644 --- a/lib/puppet/network/format.rb +++ b/lib/puppet/network/format.rb @@ -24,7 +24,7 @@ class Puppet::Network::Format @options = options # This must be done early the values can be used to set required_methods - define_method_names() + define_method_names method_list = { :intern_method => "from_#{name}", diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb index 1131e434a..0a5082012 100755 --- a/lib/puppet/network/handler/fileserver.rb +++ b/lib/puppet/network/handler/fileserver.rb @@ -112,7 +112,7 @@ class Puppet::Network::Handler if configuration readconfig(false) # don't check the file the first time. else - create_default_mounts() + create_default_mounts end end end @@ -424,7 +424,7 @@ class Puppet::Network::Handler else Puppet.notice "No client; expanding '#{path}' with local host" # Else, use the local information - map = localmap() + map = localmap end path.gsub(/%(.)/) do |v| key = $1 diff --git a/lib/puppet/network/handler/master.rb b/lib/puppet/network/handler/master.rb index 6f2c238a2..6696df448 100644 --- a/lib/puppet/network/handler/master.rb +++ b/lib/puppet/network/handler/master.rb @@ -33,7 +33,7 @@ class Puppet::Network::Handler args[:Local] = true - @ca = (hash.include?(:CA) and hash[:CA]) ? Puppet::SSLCertificates::CA.new() : nil + @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/handler/report.rb b/lib/puppet/network/handler/report.rb index 50e2fbfea..d935d3822 100755 --- a/lib/puppet/network/handler/report.rb +++ b/lib/puppet/network/handler/report.rb @@ -52,7 +52,7 @@ class Puppet::Network::Handler # Used for those reports that accept yaml client = report.host - reports().each do |name| + reports.each do |name| if mod = Puppet::Reports.report(name) # We have to use a dup because we're including a module in the # report. diff --git a/lib/puppet/network/http/compression.rb b/lib/puppet/network/http/compression.rb index 923262b98..bb06a5770 100644 --- a/lib/puppet/network/http/compression.rb +++ b/lib/puppet/network/http/compression.rb @@ -20,7 +20,7 @@ module Puppet::Network::HTTP::Compression when 'gzip' return Zlib::GzipReader.new(StringIO.new(response.body)).read when 'deflate' - return Zlib::Inflate.new().inflate(response.body) + return Zlib::Inflate.new.inflate(response.body) when nil, 'identity' return response.body else diff --git a/lib/puppet/network/http/rack.rb b/lib/puppet/network/http/rack.rb index a5f69612d..b7da1fcf7 100644 --- a/lib/puppet/network/http/rack.rb +++ b/lib/puppet/network/http/rack.rb @@ -11,7 +11,7 @@ class Puppet::Network::HTTP::Rack protocols = args[:protocols] # Always prepare a REST handler - @rest_http_handler = Puppet::Network::HTTP::RackREST.new() + @rest_http_handler = Puppet::Network::HTTP::RackREST.new protocols.delete :rest # Prepare the XMLRPC handler, for backward compatibility (if requested) @@ -33,7 +33,7 @@ class Puppet::Network::HTTP::Rack # * Return the response (in rack-format) to our caller. def call(env) request = Rack::Request.new(env) - response = Rack::Response.new() + response = Rack::Response.new Puppet.debug 'Handling request: %s %s' % [request.request_method, request.fullpath] # if we shall serve XMLRPC, have /RPC2 go to the xmlrpc handler @@ -56,7 +56,7 @@ class Puppet::Network::HTTP::Rack Puppet.err "Backtrace:" detail.backtrace.each { |line| Puppet.err " > #{line}" } end - response.finish() + response.finish end end diff --git a/lib/puppet/network/http/rack/httphandler.rb b/lib/puppet/network/http/rack/httphandler.rb index e14206850..fed06f880 100644 --- a/lib/puppet/network/http/rack/httphandler.rb +++ b/lib/puppet/network/http/rack/httphandler.rb @@ -3,7 +3,7 @@ require 'puppet/ssl/certificate' class Puppet::Network::HTTP::RackHttpHandler - def initialize() + def initialize end # do something useful with request (a Rack::Request) and use diff --git a/lib/puppet/network/http/rack/xmlrpc.rb b/lib/puppet/network/http/rack/xmlrpc.rb index 9192b1d48..c3209a686 100644 --- a/lib/puppet/network/http/rack/xmlrpc.rb +++ b/lib/puppet/network/http/rack/xmlrpc.rb @@ -23,7 +23,7 @@ class Puppet::Network::HTTP::RackXMLRPC < Puppet::Network::HTTP::RackHttpHandler response.write 'Method Not Allowed' return end - if request.media_type() != "text/xml" + if request.media_type != "text/xml" response.status = 400 response.write 'Bad Request' return @@ -32,7 +32,7 @@ class Puppet::Network::HTTP::RackXMLRPC < Puppet::Network::HTTP::RackHttpHandler # get auth/certificate data client_request = build_client_request(request) - response_body = @xmlrpc_server.process(request.body.read(), client_request) + response_body = @xmlrpc_server.process(request.body.read, client_request) response.status = 200 response['Content-Type'] = 'text/xml; charset=utf-8' diff --git a/lib/puppet/network/http/webrick/rest.rb b/lib/puppet/network/http/webrick/rest.rb index 9a8bf0a83..7526099ee 100644 --- a/lib/puppet/network/http/webrick/rest.rb +++ b/lib/puppet/network/http/webrick/rest.rb @@ -18,7 +18,7 @@ class Puppet::Network::HTTP::WEBrickREST < WEBrick::HTTPServlet::AbstractServlet result.merge(client_information(request)) end - # WEBrick uses a service() method to respond to requests. Simply delegate to the handler response() method. + # WEBrick uses a service method to respond to requests. Simply delegate to the handler response method. def service(request, response) process(request, response) end diff --git a/lib/puppet/network/rest_authconfig.rb b/lib/puppet/network/rest_authconfig.rb index b22a31461..d233c8775 100644 --- a/lib/puppet/network/rest_authconfig.rb +++ b/lib/puppet/network/rest_authconfig.rb @@ -30,7 +30,7 @@ module Puppet # raise an Puppet::Network::AuthorizedError if the request # is denied. def allowed?(request) - read() + read # we're splitting the request in part because # fail_on_deny could as well be called in the XMLRPC context @@ -54,7 +54,7 @@ module Puppet @rights ||= Puppet::Network::Rights.new end - def parse() + def parse super() insert_default_acl end diff --git a/lib/puppet/network/rights.rb b/lib/puppet/network/rights.rb index 63ebae892..a57260aa3 100755 --- a/lib/puppet/network/rights.rb +++ b/lib/puppet/network/rights.rb @@ -79,7 +79,7 @@ class Rights raise error end - def initialize() + def initialize @rights = [] end diff --git a/lib/puppet/network/server.rb b/lib/puppet/network/server.rb index 9f4b5243b..e4945bec9 100644 --- a/lib/puppet/network/server.rb +++ b/lib/puppet/network/server.rb @@ -6,7 +6,7 @@ class Puppet::Network::Server # Put the daemon into the background. def daemonize - if pid = fork() + if pid = fork Process.detach(pid) exit(0) end @@ -58,7 +58,7 @@ class Puppet::Network::Server http_server_class || raise(ArgumentError, "Could not determine HTTP Server class for server type [#{@server_type}]") @port = args[:port] || Puppet[:masterport] || raise(ArgumentError, "Must specify :port or configure Puppet :masterport") - @address = determine_bind_address() + @address = determine_bind_address @protocols = [ :rest, :xmlrpc ] @listening = false diff --git a/lib/puppet/network/xmlrpc/processor.rb b/lib/puppet/network/xmlrpc/processor.rb index e016b177b..9d3904fce 100644 --- a/lib/puppet/network/xmlrpc/processor.rb +++ b/lib/puppet/network/xmlrpc/processor.rb @@ -31,7 +31,7 @@ module Puppet::Network # default in that it expects a ClientRequest object in addition to the # data. def process(data, request) - call, params = parser().parseMethodCall(data) + call, params = parser.parseMethodCall(data) params << request.name << request.ip handler, method = call.split(".") request.handler = handler diff --git a/lib/puppet/network/xmlrpc/server.rb b/lib/puppet/network/xmlrpc/server.rb index e7435268a..8fdf02b2c 100644 --- a/lib/puppet/network/xmlrpc/server.rb +++ b/lib/puppet/network/xmlrpc/server.rb @@ -12,7 +12,7 @@ module Puppet::Network def initialize super() - setup_processor() + setup_processor end end end diff --git a/lib/puppet/network/xmlrpc/webrick_servlet.rb b/lib/puppet/network/xmlrpc/webrick_servlet.rb index 890f2990e..035448a86 100644 --- a/lib/puppet/network/xmlrpc/webrick_servlet.rb +++ b/lib/puppet/network/xmlrpc/webrick_servlet.rb @@ -28,7 +28,7 @@ module Puppet::Network::XMLRPC # and we can consume them all ourselves super() - setup_processor() + setup_processor # Set up each of the passed handlers. handlers.each do |handler| @@ -37,7 +37,7 @@ module Puppet::Network::XMLRPC end # Handle the actual request. We can't use the super() method, because - # we need to pass a ClientRequest object to process() so we can do + # 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 diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb index b3ec1717a..be44b3e5b 100644 --- a/lib/puppet/parameter.rb +++ b/lib/puppet/parameter.rb @@ -193,7 +193,7 @@ class Puppet::Parameter self.class.metaparam end - # each parameter class must define the name() method, and parameter + # each parameter class must define the name method, and parameter # instances do not change that name this implicitly means that a given # object can only have one parameter instance of a given parameter # class diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index 01892ee44..17b05baab 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -94,20 +94,20 @@ class Puppet::Parser::Compiler # This is the main entry into our catalog. def compile # Set the client's parameters into the top scope. - set_node_parameters() + set_node_parameters create_settings_scope - evaluate_main() + evaluate_main - evaluate_ast_node() + evaluate_ast_node - evaluate_node_classes() + evaluate_node_classes - evaluate_generators() + evaluate_generators - finish() + finish - fail_on_unevaluated() + fail_on_unevaluated @catalog end @@ -177,7 +177,7 @@ class Puppet::Parser::Compiler end end - initvars() + initvars end # Create a new scope, with either a specified parent scope or @@ -352,7 +352,7 @@ class Puppet::Parser::Compiler # Make sure all of our resources and such have done any last work # necessary. def finish - evaluate_relationships() + evaluate_relationships resources.each do |resource| # Add in any resource overrides. diff --git a/lib/puppet/parser/functions/shellquote.rb b/lib/puppet/parser/functions/shellquote.rb index 96feaa1ee..888b9769d 100644 --- a/lib/puppet/parser/functions/shellquote.rb +++ b/lib/puppet/parser/functions/shellquote.rb @@ -10,7 +10,7 @@ module Puppet::Parser::Functions with spaces. If an argument is an array, the elements of that array is interpolated within the rest of the arguments; this makes it possible to have an array of arguments and pass that array to - shellquote() instead of having to specify each argument + shellquote instead of having to specify each argument individually in the call. ") \ do |args| @@ -25,9 +25,9 @@ module Puppet::Parser::Functions result << ("'" + word + "'") else r = '"' - word.each_byte() do |c| + word.each_byte do |c| r += "\\" if Dangerous.include?(c) - r += c.chr() + r += c.chr end r += '"' result << r diff --git a/lib/puppet/parser/functions/sprintf.rb b/lib/puppet/parser/functions/sprintf.rb index 4a3916c89..af0a7213e 100644 --- a/lib/puppet/parser/functions/sprintf.rb +++ b/lib/puppet/parser/functions/sprintf.rb @@ -5,9 +5,9 @@ module Puppet::Parser::Functions :doc => "Perform printf-style formatting of text. - The first parameter is format string describing how the rest of the parameters should be formatted. See the documentation for the ``Kernel::sprintf()`` function in Ruby for all the details.") do |args| + The first parameter is format string describing how the rest of the parameters should be formatted. See the documentation for the ``Kernel::sprintf`` function in Ruby for all the details.") do |args| raise Puppet::ParseError, 'sprintf() needs at least one argument' if args.length < 1 - fmt = args.shift() + fmt = args.shift return sprintf(fmt, *args) end end diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb index 7668722d4..0c95142f9 100644 --- a/lib/puppet/parser/lexer.rb +++ b/lib/puppet/parser/lexer.rb @@ -368,7 +368,7 @@ class Puppet::Parser::Lexer def initialize @find = 0 @regex = 0 - initvars() + initvars end def initvars @@ -396,7 +396,7 @@ class Puppet::Parser::Lexer def munge_token(token, value) @line += 1 if token.incr_line - skip() if token.skip_text + skip if token.skip_text return if token.skip and not token.accumulate? @@ -442,7 +442,7 @@ class Puppet::Parser::Lexer lex_error "Invalid or empty string" unless @scanner # Skip any initial whitespace. - skip() + skip until token_queue.empty? and @scanner.eos? do yielded = false @@ -460,7 +460,7 @@ class Puppet::Parser::Lexer final_token, token_value = munge_token(matched_token, value) unless final_token - skip() + skip next end @@ -496,7 +496,7 @@ class Puppet::Parser::Lexer end end @previous_token = final_token - skip() + skip end @scanner = nil diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb index 18d17252c..8dd986bd5 100644 --- a/lib/puppet/parser/parser_support.rb +++ b/lib/puppet/parser/parser_support.rb @@ -117,12 +117,12 @@ class Puppet::Parser::Parser def initialize(env) # The environment is needed to know how to find the resource type collection. @environment = env.is_a?(String) ? Puppet::Node::Environment.new(env) : env - initvars() + initvars end # Initialize or reset all of our variables. def initvars - @lexer = Puppet::Parser::Lexer.new() + @lexer = Puppet::Parser::Lexer.new end # Split an fq name into a namespace and name diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index ba2a5f3b0..2d31b40e7 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -68,7 +68,7 @@ class Puppet::Parser::Resource < Puppet::Resource # Retrieve the associated definition and evaluate it. def evaluate if klass = resource_type and ! builtin_type? - finish() + finish return klass.evaluate_code(self) elsif builtin? devfail "Cannot evaluate a builtin type (#{type})" @@ -95,9 +95,9 @@ class Puppet::Parser::Resource < Puppet::Resource def finish return if finished? @finished = true - add_defaults() - add_metaparams() - validate() + add_defaults + add_metaparams + validate end # Has this resource already been finished? diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 3bda512d7..9b49ab680 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -140,7 +140,7 @@ class Puppet::Parser::Scope end } - extend_with_functions_module() + extend_with_functions_module @tags = [] diff --git a/lib/puppet/parser/yaml_trimmer.rb b/lib/puppet/parser/yaml_trimmer.rb index 09159e38f..131bafb8d 100644 --- a/lib/puppet/parser/yaml_trimmer.rb +++ b/lib/puppet/parser/yaml_trimmer.rb @@ -3,7 +3,7 @@ module Puppet::Parser::YamlTrimmer def to_yaml_properties r = instance_variables - REMOVE - r -= skip_for_yaml() if respond_to?(:skip_for_yaml) + r -= skip_for_yaml if respond_to?(:skip_for_yaml) r end end diff --git a/lib/puppet/property.rb b/lib/puppet/property.rb index d86c1fdc0..c7165fe6e 100644 --- a/lib/puppet/property.rb +++ b/lib/puppet/property.rb @@ -201,7 +201,7 @@ class Puppet::Property < Puppet::Parameter super end - # each property class must define the name() method, and property instances + # each property class must define the name method, and property instances # do not change that name # this implicitly means that a given object can only have one property # instance of a given property class diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb index 67d008956..859a34658 100644 --- a/lib/puppet/provider.rb +++ b/lib/puppet/provider.rb @@ -219,8 +219,8 @@ class Puppet::Provider end dochook(:features) do - if features().length > 0 - return " Supported features: " + features().collect do |f| + if features.length > 0 + return " Supported features: " + features.collect do |f| "``#{f}``" end.join(", ") + "." end diff --git a/lib/puppet/provider/cron/crontab.rb b/lib/puppet/provider/cron/crontab.rb index 73ca78cf5..7dd41c642 100755 --- a/lib/puppet/provider/cron/crontab.rb +++ b/lib/puppet/provider/cron/crontab.rb @@ -104,7 +104,7 @@ tab = case Facter.value(:operatingsystem) # Then the normal fields. matched = true - record_type(record[:record_type]).fields().each do |field| + record_type(record[:record_type]).fields.each do |field| next if field == :command next if field == :special if record[field] and ! resource.value(field) diff --git a/lib/puppet/provider/mailalias/aliases.rb b/lib/puppet/provider/mailalias/aliases.rb index 77b29114f..388fd631c 100755 --- a/lib/puppet/provider/mailalias/aliases.rb +++ b/lib/puppet/provider/mailalias/aliases.rb @@ -23,8 +23,8 @@ require 'puppet/provider/parsedfile' def process(line) ret = {} records = line.split(':',2) - ret[:name] = records[0].strip() - ret[:recipient] = records[1].strip() + ret[:name] = records[0].strip + ret[:recipient] = records[1].strip ret end diff --git a/lib/puppet/provider/mount.rb b/lib/puppet/provider/mount.rb index 86361969c..2136339a3 100644 --- a/lib/puppet/provider/mount.rb +++ b/lib/puppet/provider/mount.rb @@ -23,8 +23,8 @@ module Puppet::Provider::Mount if resource[:remounts] == :true mountcmd "-o", "remount", resource[:name] else - unmount() - mount() + unmount + mount end end diff --git a/lib/puppet/provider/nameservice.rb b/lib/puppet/provider/nameservice.rb index 3f485c3af..6564a4154 100644 --- a/lib/puppet/provider/nameservice.rb +++ b/lib/puppet/provider/nameservice.rb @@ -205,7 +205,7 @@ class Puppet::Provider::NameService < Puppet::Provider # Retrieve what we can about our object def getinfo(refresh) if @objectinfo.nil? or refresh == true - @etcmethod ||= ("get" + self.class.section().to_s + "nam").intern + @etcmethod ||= ("get" + self.class.section.to_s + "nam").intern begin @objectinfo = Etc.send(@etcmethod, @resource[:name]) rescue ArgumentError => detail diff --git a/lib/puppet/provider/nameservice/directoryservice.rb b/lib/puppet/provider/nameservice/directoryservice.rb index b98a38c12..060ed4c31 100644 --- a/lib/puppet/provider/nameservice/directoryservice.rb +++ b/lib/puppet/provider/nameservice/directoryservice.rb @@ -30,7 +30,7 @@ class DirectoryService < Puppet::Provider::NameService attr_writer :macosx_version_major end - initvars() + initvars commands :dscl => "/usr/bin/dscl" commands :dseditgroup => "/usr/sbin/dseditgroup" @@ -181,7 +181,7 @@ class DirectoryService < Puppet::Provider::NameService def self.generate_attribute_hash(input_hash, *type_properties) attribute_hash = {} - input_hash.keys().each do |key| + input_hash.keys.each do |key| ds_attribute = key.sub("dsAttrTypeStandard:", "") next unless (@@ds_to_ns_attribute_map.keys.include?(ds_attribute) and type_properties.include? @@ds_to_ns_attribute_map[ds_attribute]) ds_value = input_hash[key] @@ -219,7 +219,7 @@ class DirectoryService < Puppet::Provider::NameService # This class method returns nil if the object doesn't exist # Otherwise, it returns a hash of the object properties. - all_present_str_array = list_all_present() + all_present_str_array = list_all_present # NBK: shortcut the process if the resource is missing return nil unless all_present_str_array.include? resource_name diff --git a/lib/puppet/provider/package/appdmg.rb b/lib/puppet/provider/package/appdmg.rb index 540bcb1ad..11858114d 100644 --- a/lib/puppet/provider/package/appdmg.rb +++ b/lib/puppet/provider/package/appdmg.rb @@ -81,16 +81,16 @@ Puppet::Type.type(:package).provide(:appdmg, :parent => Puppet::Provider::Packag }.each do |pkg| installapp("#{fspath}/#{pkg}", name, source) end - end # mounts.each do + end ensure hdiutil "eject", mounts[0] - end # begin - end # open() do + end + end ensure # JJM Remove the file if open-uri didn't already do so. File.unlink(cached_source) if File.exist?(cached_source) - end # begin - end # def self.installpkgdmg + end + end def query FileTest.exists?("/var/db/.puppet_appdmg_installed_#{@resource[:name]}") ? {:name => @resource[:name], :ensure => :present} : nil diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb index a26b61159..deab23428 100755 --- a/lib/puppet/provider/package/apt.rb +++ b/lib/puppet/provider/package/apt.rb @@ -41,7 +41,7 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do self.run_preseed if @resource[:responsefile] should = @resource[:ensure] - checkforcdrom() + checkforcdrom cmd = %w{-q -y} keep = "" diff --git a/lib/puppet/provider/package/darwinport.rb b/lib/puppet/provider/package/darwinport.rb index 6ba7c5772..c746cc3b3 100755 --- a/lib/puppet/provider/package/darwinport.rb +++ b/lib/puppet/provider/package/darwinport.rb @@ -80,7 +80,7 @@ Puppet::Type.type(:package).provide :darwinport, :parent => Puppet::Provider::Pa end def update - install() + install end end diff --git a/lib/puppet/provider/package/openbsd.rb b/lib/puppet/provider/package/openbsd.rb index 4a19a883c..f6005efa7 100755 --- a/lib/puppet/provider/package/openbsd.rb +++ b/lib/puppet/provider/package/openbsd.rb @@ -16,7 +16,7 @@ Puppet::Type.type(:package).provide :openbsd, :parent => Puppet::Provider::Packa packages = [] begin - execpipe(listcmd()) do |process| + execpipe(listcmd) do |process| # our regex for matching pkg_info output regex = /^(.*)-(\d[^-]*)[-]?(\D*)(.*)$/ fields = [:name, :ensure, :flavor ] @@ -24,7 +24,7 @@ Puppet::Type.type(:package).provide :openbsd, :parent => Puppet::Provider::Packa # now turn each returned line into a package object process.each { |line| - if match = regex.match(line.split()[0]) + if match = regex.match(line.split[0]) fields.zip(match.captures) { |field,value| hash[field] = value } @@ -83,7 +83,7 @@ Puppet::Type.type(:package).provide :openbsd, :parent => Puppet::Provider::Packa master_version = 0 process.each do |line| - if match = regex.match(line.split()[0]) + if match = regex.match(line.split[0]) # now we return the first version, unless ensure is latest version = match.captures[1] return version unless @resource[:ensure] == "latest" diff --git a/lib/puppet/provider/package/ports.rb b/lib/puppet/provider/package/ports.rb index 014f31530..1b8f0fb8c 100755 --- a/lib/puppet/provider/package/ports.rb +++ b/lib/puppet/provider/package/ports.rb @@ -89,7 +89,7 @@ Puppet::Type.type(:package).provide :ports, :parent => :freebsd, :source => :fre end def update - install() + install end end diff --git a/lib/puppet/provider/package/portupgrade.rb b/lib/puppet/provider/package/portupgrade.rb index c3aea98bf..08cb52f47 100644 --- a/lib/puppet/provider/package/portupgrade.rb +++ b/lib/puppet/provider/package/portupgrade.rb @@ -202,7 +202,7 @@ Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::P return nil end - end # def query + end ####### Uninstall command diff --git a/lib/puppet/provider/parsedfile.rb b/lib/puppet/provider/parsedfile.rb index 6104c0c8e..811607abb 100755 --- a/lib/puppet/provider/parsedfile.rb +++ b/lib/puppet/provider/parsedfile.rb @@ -131,7 +131,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider define_method(attr) do # if @property_hash.empty? # # Note that this swaps the provider out from under us. -# prefetch() +# prefetch # if @resource.provider == self # return @property_hash[attr] # else @@ -162,7 +162,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider # Always make the resource methods. def self.resource_type=(resource) super - mk_resource_methods() + mk_resource_methods end # Mark a target as modified so we know to flush it. This only gets @@ -310,7 +310,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider @property_hash[property] = value end end - mark_target_modified() + mark_target_modified (@resource.class.name.to_s + "_created").intern end diff --git a/lib/puppet/provider/service/debian.rb b/lib/puppet/provider/service/debian.rb index 1f95d66f7..746ed1ce3 100755 --- a/lib/puppet/provider/service/debian.rb +++ b/lib/puppet/provider/service/debian.rb @@ -27,7 +27,7 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do end def enabled? - # TODO: Replace system() call when Puppet::Util.execute gives us a way + # TODO: Replace system call when Puppet::Util.execute gives us a way # to determine exit status. http://projects.reductivelabs.com/issues/2538 system("/usr/sbin/invoke-rc.d", "--quiet", "--query", @resource[:name], "start") diff --git a/lib/puppet/provider/user/ldap.rb b/lib/puppet/provider/user/ldap.rb index 3a91b4f92..406ed0f93 100644 --- a/lib/puppet/provider/user/ldap.rb +++ b/lib/puppet/provider/user/ldap.rb @@ -70,10 +70,10 @@ Puppet::Type.type(:user).provide :ldap, :parent => Puppet::Provider::Ldap do def groups=(values) should = values.split(",") - if groups() == :absent + if groups == :absent is = [] else - is = groups().split(",") + is = groups.split(",") end modes = {} diff --git a/lib/puppet/provider/zone/solaris.rb b/lib/puppet/provider/zone/solaris.rb index b2cdd2a2b..33b1bc122 100644 --- a/lib/puppet/provider/zone/solaris.rb +++ b/lib/puppet/provider/zone/solaris.rb @@ -89,7 +89,7 @@ Puppet::Type.type(:zone).provide(:solaris) do # We need a way to test whether a zone is in process. Our 'ensure' # property models the static states, but we need to handle the temporary ones. def processing? - if hash = status() + if hash = status case hash[:ensure] when "incomplete", "ready", "shutting_down" true @@ -212,7 +212,7 @@ Puppet::Type.type(:zone).provide(:solaris) do # Turn the results of getconfig into status information. def config_status - config = getconfig() + config = getconfig result = {} result[:autoboot] = config[:autoboot] ? config[:autoboot].intern : :absent diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb index 43978ab39..f1d97bf4f 100644 --- a/lib/puppet/rails.rb +++ b/lib/puppet/rails.rb @@ -78,14 +78,14 @@ module Puppet::Rails def self.init raise Puppet::DevError, "No activerecord, cannot init Puppet::Rails" unless Puppet.features.rails? - connect() + connect unless ActiveRecord::Base.connection.tables.include?("resources") require 'puppet/rails/database/schema' Puppet::Rails::Schema.init end - migrate() if Puppet[:dbmigrate] + migrate if Puppet[:dbmigrate] end # Migrate to the latest db schema. @@ -120,7 +120,7 @@ module Puppet::Rails Puppet.settings.use(:master, :rails) begin - ActiveRecord::Base.establish_connection(database_arguments()) + ActiveRecord::Base.establish_connection(database_arguments) rescue => detail puts detail.backtrace if Puppet[:trace] raise Puppet::Error, "Could not connect to database: #{detail}" diff --git a/lib/puppet/rails/host.rb b/lib/puppet/rails/host.rb index 854df2bd4..510790235 100644 --- a/lib/puppet/rails/host.rb +++ b/lib/puppet/rails/host.rb @@ -153,7 +153,7 @@ class Puppet::Rails::Host < ActiveRecord::Base resources_by_id = nil debug_benchmark("Searched for resources") { - resources_by_id = find_resources() + resources_by_id = find_resources } debug_benchmark("Searched for resource params and tags") { diff --git a/lib/puppet/rails/resource.rb b/lib/puppet/rails/resource.rb index 46b49ba1b..f485909a3 100644 --- a/lib/puppet/rails/resource.rb +++ b/lib/puppet/rails/resource.rb @@ -92,7 +92,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base accumulate_benchmark("Individual resource merger", :attributes) { merge_attributes(resource) } accumulate_benchmark("Individual resource merger", :parameters) { merge_parameters(resource) } accumulate_benchmark("Individual resource merger", :tags) { merge_tags(resource) } - save() + save end def merge_attributes(resource) @@ -170,7 +170,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base end def name - ref() + ref end def parameter(param) diff --git a/lib/puppet/reports/rrdgraph.rb b/lib/puppet/reports/rrdgraph.rb index b152faaab..2f27f63af 100644 --- a/lib/puppet/reports/rrdgraph.rb +++ b/lib/puppet/reports/rrdgraph.rb @@ -115,7 +115,7 @@ Puppet::Reports.register_report(:rrdgraph) do metric.graph end - mkhtml() unless FileTest.exists?(File.join(hostdir, "index.html")) + mkhtml unless FileTest.exists?(File.join(hostdir, "index.html")) end # Unfortunately, RRD does not deal well with changing lists of values, diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb index 88f85c3ad..cc84b7663 100644 --- a/lib/puppet/resource.rb +++ b/lib/puppet/resource.rb @@ -169,7 +169,7 @@ class Puppet::Resource extract_parameters(params) end - resolve_type_and_title() + resolve_type_and_title tag(self.type) tag(self.title) if valid_tag?(self.title) @@ -360,7 +360,7 @@ class Puppet::Resource # Produce a canonical method name. def parameter_name(param) param = param.to_s.downcase.to_sym - if param == :name and n = namevar() + if param == :name and n = namevar param = namevar end param diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb index b5f173718..79888529f 100644 --- a/lib/puppet/resource/catalog.rb +++ b/lib/puppet/resource/catalog.rb @@ -129,7 +129,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph # Expire all of the resource data -- this ensures that all # data we're operating against is entirely current. - expire() + expire Puppet::Util::Storage.load if host_config? transaction = Puppet::Transaction.new(self) @@ -159,7 +159,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph return transaction ensure @applying = false - cleanup() + cleanup end # Are we in the middle of applying the catalog? @@ -283,7 +283,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph if block_given? yield(self) - finalize() + finalize end end @@ -497,7 +497,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph def cleanup # Expire any cached data the resources are keeping. - expire() + expire end # Verify that the given resource isn't defined elsewhere. diff --git a/lib/puppet/run.rb b/lib/puppet/run.rb index 028545961..658b9677f 100644 --- a/lib/puppet/run.rb +++ b/lib/puppet/run.rb @@ -49,7 +49,7 @@ class Puppet::Run return self end - log_run() + log_run if background? Thread.new { agent.run(options) } diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index c8ffef529..172a0f7b5 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -300,7 +300,7 @@ class Puppet::SimpleGraph # # For some reason, unconnected vertices do not show up in # # this graph. # def to_jpg(path, name) -# gv = vertices() +# gv = vertices # Dir.chdir(path) do # induced_subgraph(gv).write_to_graphic_file('jpg', name) # end diff --git a/lib/puppet/ssl/certificate_authority.rb b/lib/puppet/ssl/certificate_authority.rb index be74c2fac..26febb3d3 100644 --- a/lib/puppet/ssl/certificate_authority.rb +++ b/lib/puppet/ssl/certificate_authority.rb @@ -133,7 +133,7 @@ class Puppet::SSL::CertificateAuthority @certificate = sign(host.name, :ca, request) # And make sure we initialize our CRL. - crl() + crl end def initialize @@ -143,7 +143,7 @@ class Puppet::SSL::CertificateAuthority @host = Puppet::SSL::Host.new(Puppet::SSL::Host.ca_name) - setup() + setup end # Retrieve (or create, if necessary) our inventory manager. diff --git a/lib/puppet/ssl/certificate_factory.rb b/lib/puppet/ssl/certificate_factory.rb index e794c770c..9a5507dea 100644 --- a/lib/puppet/ssl/certificate_factory.rb +++ b/lib/puppet/ssl/certificate_factory.rb @@ -29,7 +29,7 @@ class Puppet::SSL::CertificateFactory @cert.public_key = @csr.public_key @cert.serial = @serial - build_extensions() + build_extensions set_ttl diff --git a/lib/puppet/ssl/host.rb b/lib/puppet/ssl/host.rb index ae91ceafb..9aaff8ad2 100644 --- a/lib/puppet/ssl/host.rb +++ b/lib/puppet/ssl/host.rb @@ -24,7 +24,7 @@ class Puppet::SSL::Host include Puppet::Util::Cacher cached_attr(:localhost) do - result = new() + result = new result.generate unless result.certificate result.key # Make sure it's read in result @@ -184,7 +184,7 @@ class Puppet::SSL::Host # If we can get a CA instance, then we're a valid CA, and we # should use it to sign our request; else, just try to read # the cert. - if ! certificate() and ca = Puppet::SSL::CertificateAuthority.instance + if ! certificate and ca = Puppet::SSL::CertificateAuthority.instance ca.sign(self.name) end end diff --git a/lib/puppet/sslcertificates/certificate.rb b/lib/puppet/sslcertificates/certificate.rb index 92a2a7c88..a9d1dd4ea 100644 --- a/lib/puppet/sslcertificates/certificate.rb +++ b/lib/puppet/sslcertificates/certificate.rb @@ -33,7 +33,7 @@ class Puppet::SSLCertificates::Certificate end def getkey - self.mkkey() unless FileTest.exists?(@keyfile) + self.mkkey unless FileTest.exists?(@keyfile) if @password @key = OpenSSL::PKey::RSA.new( diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index 15ce5903b..d70e06c85 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -127,7 +127,7 @@ class Puppet::Transaction # Start logging. Puppet::Util::Log.newdestination(@report) - prepare() + prepare Puppet.info "Applying configuration version '#{catalog.version}'" if catalog.version @@ -271,11 +271,11 @@ class Puppet::Transaction # Prepare to evaluate the resources in a transaction. def prepare # Now add any dynamically generated resources - generate() + generate # Then prefetch. It's important that we generate and then prefetch, # so that any generated resources also get prefetched. - prefetch() + prefetch # This will throw an error if there are cycles in the graph. @sorted_resources = relationship_graph.topsort @@ -288,7 +288,7 @@ class Puppet::Transaction # Send off the transaction report. def send_report begin - report = generate_report() + report = generate_report rescue => detail Puppet.err "Could not generate report: #{detail}" return @@ -298,7 +298,7 @@ class Puppet::Transaction if Puppet[:report] begin - report.save() + report.save rescue => detail Puppet.err "Reporting failed: #{detail}" end diff --git a/lib/puppet/transaction/change.rb b/lib/puppet/transaction/change.rb index 0f2ed5788..c8acec88b 100644 --- a/lib/puppet/transaction/change.rb +++ b/lib/puppet/transaction/change.rb @@ -33,14 +33,14 @@ class Puppet::Transaction::Change property.sync - result = event() + result = event result.message = property.change_to_s(is, should) result.status = "success" result.send_log result rescue => detail puts detail.backtrace if Puppet[:trace] - result = event() + result = event result.status = "failure" result.message = "change from #{property.is_to_s(is)} to #{property.should_to_s(should)} failed: #{detail}" diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 7aab88c9c..1e0bde5e7 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -35,7 +35,7 @@ class Type def self.states warnonce "The states method is deprecated; use properties" - properties() + properties end # All parameters, in the appropriate order. The key_attributes come first, then @@ -435,8 +435,8 @@ class Type # iterate across the existing properties def eachproperty - # properties() is a private method - properties().each { |property| + # properties is a private method + properties.each { |property| yield property } end @@ -706,7 +706,7 @@ class Type # is the first property, which is important for skipping 'retrieve' on # all the properties if the resource is absent. ensure_state = false - return properties().inject({}) do | prophash, property| + return properties.inject({}) do | prophash, property| if property.name == :ensure ensure_state = property.retrieve prophash[property] = ensure_state @@ -979,7 +979,7 @@ class Type def properties_to_audit(list) if list == :all - list = all_properties() if list == :all + list = all_properties if list == :all else list = Array(list).collect { |p| p.to_sym } end @@ -1329,7 +1329,7 @@ class Type # Find the default provider. def self.defaultprovider unless @defaultprovider - suitable = suitableprovider() + suitable = suitableprovider # Find which providers are a default for this system. defaults = suitable.find_all { |provider| provider.default? } @@ -1450,7 +1450,7 @@ class Type # We need to add documentation for each provider. def self.doc - @doc + " Available providers are:\n\n" + parenttype().providers.sort { |a,b| + @doc + " Available providers are:\n\n" + parenttype.providers.sort { |a,b| a.to_s <=> b.to_s }.collect { |i| "* **#{i}**: #{parenttype().provider(i).doc}" @@ -1684,7 +1684,7 @@ class Type # instance methods related to instance intrinsics - # e.g., initialize() and name() + # e.g., initialize and name public @@ -1880,7 +1880,7 @@ class Type end end -end # Puppet::Type +end end require 'puppet/provider' diff --git a/lib/puppet/type/augeas.rb b/lib/puppet/type/augeas.rb index ae8f1a525..5a6fb54de 100644 --- a/lib/puppet/type/augeas.rb +++ b/lib/puppet/type/augeas.rb @@ -176,7 +176,7 @@ Puppet::Type.newtype(:augeas) do # Actually execute the command. def sync - @resource.provider.execute_changes() + @resource.provider.execute_changes end end diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb index 7a1f37f1d..5a2533289 100755 --- a/lib/puppet/type/cron.rb +++ b/lib/puppet/type/cron.rb @@ -181,7 +181,7 @@ Puppet::Type.newtype(:cron) do # If it has an alpha method defined, then we check # to see if our value is in that list and if so we turn # it into a number - retval = alphacheck(value, alpha()) + retval = alphacheck(value, alpha) end if retval @@ -237,7 +237,7 @@ Puppet::Type.newtype(:cron) do end validate do |value| - raise ArgumentError, "Invalid special schedule #{value.inspect}" unless specials().include?(value) + raise ArgumentError, "Invalid special schedule #{value.inspect}" unless specials.include?(value) end end diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb index f930a536c..a60cdb481 100755 --- a/lib/puppet/type/exec.rb +++ b/lib/puppet/type/exec.rb @@ -530,7 +530,7 @@ module Puppet # Verify that we pass all of the checks. The argument determines whether # we skip the :refreshonly check, which is necessary because we now check - # within refresh() + # within refresh def check(refreshing = false) self.class.checks.each { |check| next if refreshing and check == :refreshonly diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index 0f1f5d81b..afa990d7f 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -365,7 +365,7 @@ Puppet::Type.newtype(:file) do # there is one. def finish # Look up our bucket, if there is one - bucket() + bucket super end diff --git a/lib/puppet/type/file/target.rb b/lib/puppet/type/file/target.rb index ab7b847a7..59f1e5972 100644 --- a/lib/puppet/type/file/target.rb +++ b/lib/puppet/type/file/target.rb @@ -12,9 +12,9 @@ module Puppet newvalue(/./) do @resource[:ensure] = :link if ! @resource.should(:ensure) - # Only call mklink if ensure() didn't call us in the first place. + # Only call mklink if ensure didn't call us in the first place. currentensure = @resource.property(:ensure).retrieve - mklink() if @resource.property(:ensure).insync?(currentensure) + mklink if @resource.property(:ensure).insync?(currentensure) end # Create our link. @@ -30,7 +30,7 @@ module Puppet raise Puppet::Error, "Could not remove existing file" if FileTest.exists?(@resource[:path]) Dir.chdir(File.dirname(@resource[:path])) do - Puppet::Util::SUIDManager.asuser(@resource.asuser()) do + Puppet::Util::SUIDManager.asuser(@resource.asuser) do mode = @resource.should(:mode) if mode Puppet::Util.withumask(000) do diff --git a/lib/puppet/type/filebucket.rb b/lib/puppet/type/filebucket.rb index cc3474b40..37ebd2d61 100755 --- a/lib/puppet/type/filebucket.rb +++ b/lib/puppet/type/filebucket.rb @@ -61,7 +61,7 @@ module Puppet end def bucket - mkbucket() unless defined?(@bucket) + mkbucket unless defined?(@bucket) @bucket end diff --git a/lib/puppet/type/mount.rb b/lib/puppet/type/mount.rb index 5772e44a1..cf9b40867 100755 --- a/lib/puppet/type/mount.rb +++ b/lib/puppet/type/mount.rb @@ -12,7 +12,7 @@ module Puppet :methods => [:remount] # Use the normal parent class, because we actually want to - # call code when sync() is called. + # call code when sync is called. newproperty(:ensure) do desc "Control what to do with this mount. Set this attribute to ``umounted`` to make sure the filesystem is in the filesystem table @@ -30,7 +30,7 @@ module Puppet newvalue(:unmounted) do if provider.mounted? - syncothers() + syncothers provider.unmount return :mount_unmounted else @@ -50,7 +50,7 @@ module Puppet current_value = self.retrieve provider.create if current_value.nil? or current_value == :absent - syncothers() + syncothers # The fs can be already mounted if it was absent but mounted provider.mount unless provider.mounted? diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb index e1a23dd13..658901ee2 100644 --- a/lib/puppet/type/package.rb +++ b/lib/puppet/type/package.rb @@ -318,6 +318,6 @@ module Puppet def exists? @provider.get(:ensure) != :absent end - end # Puppet::Type.type(:package) + end end diff --git a/lib/puppet/type/resources.rb b/lib/puppet/type/resources.rb index 76685d6bd..6e351f861 100644 --- a/lib/puppet/type/resources.rb +++ b/lib/puppet/type/resources.rb @@ -123,7 +123,7 @@ Puppet::Type.newtype(:resources) do resource[:audit] = :uid current_values = resource.retrieve_resource - return false if system_users().include?(resource[:name]) + return false if system_users.include?(resource[:name]) current_values[resource.property(:uid)] > self[:unless_system_user] end diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index 9e5afe083..4c472275c 100755 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -248,7 +248,7 @@ module Puppet def retrieve absent = false - properties().inject({}) { |prophash, property| + properties.inject({}) { |prophash, property| current_value = :absent if absent diff --git a/lib/puppet/type/yumrepo.rb b/lib/puppet/type/yumrepo.rb index b85bc5994..d37da0291 100644 --- a/lib/puppet/type/yumrepo.rb +++ b/lib/puppet/type/yumrepo.rb @@ -103,7 +103,7 @@ module Puppet # Return the Puppet::Util::IniConfig::File for the whole yum config def self.inifile if @inifile.nil? - @inifile = read() + @inifile = read main = @inifile['main'] raise Puppet::Error, "File #{yumconf} does not contain a main section" if main.nil? reposdir = main['reposdir'] @@ -128,7 +128,7 @@ module Puppet # Non-test code should use self.inifile to get at the # underlying file def self.read - result = Puppet::Util::IniConfig::File.new() + result = Puppet::Util::IniConfig::File.new result.read(yumconf) main = result['main'] raise Puppet::Error, "File #{yumconf} does not contain a main section" if main.nil? diff --git a/lib/puppet/type/zone.rb b/lib/puppet/type/zone.rb index a60706bb8..9d972a17a 100644 --- a/lib/puppet/type/zone.rb +++ b/lib/puppet/type/zone.rb @@ -412,12 +412,12 @@ Puppet::Type.newtype(:zone) do def retrieve provider.flush - if hash = provider.properties() and hash[:ensure] != :absent + if hash = provider.properties and hash[:ensure] != :absent result = setstatus(hash) result else # Return all properties as absent. - return properties().inject({}) do | prophash, property| + return properties.inject({}) do | prophash, property| prophash[property] = :absent prophash end diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb index a950aa562..221365a03 100644 --- a/lib/puppet/util.rb +++ b/lib/puppet/util.rb @@ -301,14 +301,14 @@ module Util rescue => detail puts detail.to_s exit!(1) - end # begin; rescue - end # if child_pid + end + end elsif Puppet.features.microsoft_windows? command = command.collect {|part| '"' + part.gsub(/"/, '\\"') + '"'}.join(" ") if command.is_a?(Array) Puppet.debug "Creating process '#{command}'" processinfo = Process.create( :command_line => command ) child_status = (Process.waitpid2(child_pid)[1]).to_i >> 8 - end # if posix or win32 + end # read output in if required if ! arguments[:squelch] diff --git a/lib/puppet/util/checksums.rb b/lib/puppet/util/checksums.rb index a05cc0e4f..102ee98ac 100644 --- a/lib/puppet/util/checksums.rb +++ b/lib/puppet/util/checksums.rb @@ -31,7 +31,7 @@ module Puppet::Util::Checksums def md5_file(filename, lite = false) require 'digest/md5' - digest = Digest::MD5.new() + digest = Digest::MD5.new checksum_file(digest, filename, lite) end @@ -42,7 +42,7 @@ module Puppet::Util::Checksums def md5_stream(&block) require 'digest/md5' - digest = Digest::MD5.new() + digest = Digest::MD5.new yield digest digest.hexdigest end @@ -76,7 +76,7 @@ module Puppet::Util::Checksums def sha1_file(filename, lite = false) require 'digest/sha1' - digest = Digest::SHA1.new() + digest = Digest::SHA1.new checksum_file(digest, filename, lite) end @@ -87,7 +87,7 @@ module Puppet::Util::Checksums def sha1_stream require 'digest/sha1' - digest = Digest::SHA1.new() + digest = Digest::SHA1.new yield digest digest.hexdigest end diff --git a/lib/puppet/util/docs.rb b/lib/puppet/util/docs.rb index d247ec044..dc742d4b0 100644 --- a/lib/puppet/util/docs.rb +++ b/lib/puppet/util/docs.rb @@ -90,8 +90,8 @@ module Puppet::Util::Docs # If we can match an indentation, then just remove that same level of # indent from every line. However, ignore any indentation on the # first line, since that can be inconsistent. - text = text.lstrip() - text.gsub!(/^([\t]+)/) { |s| " "*8*s.length(); } # Expand leading tabs + text = text.lstrip + text.gsub!(/^([\t]+)/) { |s| " "*8*s.length; } # Expand leading tabs # Find first non-empty line after the first line: line2start = (text =~ /(\n?\s*\n)/) line2start += $1.length diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb index 554ac0566..bacc7d2b6 100755 --- a/lib/puppet/util/filetype.rb +++ b/lib/puppet/util/filetype.rb @@ -34,7 +34,7 @@ class Puppet::Util::FileType define_method(:real_read, instance_method(:read)) define_method(:read) do begin - val = real_read() + val = real_read @loaded = Time.now if val return val.gsub(/# HEADER.*\n/,'') @@ -165,15 +165,15 @@ class Puppet::Util::FileType # Read a specific @path's cron tab. def read - %x{#{cmdbase()} -l 2>/dev/null} + %x{#{cmdbase} -l 2>/dev/null} end # Remove a specific @path's cron tab. def remove if %w{Darwin FreeBSD}.include?(Facter.value("operatingsystem")) - %x{/bin/echo yes | #{cmdbase()} -r 2>/dev/null} + %x{/bin/echo yes | #{cmdbase} -r 2>/dev/null} else - %x{#{cmdbase()} -r 2>/dev/null} + %x{#{cmdbase} -r 2>/dev/null} end end diff --git a/lib/puppet/util/ldap/manager.rb b/lib/puppet/util/ldap/manager.rb index 3e3c54562..501a3cd4a 100644 --- a/lib/puppet/util/ldap/manager.rb +++ b/lib/puppet/util/ldap/manager.rb @@ -200,7 +200,7 @@ class Puppet::Util::Ldap::Manager # Search for all entries at our base. A potentially expensive search. def search(sfilter = nil) - sfilter ||= filter() + sfilter ||= filter result = [] connect do |conn| diff --git a/lib/puppet/util/loadedfile.rb b/lib/puppet/util/loadedfile.rb index 22d8928e7..9eaca552b 100755 --- a/lib/puppet/util/loadedfile.rb +++ b/lib/puppet/util/loadedfile.rb @@ -17,12 +17,12 @@ module Puppet def changed? # Allow the timeout to be disabled entirely. return true if Puppet[:filetimeout] < 0 - tmp = stamp() + tmp = stamp # We use a different internal variable than the stamp method # because it doesn't keep historical state and we do -- that is, # we will always be comparing two timestamps, whereas - # stamp() just always wants the latest one. + # stamp just always wants the latest one. if tmp == @tstamp return false else @@ -40,7 +40,7 @@ module Puppet end @statted = 0 @stamp = nil - @tstamp = stamp() + @tstamp = stamp end # Retrieve the filestamp, but only refresh it if we're beyond our diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb index e841c7add..c47aa0d6f 100644 --- a/lib/puppet/util/log.rb +++ b/lib/puppet/util/log.rb @@ -118,7 +118,7 @@ class Puppet::Util::Log if type.instance_method(:initialize).arity == 1 @destinations[dest] = type.new(dest) else - @destinations[dest] = type.new() + @destinations[dest] = type.new end flushqueue @destinations[dest] diff --git a/lib/puppet/util/logging.rb b/lib/puppet/util/logging.rb index e514affd0..b4a531bfc 100644 --- a/lib/puppet/util/logging.rb +++ b/lib/puppet/util/logging.rb @@ -4,7 +4,7 @@ require 'puppet/util/log' module Puppet::Util::Logging def send_log(level, message) - Puppet::Util::Log.create({:level => level, :source => log_source(), :message => message}.merge(log_metadata)) + Puppet::Util::Log.create({:level => level, :source => log_source, :message => message}.merge(log_metadata)) end # Create a method for each log level. diff --git a/lib/puppet/util/queue.rb b/lib/puppet/util/queue.rb index 31425fbae..d09d32cec 100644 --- a/lib/puppet/util/queue.rb +++ b/lib/puppet/util/queue.rb @@ -29,7 +29,7 @@ require 'puppet/util/instance_loader' # +client+, which will return a class-wide singleton client instance, determined by +client_class+. # # The client plugins are expected to implement an interface similar to that of Stomp::Client: -# * new() should return a connected, ready-to-go client instance. Note that no arguments are passed in. +# * new should return a connected, ready-to-go client instance. Note that no arguments are passed in. # * send_message(queue, message) should send the _message_ to the specified _queue_. # * subscribe(queue) _block_ subscribes to _queue_ and executes _block_ upon receiving a message. # * _queue_ names are simple names independent of the message broker or client library. No "/queue/" prefixes like in Stomp::Client. diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb index 606d06cdd..b0ff98834 100644 --- a/lib/puppet/util/rdoc/parser.rb +++ b/lib/puppet/util/rdoc/parser.rb @@ -84,7 +84,7 @@ class Parser modpath = $1 name = $2 Puppet.debug "rdoc: module #{name} into #{modpath} ?" - Puppet::Module.modulepath().each do |mp| + Puppet::Module.modulepath.each do |mp| if File.identical?(modpath,mp) Puppet.debug "rdoc: found module #{name}" return name @@ -95,7 +95,7 @@ class Parser # there can be paths we don't want to scan under modules # imagine a ruby or manifest that would be distributed as part as a module # but we don't want those to be hosted under - Puppet::Module.modulepath().each do |mp| + Puppet::Module.modulepath.each do |mp| # check that fullpath is a descendant of mp dirname = fullpath while (dirname = File.dirname(dirname)) != '/' diff --git a/lib/puppet/util/reference.rb b/lib/puppet/util/reference.rb index fb4b84f7c..78304217c 100644 --- a/lib/puppet/util/reference.rb +++ b/lib/puppet/util/reference.rb @@ -171,7 +171,7 @@ class Puppet::Util::Reference text += @header - text += generate() + text += generate text += self.class.footer if withcontents diff --git a/lib/puppet/util/resource_template.rb b/lib/puppet/util/resource_template.rb index 164d75ae3..ceb9ea389 100644 --- a/lib/puppet/util/resource_template.rb +++ b/lib/puppet/util/resource_template.rb @@ -8,7 +8,7 @@ require 'erb' # This provides functionality essentially equivalent to # the language's template() function. You pass your file # path and the resource you want to use into the initialization -# method, then call result() on the instance, and you get back +# method, then call result on the instance, and you get back # a chunk of text. # The resource's parameters are available as instance variables # (as opposed to the language, where we use a method_missing trick). diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb index ab7e12d29..5aafd9c02 100644 --- a/lib/puppet/util/selinux.rb +++ b/lib/puppet/util/selinux.rb @@ -141,7 +141,7 @@ module Puppet::Util::SELinux mounts = "" begin if File.instance_methods.include? "read_nonblock" - # If possible we use read_nonblock() in a loop rather than read() to work- + # If possible we use read_nonblock in a loop rather than read to work- # a linux kernel bug. See ticket #1963 for details. mountfh = File.open("/proc/mounts") mounts += mountfh.read_nonblock(1024) while true @@ -184,7 +184,7 @@ module Puppet::Util::SELinux # Internal helper function to return which type of filesystem a # given file path resides on def find_fs(path) - unless mnts = read_mounts() + unless mnts = read_mounts return nil end diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index 80cab1976..5573145b5 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -308,7 +308,7 @@ class Puppet::Util::Settings # Create a timer so that this file will get checked automatically # and reparsed if necessary. - set_filetimeout_timer() + set_filetimeout_timer end # Unsafely parse the file -- this isn't thread-safe and causes plenty of problems if used directly. @@ -343,7 +343,7 @@ class Puppet::Util::Settings settings_with_hooks.each do |setting| each_source(env) do |source| if value = @values[source][setting.name] - # We still have to use value() to retrieve the value, since + # We still have to use value to retrieve the value, since # we want the fully interpolated value, not $vardir/lib or whatever. # This results in extra work, but so few of the settings # will have associated hooks that it ends up being less work this @@ -421,7 +421,7 @@ class Puppet::Util::Settings if file and file.changed? Puppet.notice "Reparsing #{file.file}" parse - reuse() + reuse end end @@ -557,7 +557,7 @@ class Puppet::Util::Settings # Create a timer to check whether the file should be reparsed. def set_filetimeout_timer return unless timeout = self[:filetimeout] and timeout = Integer(timeout) and timeout > 0 - timer = EventLoop::Timer.new(:interval => timeout, :tolerance => 1, :start? => true) { self.reparse() } + timer = EventLoop::Timer.new(:interval => timeout, :tolerance => 1, :start? => true) { self.reparse } end # Convert the settings we manage into a catalog full of resources that model those settings. @@ -688,7 +688,7 @@ if @config.include?(:run_mode) return nil unless @config.include?(param) # Yay, recursion. - #self.reparse() unless [:config, :filetimeout].include?(param) + #self.reparse unless [:config, :filetimeout].include?(param) # Check the cache first. It needs to be a per-environment # cache so that we don't spread values from one env diff --git a/lib/puppet/util/warnings.rb b/lib/puppet/util/warnings.rb index 3156b412c..355010842 100644 --- a/lib/puppet/util/warnings.rb +++ b/lib/puppet/util/warnings.rb @@ -11,7 +11,7 @@ module Puppet::Util::Warnings Puppet::Util::Warnings.maybe_log(msg, self.class) { Puppet.warning msg } end - def clear_warnings() + def clear_warnings @stampwarnings = {} nil end diff --git a/lib/puppet/util/zaml.rb b/lib/puppet/util/zaml.rb index 88c660cac..aff837077 100644 --- a/lib/puppet/util/zaml.rb +++ b/lib/puppet/util/zaml.rb @@ -1,7 +1,7 @@ # # ZAML -- A partial replacement for YAML, writen with speed and code clarity # in mind. ZAML fixes one YAML bug (loading Exceptions) and provides -# a replacement for YAML.dump() unimaginatively called ZAML.dump(), +# a replacement for YAML.dump unimaginatively called ZAML.dump, # which is faster on all known cases and an order of magnitude faster # with complex structures. # diff --git a/spec/integration/indirector/bucket_file/rest_spec.rb b/spec/integration/indirector/bucket_file/rest_spec.rb index 296b03eb6..94d6e3a62 100644 --- a/spec/integration/indirector/bucket_file/rest_spec.rb +++ b/spec/integration/indirector/bucket_file/rest_spec.rb @@ -63,6 +63,6 @@ describe "Filebucket REST Terminus" do @file_bucket_file.expects(:save) file_bucket_file = Puppet::FileBucket::File.new("pouet") - file_bucket_file.save() + file_bucket_file.save end end diff --git a/spec/integration/transaction_spec.rb b/spec/integration/transaction_spec.rb index 5b6cd52cb..1b8d7ecfd 100755 --- a/spec/integration/transaction_spec.rb +++ b/spec/integration/transaction_spec.rb @@ -179,7 +179,7 @@ describe Puppet::Transaction do end it "should still trigger skipped resources" do - catalog = mk_catalog() + catalog = mk_catalog catalog.add_resource(*Puppet::Type.type(:schedule).mkdefaultschedules) Puppet[:ignoreschedules] = false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c32fb7885..88e52281d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -37,7 +37,7 @@ Spec::Runner.configure do |config| # config.prepend_before :all do # setup_mocks_for_rspec -# setup() if respond_to? :setup +# setup if respond_to? :setup # end # config.prepend_after :each do diff --git a/spec/unit/agent_spec.rb b/spec/unit/agent_spec.rb index 0a7fd5715..446ec3df4 100755 --- a/spec/unit/agent_spec.rb +++ b/spec/unit/agent_spec.rb @@ -98,7 +98,7 @@ describe Puppet::Agent do it "should use Puppet::Application.controlled_run to manage process state behavior" do calls = sequence('calls') - Puppet::Application.expects(:controlled_run).yields().in_sequence(calls) + Puppet::Application.expects(:controlled_run).yields.in_sequence(calls) AgentTestClient.expects(:new).once.in_sequence(calls) @agent.run end diff --git a/spec/unit/file_serving/content_spec.rb b/spec/unit/file_serving/content_spec.rb index f772b861f..e86e26a00 100755 --- a/spec/unit/file_serving/content_spec.rb +++ b/spec/unit/file_serving/content_spec.rb @@ -93,12 +93,12 @@ describe Puppet::FileServing::Content, "when returning the contents" do end it "should fail if a path is not set" do - proc { @content.content() }.should raise_error(Errno::ENOENT) + proc { @content.content }.should raise_error(Errno::ENOENT) end it "should raise Errno::ENOENT if the file is absent" do @content.path = "/there/is/absolutely/no/chance/that/this/path/exists" - proc { @content.content() }.should raise_error(Errno::ENOENT) + proc { @content.content }.should raise_error(Errno::ENOENT) end it "should return the contents of the path if the file exists" do diff --git a/spec/unit/file_serving/metadata_spec.rb b/spec/unit/file_serving/metadata_spec.rb index a55396577..42bbf3b69 100755 --- a/spec/unit/file_serving/metadata_spec.rb +++ b/spec/unit/file_serving/metadata_spec.rb @@ -122,12 +122,12 @@ describe Puppet::FileServing::Metadata, " when finding the file to use for setti it "should use the set base path if one is not provided" do File.expects(:lstat).with(@path).returns @stat File.expects(:readlink).with(@path).returns "/what/ever" - @metadata.collect() + @metadata.collect end it "should raise an exception if the file does not exist" do File.expects(:lstat).with(@path).raises(Errno::ENOENT) - proc { @metadata.collect()}.should raise_error(Errno::ENOENT) + proc { @metadata.collect}.should raise_error(Errno::ENOENT) end end diff --git a/spec/unit/file_serving/mount/file_spec.rb b/spec/unit/file_serving/mount/file_spec.rb index 69660d62f..e77523fd5 100755 --- a/spec/unit/file_serving/mount/file_spec.rb +++ b/spec/unit/file_serving/mount/file_spec.rb @@ -81,7 +81,7 @@ describe Puppet::FileServing::Mount::File, " when substituting hostnames and ip it "should use local host information if no client data is provided" do stub_facter("myhost.mydomain.com") @mount.path = "/%h/%d/%H" - @mount.path().should == "/myhost/mydomain.com/myhost.mydomain.com" + @mount.path.should == "/myhost/mydomain.com/myhost.mydomain.com" end after do diff --git a/spec/unit/indirector/indirection_spec.rb b/spec/unit/indirector/indirection_spec.rb index 872daad11..8bcd9cd54 100755 --- a/spec/unit/indirector/indirection_spec.rb +++ b/spec/unit/indirector/indirection_spec.rb @@ -678,7 +678,7 @@ describe Puppet::Indirector::Indirection do it "should use the configured terminus class if no terminus name is specified" do Puppet::Indirector::Terminus.stubs(:terminus_class).with(:test, :foo).returns(@terminus_class) @indirection.terminus_class = :foo - @indirection.terminus().should equal(@terminus) + @indirection.terminus.should equal(@terminus) end after do @@ -770,7 +770,7 @@ describe Puppet::Indirector::Indirection do describe "and managing the cache terminus" do it "should not create a cache terminus at initialization" do # This is weird, because all of the code is in the setup. If we got - # new() called on the cache class, we'd get an exception here. + # new called on the cache class, we'd get an exception here. end it "should reuse the cache terminus" do diff --git a/spec/unit/indirector/node/exec_spec.rb b/spec/unit/indirector/node/exec_spec.rb index 09f13ab90..c4b3417a3 100755 --- a/spec/unit/indirector/node/exec_spec.rb +++ b/spec/unit/indirector/node/exec_spec.rb @@ -29,7 +29,7 @@ describe Puppet::Node::Exec do @name = "yay" Puppet::Node.expects(:new).with(@name).returns(@node) @result = {} - # Use a local variable so the reference is usable in the execute() definition. + # Use a local variable so the reference is usable in the execute definition. result = @result @searcher.meta_def(:execute) do |command| return YAML.dump(result) diff --git a/spec/unit/network/handler/fileserver_spec.rb b/spec/unit/network/handler/fileserver_spec.rb index 35da33278..371e75d24 100644 --- a/spec/unit/network/handler/fileserver_spec.rb +++ b/spec/unit/network/handler/fileserver_spec.rb @@ -12,7 +12,7 @@ describe Puppet::Network::Handler::FileServer do File.open(filename, "w") { |f| f.puts filename} end - def create_nested_file() + def create_nested_file dirname = File.join(@basedir, "nested_dir") Dir.mkdir(dirname) file = File.join(dirname, "nested_dir_file") @@ -20,7 +20,7 @@ describe Puppet::Network::Handler::FileServer do end before do - @basedir = File.join(Dir.tmpdir(), "test_network_handler") + @basedir = File.join(Dir.tmpdir, "test_network_handler") Dir.mkdir(@basedir) @file = File.join(@basedir, "aFile") @link = File.join(@basedir, "aLink") @@ -62,49 +62,49 @@ describe Puppet::Network::Handler::FileServer do end it "should list the contents of a nested directory" do - create_nested_file() + create_nested_file list = @mount.list("/", true, false) list.sort.should == [ ["/aFile", "file"], ["/", "directory"] , ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort end it "should list the contents of a directory ignoring files that match" do - create_nested_file() + create_nested_file list = @mount.list("/", true, "*File") list.sort.should == [ ["/", "directory"] , ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort end it "should list the contents of a directory ignoring directories that match" do - create_nested_file() + create_nested_file list = @mount.list("/", true, "*nested_dir") list.sort.should == [ ["/aFile", "file"], ["/", "directory"] ].sort end it "should list the contents of a directory ignoring all ignore patterns that match" do - create_nested_file() + create_nested_file list = @mount.list("/", true, ["*File" , "*nested_dir"]) list.should == [ ["/", "directory"] ] end it "should list the directory when recursing to a depth of zero" do - create_nested_file() + create_nested_file list = @mount.list("/", 0, false) list.should == [["/", "directory"]] end it "should list the base directory and files and nested directory to a depth of one" do - create_nested_file() + create_nested_file list = @mount.list("/", 1, false) list.sort.should == [ ["/aFile", "file"], ["/nested_dir", "directory"], ["/", "directory"] ].sort end it "should list the base directory and files and nested directory to a depth of two" do - create_nested_file() + create_nested_file list = @mount.list("/", 2, false) list.sort.should == [ ["/aFile", "file"], ["/", "directory"] , ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort end it "should list the base directory and files and nested directory to a depth greater than the directory structure" do - create_nested_file() + create_nested_file list = @mount.list("/", 42, false) list.sort.should == [ ["/aFile", "file"], ["/", "directory"] , ["/nested_dir", "directory"], ["/nested_dir/nested_dir_file", "file"]].sort end diff --git a/spec/unit/network/http/compression_spec.rb b/spec/unit/network/http/compression_spec.rb index 63fd9e715..ace1f353a 100644 --- a/spec/unit/network/http/compression_spec.rb +++ b/spec/unit/network/http/compression_spec.rb @@ -175,13 +175,13 @@ describe "http compression" do @inflater.expects(:inflate).raises(Zlib::DataError.new("not a zlib stream")) inflater = stub_everything 'inflater2' inflater.expects(:inflate).with("chunk").returns("uncompressed") - Zlib::Inflate.expects(:new).with().returns(inflater) + Zlib::Inflate.expects(:new).with.returns(inflater) @adapter.uncompress("chunk") end it "should raise the error the second time" do @inflater.expects(:inflate).raises(Zlib::DataError.new("not a zlib stream")) - Zlib::Inflate.expects(:new).with().returns(@inflater) + Zlib::Inflate.expects(:new).with.returns(@inflater) lambda { @adapter.uncompress("chunk") }.should raise_error end diff --git a/spec/unit/network/http/rack/rest_spec.rb b/spec/unit/network/http/rack/rest_spec.rb index b9d835284..fb4917d41 100755 --- a/spec/unit/network/http/rack/rest_spec.rb +++ b/spec/unit/network/http/rack/rest_spec.rb @@ -26,7 +26,7 @@ describe "Puppet::Network::HTTP::RackREST" do end before :each do - @response = Rack::Response.new() + @response = Rack::Response.new end def mk_req(uri, opts = {}) diff --git a/spec/unit/network/http/rack/xmlrpc_spec.rb b/spec/unit/network/http/rack/xmlrpc_spec.rb index abfe84ba6..f91f48390 100755 --- a/spec/unit/network/http/rack/xmlrpc_spec.rb +++ b/spec/unit/network/http/rack/xmlrpc_spec.rb @@ -39,7 +39,7 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do end before :each do - @response = Rack::Response.new() + @response = Rack::Response.new end def mk_req(opts = {}) @@ -86,13 +86,13 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do it "should set 'authenticated' to false if no certificate is present" do req = mk_req - Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| authenticated == false } + Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| authenticated == false } @handler.process(req, @response) end it "should use the client's ip address" do req = mk_req 'REMOTE_ADDR' => 'ipaddress' - Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| ip == 'ipaddress' } + Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| ip == 'ipaddress' } @handler.process(req, @response) end @@ -108,7 +108,7 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do it "should retrieve the hostname by matching the certificate parameter" do Puppet.settings.stubs(:value).returns "eh" Puppet.settings.expects(:value).with(:ssl_client_header).returns "myheader" - Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| node == "host.domain.com" } + Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| node == "host.domain.com" } req = mk_req "myheader" => "/CN=host.domain.com" @handler.process(req, @response) end @@ -123,7 +123,7 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do it "should consider the host authenticated if the validity parameter contains 'SUCCESS'" do Puppet.settings.stubs(:value).with(:ssl_client_header).returns "certheader" Puppet.settings.stubs(:value).with(:ssl_client_verify_header).returns "myheader" - Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| authenticated == true } + Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| authenticated == true } req = mk_req "myheader" => "SUCCESS", "certheader" => "/CN=host.domain.com" @handler.process(req, @response) end @@ -131,7 +131,7 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do it "should consider the host unauthenticated if the validity parameter does not contain 'SUCCESS'" do Puppet.settings.stubs(:value).with(:ssl_client_header).returns "certheader" Puppet.settings.stubs(:value).with(:ssl_client_verify_header).returns "myheader" - Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| authenticated == false } + Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| authenticated == false } req = mk_req "myheader" => "whatever", "certheader" => "/CN=host.domain.com" @handler.process(req, @response) end @@ -139,7 +139,7 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do it "should consider the host unauthenticated if no certificate information is present" do Puppet.settings.stubs(:value).with(:ssl_client_header).returns "certheader" Puppet.settings.stubs(:value).with(:ssl_client_verify_header).returns "myheader" - Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| authenticated == false } + Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| authenticated == false } req = mk_req "myheader" => nil, "certheader" => "/CN=host.domain.com" @handler.process(req, @response) end @@ -148,7 +148,7 @@ describe "Puppet::Network::HTTP::RackXMLRPC" do Puppet.settings.stubs(:value).returns "eh" Puppet.settings.expects(:value).with(:ssl_client_header).returns "myheader" Resolv.any_instance.expects(:getname).returns("host.domain.com") - Puppet::Network::ClientRequest.expects(:new).with() { |node,ip,authenticated| node == "host.domain.com" } + Puppet::Network::ClientRequest.expects(:new).with { |node,ip,authenticated| node == "host.domain.com" } req = mk_req "myheader" => nil @handler.process(req, @response) end diff --git a/spec/unit/network/http_pool_spec.rb b/spec/unit/network/http_pool_spec.rb index 7fe55c5fa..1d64f9c9c 100755 --- a/spec/unit/network/http_pool_spec.rb +++ b/spec/unit/network/http_pool_spec.rb @@ -19,7 +19,7 @@ describe Puppet::Network::HttpPool do it "should use the global SSL::Host instance to get its certificate information" do host = mock 'host' - Puppet::SSL::Host.expects(:localhost).with().returns host + Puppet::SSL::Host.expects(:localhost).with.returns host Puppet::Network::HttpPool.ssl_host.should equal(host) end diff --git a/spec/unit/network/rest_authconfig_spec.rb b/spec/unit/network/rest_authconfig_spec.rb index 2d41c3e5b..79fa968e8 100755 --- a/spec/unit/network/rest_authconfig_spec.rb +++ b/spec/unit/network/rest_authconfig_spec.rb @@ -81,7 +81,7 @@ describe Puppet::Network::RestAuthConfig do @authconfig.expects(:insert_default_acl) - @authconfig.parse() + @authconfig.parse end end diff --git a/spec/unit/network/server_spec.rb b/spec/unit/network/server_spec.rb index d981a7586..4ebbe0846 100755 --- a/spec/unit/network/server_spec.rb +++ b/spec/unit/network/server_spec.rb @@ -357,7 +357,7 @@ describe Puppet::Network::Server do end it "should require at least one namespace" do - lambda { @server.register_xmlrpc() }.should raise_error(ArgumentError) + lambda { @server.register_xmlrpc }.should raise_error(ArgumentError) end it "should allow multiple namespaces to be registered at once" do diff --git a/spec/unit/node/environment_spec.rb b/spec/unit/node/environment_spec.rb index 11f1c9ce1..29a4f0cf1 100755 --- a/spec/unit/node/environment_spec.rb +++ b/spec/unit/node/environment_spec.rb @@ -28,7 +28,7 @@ describe Puppet::Node::Environment do it "should use the default environment if no name is provided while initializing an environment" do Puppet.settings.expects(:value).with(:environment).returns("one") - Puppet::Node::Environment.new().name.should == :one + Puppet::Node::Environment.new.name.should == :one end it "should treat environment instances as singletons" do diff --git a/spec/unit/other/transbucket_spec.rb b/spec/unit/other/transbucket_spec.rb index a76195120..1224dfa9b 100755 --- a/spec/unit/other/transbucket_spec.rb +++ b/spec/unit/other/transbucket_spec.rb @@ -26,7 +26,7 @@ describe Puppet::TransBucket do end it "should accept TransBuckets into its children list" do - object = Puppet::TransBucket.new() + object = Puppet::TransBucket.new proc { @bucket.push(object) }.should_not raise_error @bucket.each do |o| o.should equal(object) diff --git a/spec/unit/parser/ast/arithmetic_operator_spec.rb b/spec/unit/parser/ast/arithmetic_operator_spec.rb index ad8d9947b..3ebd2691e 100755 --- a/spec/unit/parser/ast/arithmetic_operator_spec.rb +++ b/spec/unit/parser/ast/arithmetic_operator_spec.rb @@ -7,7 +7,7 @@ describe Puppet::Parser::AST::ArithmeticOperator do ast = Puppet::Parser::AST before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @one = stub 'lval', :safeevaluate => 1 @two = stub 'rval', :safeevaluate => 2 end diff --git a/spec/unit/parser/ast/astarray_spec.rb b/spec/unit/parser/ast/astarray_spec.rb index 1791c711c..b9453c967 100755 --- a/spec/unit/parser/ast/astarray_spec.rb +++ b/spec/unit/parser/ast/astarray_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::ASTArray do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should have a [] accessor" do diff --git a/spec/unit/parser/ast/asthash_spec.rb b/spec/unit/parser/ast/asthash_spec.rb index fc8e1c7ea..be3199b8a 100644 --- a/spec/unit/parser/ast/asthash_spec.rb +++ b/spec/unit/parser/ast/asthash_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::ASTHash do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should have a merge functionality" do diff --git a/spec/unit/parser/ast/boolean_operator_spec.rb b/spec/unit/parser/ast/boolean_operator_spec.rb index d8e9603e8..23073159a 100755 --- a/spec/unit/parser/ast/boolean_operator_spec.rb +++ b/spec/unit/parser/ast/boolean_operator_spec.rb @@ -7,7 +7,7 @@ describe Puppet::Parser::AST::BooleanOperator do ast = Puppet::Parser::AST before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @true_ast = ast::Boolean.new( :value => true) @false_ast = ast::Boolean.new( :value => false) end diff --git a/spec/unit/parser/ast/casestatement_spec.rb b/spec/unit/parser/ast/casestatement_spec.rb index 187dd5822..dca8e5adb 100755 --- a/spec/unit/parser/ast/casestatement_spec.rb +++ b/spec/unit/parser/ast/casestatement_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::CaseStatement do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end describe "when evaluating" do @@ -150,7 +150,7 @@ describe Puppet::Parser::AST::CaseStatement do tests.each do |should, values| values.each do |value| - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @scope.setvar("testparam", value) result = ast.evaluate(@scope) diff --git a/spec/unit/parser/ast/collexpr_spec.rb b/spec/unit/parser/ast/collexpr_spec.rb index 4dfc1e97a..2aefe2f9d 100755 --- a/spec/unit/parser/ast/collexpr_spec.rb +++ b/spec/unit/parser/ast/collexpr_spec.rb @@ -7,7 +7,7 @@ describe Puppet::Parser::AST::CollExpr do ast = Puppet::Parser::AST before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end describe "when evaluating with two operands" do diff --git a/spec/unit/parser/ast/comparison_operator_spec.rb b/spec/unit/parser/ast/comparison_operator_spec.rb index 51f4cc516..0ef9117af 100755 --- a/spec/unit/parser/ast/comparison_operator_spec.rb +++ b/spec/unit/parser/ast/comparison_operator_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::ComparisonOperator do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @one = stub 'one', :safeevaluate => "1" @two = stub 'two', :safeevaluate => "2" end diff --git a/spec/unit/parser/ast/ifstatement_spec.rb b/spec/unit/parser/ast/ifstatement_spec.rb index 83121cddd..c1f3305ea 100755 --- a/spec/unit/parser/ast/ifstatement_spec.rb +++ b/spec/unit/parser/ast/ifstatement_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::IfStatement do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end describe "when evaluating" do diff --git a/spec/unit/parser/ast/in_operator_spec.rb b/spec/unit/parser/ast/in_operator_spec.rb index 9d3cab712..15128d894 100644 --- a/spec/unit/parser/ast/in_operator_spec.rb +++ b/spec/unit/parser/ast/in_operator_spec.rb @@ -6,7 +6,7 @@ require 'puppet/parser/ast/in_operator' describe Puppet::Parser::AST::InOperator do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @lval = stub 'lval' @lval.stubs(:safeevaluate).with(@scope).returns("left") diff --git a/spec/unit/parser/ast/match_operator_spec.rb b/spec/unit/parser/ast/match_operator_spec.rb index 985cf60d5..e76d076a9 100755 --- a/spec/unit/parser/ast/match_operator_spec.rb +++ b/spec/unit/parser/ast/match_operator_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::MatchOperator do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @lval = stub 'lval' @lval.stubs(:safeevaluate).with(@scope).returns("this is a string") diff --git a/spec/unit/parser/ast/minus_spec.rb b/spec/unit/parser/ast/minus_spec.rb index 782fd3e0c..a2c5a785b 100755 --- a/spec/unit/parser/ast/minus_spec.rb +++ b/spec/unit/parser/ast/minus_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::Minus do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should evaluate its argument" do diff --git a/spec/unit/parser/ast/not_spec.rb b/spec/unit/parser/ast/not_spec.rb index a3bf0b85d..3e8b36183 100755 --- a/spec/unit/parser/ast/not_spec.rb +++ b/spec/unit/parser/ast/not_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::Not do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @true_ast = Puppet::Parser::AST::Boolean.new( :value => true) @false_ast = Puppet::Parser::AST::Boolean.new( :value => false) end diff --git a/spec/unit/parser/ast/resource_reference_spec.rb b/spec/unit/parser/ast/resource_reference_spec.rb index ee42694b9..a2a11e270 100755 --- a/spec/unit/parser/ast/resource_reference_spec.rb +++ b/spec/unit/parser/ast/resource_reference_spec.rb @@ -7,7 +7,7 @@ describe Puppet::Parser::AST::ResourceReference do ast = Puppet::Parser::AST before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end def newref(type, title) diff --git a/spec/unit/parser/ast/selector_spec.rb b/spec/unit/parser/ast/selector_spec.rb index f32310b92..e10849c4c 100755 --- a/spec/unit/parser/ast/selector_spec.rb +++ b/spec/unit/parser/ast/selector_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::Selector do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end describe "when evaluating" do diff --git a/spec/unit/parser/ast/vardef_spec.rb b/spec/unit/parser/ast/vardef_spec.rb index 369a9f847..e133b675e 100755 --- a/spec/unit/parser/ast/vardef_spec.rb +++ b/spec/unit/parser/ast/vardef_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::VarDef do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end describe "when evaluating" do diff --git a/spec/unit/parser/collector_spec.rb b/spec/unit/parser/collector_spec.rb index de5fc8015..c414207fa 100755 --- a/spec/unit/parser/collector_spec.rb +++ b/spec/unit/parser/collector_spec.rb @@ -337,7 +337,7 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do end it "should convert all found resources into parser resources" do - stub_rails() + stub_rails Puppet::Rails::Host.stubs(:find_by_name).returns(nil) one = stub 'one', :restype => "Mytype", :title => "one", :virtual? => true, :exported? => true, :ref => "one" @@ -358,7 +358,7 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do end it "should override all exported collected resources if collector has an override" do - stub_rails() + stub_rails Puppet::Rails::Host.stubs(:find_by_name).returns(nil) one = stub 'one', :restype => "Mytype", :title => "one", :virtual? => true, :exported? => true, :ref => "one" @@ -387,7 +387,7 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do end it "should store converted resources in the compile's resource list" do - stub_rails() + stub_rails Puppet::Rails::Host.stubs(:find_by_name).returns(nil) one = stub 'one', :restype => "Mytype", :title => "one", :virtual? => true, :exported? => true, :ref => "one" @@ -409,7 +409,7 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do # This way one host doesn't store another host's resources as exported. it "should mark resources collected from the database as not exported" do - stub_rails() + stub_rails Puppet::Rails::Host.stubs(:find_by_name).returns(nil) one = stub 'one', :restype => "Mytype", :title => "one", :virtual? => true, :exported? => true, :ref => "one" @@ -430,7 +430,7 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do end it "should fail if an equivalent resource already exists in the compile" do - stub_rails() + stub_rails Puppet::Rails::Host.stubs(:find_by_name).returns(nil) rails = stub 'one', :restype => "Mytype", :title => "one", :virtual? => true, :exported? => true, :id => 1, :ref => "yay" @@ -449,7 +449,7 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do end it "should ignore exported resources that match already-collected resources" do - stub_rails() + stub_rails Puppet::Rails::Host.stubs(:find_by_name).returns(nil) rails = stub 'one', :restype => "Mytype", :title => "one", :virtual? => true, :exported? => true, :id => 1, :ref => "yay" diff --git a/spec/unit/parser/functions/fqdn_rand_spec.rb b/spec/unit/parser/functions/fqdn_rand_spec.rb index cde899eef..07390ed42 100644 --- a/spec/unit/parser/functions/fqdn_rand_spec.rb +++ b/spec/unit/parser/functions/fqdn_rand_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the fqdn_rand function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/generate_spec.rb b/spec/unit/parser/functions/generate_spec.rb index 75a5d6dac..27a11aabf 100755 --- a/spec/unit/parser/functions/generate_spec.rb +++ b/spec/unit/parser/functions/generate_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the generate function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/inline_template_spec.rb b/spec/unit/parser/functions/inline_template_spec.rb index 19e1a3b2a..1da85513a 100755 --- a/spec/unit/parser/functions/inline_template_spec.rb +++ b/spec/unit/parser/functions/inline_template_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the inline_template function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/realize_spec.rb b/spec/unit/parser/functions/realize_spec.rb index d9c94b143..4a55ad417 100755 --- a/spec/unit/parser/functions/realize_spec.rb +++ b/spec/unit/parser/functions/realize_spec.rb @@ -6,7 +6,7 @@ describe "the realize function" do before :each do @collector = stub_everything 'collector' - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @compiler = stub 'compiler' @compiler.stubs(:add_collection).with(@collector) @scope.stubs(:compiler).returns(@compiler) diff --git a/spec/unit/parser/functions/regsubst_spec.rb b/spec/unit/parser/functions/regsubst_spec.rb index 6ff619f8d..d87b4d9ab 100755 --- a/spec/unit/parser/functions/regsubst_spec.rb +++ b/spec/unit/parser/functions/regsubst_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the regsubst function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/require_spec.rb b/spec/unit/parser/functions/require_spec.rb index 45769ccbe..48769d16c 100755 --- a/spec/unit/parser/functions/require_spec.rb +++ b/spec/unit/parser/functions/require_spec.rb @@ -8,7 +8,7 @@ describe "the require function" do @catalog = stub 'catalog' @compiler = stub 'compiler', :catalog => @catalog - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @scope.stubs(:findresource) @scope.stubs(:compiler).returns(@compiler) @klass = stub 'class', :name => "myclass" diff --git a/spec/unit/parser/functions/shellquote_spec.rb b/spec/unit/parser/functions/shellquote_spec.rb index 8286be32e..e4eeaeba8 100755 --- a/spec/unit/parser/functions/shellquote_spec.rb +++ b/spec/unit/parser/functions/shellquote_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the shellquote function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/split_spec.rb b/spec/unit/parser/functions/split_spec.rb index 3d0240af4..d76c253b0 100755 --- a/spec/unit/parser/functions/split_spec.rb +++ b/spec/unit/parser/functions/split_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the split function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/sprintf_spec.rb b/spec/unit/parser/functions/sprintf_spec.rb index 71921e0e0..3795479e4 100755 --- a/spec/unit/parser/functions/sprintf_spec.rb +++ b/spec/unit/parser/functions/sprintf_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the sprintf function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/tag_spec.rb b/spec/unit/parser/functions/tag_spec.rb index 5fb467e59..4f08afedf 100755 --- a/spec/unit/parser/functions/tag_spec.rb +++ b/spec/unit/parser/functions/tag_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the 'tag' function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/template_spec.rb b/spec/unit/parser/functions/template_spec.rb index 8fc64d0c3..87c7d5d24 100755 --- a/spec/unit/parser/functions/template_spec.rb +++ b/spec/unit/parser/functions/template_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the template function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/versioncmp_spec.rb b/spec/unit/parser/functions/versioncmp_spec.rb index 0595f8711..d57ea57ad 100755 --- a/spec/unit/parser/functions/versioncmp_spec.rb +++ b/spec/unit/parser/functions/versioncmp_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the versioncmp function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions_spec.rb b/spec/unit/parser/functions_spec.rb index f605052b5..ee551a147 100644 --- a/spec/unit/parser/functions_spec.rb +++ b/spec/unit/parser/functions_spec.rb @@ -25,7 +25,7 @@ describe Puppet::Parser::Functions do end it "should use the current default environment if no environment is provided" do - Puppet::Parser::Functions.environment_module().should be_instance_of(Module) + Puppet::Parser::Functions.environment_module.should be_instance_of(Module) end describe "when calling newfunction" do diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb index d583d4938..c31b1b275 100755 --- a/spec/unit/parser/lexer_spec.rb +++ b/spec/unit/parser/lexer_spec.rb @@ -134,7 +134,7 @@ end describe Puppet::Parser::Lexer::TOKENS do before do - @lexer = Puppet::Parser::Lexer.new() + @lexer = Puppet::Parser::Lexer.new end { @@ -562,7 +562,7 @@ describe "Puppet::Parser::Lexer in the old tests" do end it "should fail if the string is not set" do - lambda { @lexer.fullscan() }.should raise_error(Puppet::LexError) + lambda { @lexer.fullscan }.should raise_error(Puppet::LexError) end it "should correctly identify keywords" do @@ -630,11 +630,11 @@ require 'puppettest/support/utils' describe "Puppet::Parser::Lexer in the old tests when lexing example files" do extend PuppetTest extend PuppetTest::Support::Utils - textfiles() do |file| + textfiles do |file| it "should correctly lex #{file}" do - lexer = Puppet::Parser::Lexer.new() + lexer = Puppet::Parser::Lexer.new lexer.file = file - lambda { lexer.fullscan() }.should_not raise_error + lambda { lexer.fullscan }.should_not raise_error end end end diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb index 53a16e62a..42d515d29 100755 --- a/spec/unit/parser/parser_spec.rb +++ b/spec/unit/parser/parser_spec.rb @@ -254,7 +254,7 @@ describe Puppet::Parser do end it "should not include the docs by default" do - @parser.ast_context()[:doc].should be_nil + @parser.ast_context[:doc].should be_nil end end diff --git a/spec/unit/parser/scope_spec.rb b/spec/unit/parser/scope_spec.rb index ed965af14..035d49c84 100755 --- a/spec/unit/parser/scope_spec.rb +++ b/spec/unit/parser/scope_spec.rb @@ -4,10 +4,10 @@ require File.dirname(__FILE__) + '/../../spec_helper' describe Puppet::Parser::Scope do before :each do - @topscope = Puppet::Parser::Scope.new() + @topscope = Puppet::Parser::Scope.new # This is necessary so we don't try to use the compiler to discover our parent. @topscope.parent = nil - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @scope.compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("foo")) @scope.parent = @topscope end @@ -72,7 +72,7 @@ describe Puppet::Parser::Scope do Puppet::Parser::Functions.expects(:environment_module).with(nil).returns mod - Puppet::Parser::Scope.new().singleton_class.ancestors.should be_include(mod) + Puppet::Parser::Scope.new.singleton_class.ancestors.should be_include(mod) end end diff --git a/spec/unit/parser/templatewrapper_spec.rb b/spec/unit/parser/templatewrapper_spec.rb index 9a16666fd..a684727de 100755 --- a/spec/unit/parser/templatewrapper_spec.rb +++ b/spec/unit/parser/templatewrapper_spec.rb @@ -96,20 +96,20 @@ describe Puppet::Parser::TemplateWrapper do catalog = mock 'catalog', :classes => ["class1", "class2"] @scope.expects(:catalog).returns( catalog ) tw = Puppet::Parser::TemplateWrapper.new(@scope) - tw.classes().should == ["class1", "class2"] + tw.classes.should == ["class1", "class2"] end it "should allow you to retrieve all the tags with all_tags" do catalog = mock 'catalog', :tags => ["tag1", "tag2"] @scope.expects(:catalog).returns( catalog ) tw = Puppet::Parser::TemplateWrapper.new(@scope) - tw.all_tags().should == ["tag1","tag2"] + tw.all_tags.should == ["tag1","tag2"] end it "should allow you to retrieve the tags defined in the current scope" do @scope.expects(:tags).returns( ["tag1", "tag2"] ) tw = Puppet::Parser::TemplateWrapper.new(@scope) - tw.tags().should == ["tag1","tag2"] + tw.tags.should == ["tag1","tag2"] end it "should set all of the scope's variables as instance variables" do diff --git a/spec/unit/provider/augeas/augeas_spec.rb b/spec/unit/provider/augeas/augeas_spec.rb index 22f7bed8c..47655a753 100644 --- a/spec/unit/provider/augeas/augeas_spec.rb +++ b/spec/unit/provider/augeas/augeas_spec.rb @@ -64,7 +64,7 @@ describe provider_class do # This is not supported in the new parsing class #it "should concat the last values" do - # provider = provider_class.new() + # provider = provider_class.new # tokens = provider.parse_commands("set /Jar/Jar Binks is my copilot") # tokens.size.should == 1 # tokens[0].size.should == 3 @@ -165,7 +165,7 @@ describe provider_class do describe "get filters" do before do augeas_stub = stub("augeas", :get => "value") - @provider = provider_class.new() + @provider = provider_class.new @provider.aug= augeas_stub end diff --git a/spec/unit/provider/confine/false_spec.rb b/spec/unit/provider/confine/false_spec.rb index 6ff5cc133..425aa3077 100755 --- a/spec/unit/provider/confine/false_spec.rb +++ b/spec/unit/provider/confine/false_spec.rb @@ -10,7 +10,7 @@ describe Puppet::Provider::Confine::False do end it "should require a value" do - lambda { Puppet::Provider::Confine.new() }.should raise_error(ArgumentError) + lambda { Puppet::Provider::Confine.new }.should raise_error(ArgumentError) end describe "when testing values" do diff --git a/spec/unit/provider/confine/feature_spec.rb b/spec/unit/provider/confine/feature_spec.rb index 67e59363e..1db81ba44 100755 --- a/spec/unit/provider/confine/feature_spec.rb +++ b/spec/unit/provider/confine/feature_spec.rb @@ -10,7 +10,7 @@ describe Puppet::Provider::Confine::Feature do end it "should require a value" do - lambda { Puppet::Provider::Confine::Feature.new() }.should raise_error(ArgumentError) + lambda { Puppet::Provider::Confine::Feature.new }.should raise_error(ArgumentError) end it "should always convert values to an array" do diff --git a/spec/unit/provider/confine/true_spec.rb b/spec/unit/provider/confine/true_spec.rb index 75b36cea5..2675afe75 100755 --- a/spec/unit/provider/confine/true_spec.rb +++ b/spec/unit/provider/confine/true_spec.rb @@ -10,7 +10,7 @@ describe Puppet::Provider::Confine::True do end it "should require a value" do - lambda { Puppet::Provider::Confine::True.new() }.should raise_error(ArgumentError) + lambda { Puppet::Provider::Confine::True.new }.should raise_error(ArgumentError) end describe "when testing values" do diff --git a/spec/unit/provider/confine/variable_spec.rb b/spec/unit/provider/confine/variable_spec.rb index 7a71fc1ae..e554ac036 100755 --- a/spec/unit/provider/confine/variable_spec.rb +++ b/spec/unit/provider/confine/variable_spec.rb @@ -10,7 +10,7 @@ describe Puppet::Provider::Confine::Variable do end it "should require a value" do - lambda { Puppet::Provider::Confine::Variable.new() }.should raise_error(ArgumentError) + lambda { Puppet::Provider::Confine::Variable.new }.should raise_error(ArgumentError) end it "should always convert values to an array" do diff --git a/spec/unit/provider/confine_spec.rb b/spec/unit/provider/confine_spec.rb index 626f79b27..2e0637243 100755 --- a/spec/unit/provider/confine_spec.rb +++ b/spec/unit/provider/confine_spec.rb @@ -6,7 +6,7 @@ require 'puppet/provider/confine' describe Puppet::Provider::Confine do it "should require a value" do - lambda { Puppet::Provider::Confine.new() }.should raise_error(ArgumentError) + lambda { Puppet::Provider::Confine.new }.should raise_error(ArgumentError) end it "should always convert values to an array" do diff --git a/spec/unit/provider/macauthorization_spec.rb b/spec/unit/provider/macauthorization_spec.rb index 8e0ba2456..b462be140 100755 --- a/spec/unit/provider/macauthorization_spec.rb +++ b/spec/unit/provider/macauthorization_spec.rb @@ -111,13 +111,13 @@ describe provider_class do end it "should read and write to the auth database with the right arguments" do - @provider.expects(:execute).with() { |cmds, args| + @provider.expects(:execute).with { |cmds, args| cmds.include?("read") and cmds.include?(@authname) and args[:combine] == false }.once - @provider.expects(:execute).with() { |cmds, args| + @provider.expects(:execute).with { |cmds, args| cmds.include?("write") and cmds.include?(@authname) and args[:combine] == false and diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index d0ec4723c..dfc2c0e7b 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -47,7 +47,7 @@ module ParsedMountTesting end def mkmount - hash = mkmountargs() + hash = mkmountargs #hash[:provider] = @provider_class.name fakeresource = stub :type => :mount, :name => hash[:name] diff --git a/spec/unit/ssl/host_spec.rb b/spec/unit/ssl/host_spec.rb index 18cae2b62..0b6591d60 100755 --- a/spec/unit/ssl/host_spec.rb +++ b/spec/unit/ssl/host_spec.rb @@ -289,7 +289,7 @@ describe Puppet::SSL::Host do it "should downcase the certname if it's used" do Puppet.settings.expects(:value).with(:certname).returns "Host.Domain.Com" - Puppet::SSL::Host.new().name.should == "host.domain.com" + Puppet::SSL::Host.new.name.should == "host.domain.com" end it "should indicate that it is a CA host if its name matches the ca_name constant" do diff --git a/spec/unit/transaction/change_spec.rb b/spec/unit/transaction/change_spec.rb index 9419bbab9..10a7aaed9 100755 --- a/spec/unit/transaction/change_spec.rb +++ b/spec/unit/transaction/change_spec.rb @@ -13,7 +13,7 @@ describe Puppet::Transaction::Change do end it "should require the property and current value" do - lambda { Change.new() }.should raise_error + lambda { Change.new }.should raise_error end it "should set its property to the provided property" do diff --git a/spec/unit/util/ldap/generator_spec.rb b/spec/unit/util/ldap/generator_spec.rb index a6c69de83..8086dd995 100755 --- a/spec/unit/util/ldap/generator_spec.rb +++ b/spec/unit/util/ldap/generator_spec.rb @@ -40,7 +40,7 @@ describe Puppet::Util::Ldap::Generator do it "should run the provided block when asked to generate the value" do @generator.with { "yayness" } - @generator.generate().should == "yayness" + @generator.generate.should == "yayness" end it "should pass in any provided value to the block" do diff --git a/spec/unit/util/ldap/manager_spec.rb b/spec/unit/util/ldap/manager_spec.rb index b18b1b933..bc6b18d01 100755 --- a/spec/unit/util/ldap/manager_spec.rb +++ b/spec/unit/util/ldap/manager_spec.rb @@ -113,7 +113,7 @@ describe Puppet::Util::Ldap::Manager do it "should not pass in any value if no source attribute is specified" do @generator.stubs(:source).returns nil @manager.generates(:myparam) - @generator.expects(:generate).with().returns %w{double yay} + @generator.expects(:generate).with.returns %w{double yay} @manager.generate "one" => "yay" end diff --git a/spec/unit/util/rdoc/parser_spec.rb b/spec/unit/util/rdoc/parser_spec.rb index d30c0c13b..a0203726c 100755 --- a/spec/unit/util/rdoc/parser_spec.rb +++ b/spec/unit/util/rdoc/parser_spec.rb @@ -392,11 +392,11 @@ describe RDoc::Parser do it "should also scan mono-instruction code" do @class.expects(:add_realize).with { |i| i.is_a?(RDoc::Include) and i.name == "File[\"/tmp/a\"]" and i.comment == "mydoc" } - @parser.scan_for_realize(@class,create_stmt()) + @parser.scan_for_realize(@class,create_stmt) end it "should register recursively includes to the current container" do - @code.stubs(:children).returns([ create_stmt() ]) + @code.stubs(:children).returns([ create_stmt ]) @class.expects(:add_realize).with { |i| i.is_a?(RDoc::Include) and i.name == "File[\"/tmp/a\"]" and i.comment == "mydoc" } @parser.scan_for_realize(@class, [@code]) diff --git a/spec/unit/util/selinux_spec.rb b/spec/unit/util/selinux_spec.rb index 45bc3b433..096534770 100755 --- a/spec/unit/util/selinux_spec.rb +++ b/spec/unit/util/selinux_spec.rb @@ -42,7 +42,7 @@ describe Puppet::Util::SELinux do end it "should parse the contents of /proc/mounts" do - read_mounts().should == { + read_mounts.should == { '/' => 'ext3', '/sys' => 'sysfs', '/mnt/nfs' => 'nfs', diff --git a/spec/unit/util/storage_spec.rb b/spec/unit/util/storage_spec.rb index ce5bd202a..c91702dfb 100755 --- a/spec/unit/util/storage_spec.rb +++ b/spec/unit/util/storage_spec.rb @@ -11,7 +11,7 @@ describe Puppet::Util::Storage do before(:all) do @basepath = Puppet.features.posix? ? "/somepath" : "C:/somepath" - Puppet[:statedir] = Dir.tmpdir() + Puppet[:statedir] = Dir.tmpdir end after(:all) do @@ -19,7 +19,7 @@ describe Puppet::Util::Storage do end before(:each) do - Puppet::Util::Storage.clear() + Puppet::Util::Storage.clear end describe "when caching a symbol" do @@ -30,14 +30,14 @@ describe Puppet::Util::Storage do it "should add the symbol to its internal state" do Puppet::Util::Storage.cache(:yayness) - Puppet::Util::Storage.state().should == {:yayness=>{}} + Puppet::Util::Storage.state.should == {:yayness=>{}} end it "should not clobber existing state when caching additional objects" do Puppet::Util::Storage.cache(:yayness) - Puppet::Util::Storage.state().should == {:yayness=>{}} + Puppet::Util::Storage.state.should == {:yayness=>{}} Puppet::Util::Storage.cache(:bubblyness) - Puppet::Util::Storage.state().should == {:yayness=>{},:bubblyness=>{}} + Puppet::Util::Storage.state.should == {:yayness=>{},:bubblyness=>{}} end end @@ -53,11 +53,11 @@ describe Puppet::Util::Storage do end it "should add the resource ref to its internal state" do - Puppet::Util::Storage.state().should == {} + Puppet::Util::Storage.state.should == {} Puppet::Util::Storage.cache(@file_test) - Puppet::Util::Storage.state().should == {"File[#{@basepath}/yayness]"=>{}} + Puppet::Util::Storage.state.should == {"File[#{@basepath}/yayness]"=>{}} Puppet::Util::Storage.cache(@exec_test) - Puppet::Util::Storage.state().should == {"File[#{@basepath}/yayness]"=>{}, "Exec[#{@basepath}/bin/ls /yayness]"=>{}} + Puppet::Util::Storage.state.should == {"File[#{@basepath}/yayness]"=>{}, "Exec[#{@basepath}/bin/ls /yayness]"=>{}} end end @@ -71,9 +71,9 @@ describe Puppet::Util::Storage do it "should clear its internal state when clear() is called" do Puppet::Util::Storage.cache(:yayness) - Puppet::Util::Storage.state().should == {:yayness=>{}} - Puppet::Util::Storage.clear() - Puppet::Util::Storage.state().should == {} + Puppet::Util::Storage.state.should == {:yayness=>{}} + Puppet::Util::Storage.clear + Puppet::Util::Storage.state.should == {} end describe "when loading from the state file" do @@ -89,23 +89,23 @@ describe Puppet::Util::Storage do end it "should not fail to load()" do - FileTest.exists?(@path).should be_false() + FileTest.exists?(@path).should be_false Puppet[:statedir] = @path - proc { Puppet::Util::Storage.load() }.should_not raise_error() + proc { Puppet::Util::Storage.load }.should_not raise_error Puppet[:statefile] = @path - proc { Puppet::Util::Storage.load() }.should_not raise_error() + proc { Puppet::Util::Storage.load }.should_not raise_error end it "should not lose its internal state when load() is called" do - FileTest.exists?(@path).should be_false() + FileTest.exists?(@path).should be_false Puppet::Util::Storage.cache(:yayness) - Puppet::Util::Storage.state().should == {:yayness=>{}} + Puppet::Util::Storage.state.should == {:yayness=>{}} Puppet[:statefile] = @path - proc { Puppet::Util::Storage.load() }.should_not raise_error() + proc { Puppet::Util::Storage.load }.should_not raise_error - Puppet::Util::Storage.state().should == {:yayness=>{}} + Puppet::Util::Storage.state.should == {:yayness=>{}} end end @@ -113,41 +113,41 @@ describe Puppet::Util::Storage do before(:each) do @state_file = Tempfile.new('storage_test') @saved_statefile = Puppet[:statefile] - Puppet[:statefile] = @state_file.path() + Puppet[:statefile] = @state_file.path end it "should overwrite its internal state if load() is called" do # Should the state be overwritten even if Puppet[:statefile] is not valid YAML? Puppet::Util::Storage.cache(:yayness) - Puppet::Util::Storage.state().should == {:yayness=>{}} + Puppet::Util::Storage.state.should == {:yayness=>{}} - proc { Puppet::Util::Storage.load() }.should_not raise_error() - Puppet::Util::Storage.state().should == {} + proc { Puppet::Util::Storage.load }.should_not raise_error + Puppet::Util::Storage.state.should == {} end it "should restore its internal state if the state file contains valid YAML" do test_yaml = {'File["/yayness"]'=>{"name"=>{:a=>:b,:c=>:d}}} YAML.expects(:load).returns(test_yaml) - proc { Puppet::Util::Storage.load() }.should_not raise_error() - Puppet::Util::Storage.state().should == test_yaml + proc { Puppet::Util::Storage.load }.should_not raise_error + Puppet::Util::Storage.state.should == test_yaml end it "should initialize with a clear internal state if the state file does not contain valid YAML" do @state_file.write(:booness) - @state_file.flush() + @state_file.flush - proc { Puppet::Util::Storage.load() }.should_not raise_error() - Puppet::Util::Storage.state().should == {} + proc { Puppet::Util::Storage.load }.should_not raise_error + Puppet::Util::Storage.state.should == {} end it "should raise an error if the state file does not contain valid YAML and cannot be renamed" do @state_file.write(:booness) - @state_file.flush() + @state_file.flush YAML.expects(:load).raises(Puppet::Error) File.expects(:rename).raises(SystemCallError) - proc { Puppet::Util::Storage.load() }.should raise_error() + proc { Puppet::Util::Storage.load }.should raise_error end it "should attempt to rename the state file if the file is corrupted" do @@ -155,14 +155,14 @@ describe Puppet::Util::Storage do YAML.expects(:load).raises(Puppet::Error) File.expects(:rename).at_least_once - proc { Puppet::Util::Storage.load() }.should_not raise_error() + proc { Puppet::Util::Storage.load }.should_not raise_error end it "should fail gracefully on load() if the state file is not a regular file" do @state_file.close!() Dir.mkdir(Puppet[:statefile]) - proc { Puppet::Util::Storage.load() }.should_not raise_error() + proc { Puppet::Util::Storage.load }.should_not raise_error Dir.rmdir(Puppet[:statefile]) end @@ -172,8 +172,8 @@ describe Puppet::Util::Storage do test_yaml = {'File["/yayness"]'=>{"name"=>{:a=>:b,:c=>:d}}} YAML.expects(:load).returns(test_yaml) - proc { Puppet::Util::Storage.load() }.should_not raise_error() - Puppet::Util::Storage.state().should == test_yaml + proc { Puppet::Util::Storage.load }.should_not raise_error + Puppet::Util::Storage.state.should == test_yaml end after(:each) do @@ -187,16 +187,16 @@ describe Puppet::Util::Storage do before(:each) do @state_file = Tempfile.new('storage_test') @saved_statefile = Puppet[:statefile] - Puppet[:statefile] = @state_file.path() + Puppet[:statefile] = @state_file.path end it "should create the state file if it does not exist" do @state_file.close!() - FileTest.exists?(Puppet[:statefile]).should be_false() + FileTest.exists?(Puppet[:statefile]).should be_false Puppet::Util::Storage.cache(:yayness) - proc { Puppet::Util::Storage.store() }.should_not raise_error() - FileTest.exists?(Puppet[:statefile]).should be_true() + proc { Puppet::Util::Storage.store }.should_not raise_error + FileTest.exists?(Puppet[:statefile]).should be_true end it "should raise an exception if the state file is not a regular file" do @@ -204,7 +204,7 @@ describe Puppet::Util::Storage do Dir.mkdir(Puppet[:statefile]) Puppet::Util::Storage.cache(:yayness) - proc { Puppet::Util::Storage.store() }.should raise_error() + proc { Puppet::Util::Storage.store }.should raise_error Dir.rmdir(Puppet[:statefile]) end @@ -213,18 +213,18 @@ describe Puppet::Util::Storage do Puppet::Util::FileLocking.expects(:writelock).yields(false) Puppet::Util::Storage.cache(:yayness) - proc { Puppet::Util::Storage.store() }.should raise_error() + proc { Puppet::Util::Storage.store }.should raise_error end it "should load() the same information that it store()s" do Puppet::Util::Storage.cache(:yayness) - Puppet::Util::Storage.state().should == {:yayness=>{}} - proc { Puppet::Util::Storage.store() }.should_not raise_error() - Puppet::Util::Storage.clear() - Puppet::Util::Storage.state().should == {} - proc { Puppet::Util::Storage.load() }.should_not raise_error() - Puppet::Util::Storage.state().should == {:yayness=>{}} + Puppet::Util::Storage.state.should == {:yayness=>{}} + proc { Puppet::Util::Storage.store }.should_not raise_error + Puppet::Util::Storage.clear + Puppet::Util::Storage.state.should == {} + proc { Puppet::Util::Storage.load }.should_not raise_error + Puppet::Util::Storage.state.should == {:yayness=>{}} end after(:each) do diff --git a/spec/unit/util/warnings_spec.rb b/spec/unit/util/warnings_spec.rb index 4ce03ebe6..7cdee007f 100755 --- a/spec/unit/util/warnings_spec.rb +++ b/spec/unit/util/warnings_spec.rb @@ -34,6 +34,6 @@ describe Puppet::Util::Warnings do end after(:each) do - Puppet::Util::Warnings.clear_warnings() + Puppet::Util::Warnings.clear_warnings end end diff --git a/test/certmgr/certmgr.rb b/test/certmgr/certmgr.rb index 307420d6c..3cf743a85 100755 --- a/test/certmgr/certmgr.rb +++ b/test/certmgr/certmgr.rb @@ -32,7 +32,7 @@ class TestCertMgr < Test::Unit::TestCase ) } assert_nothing_raised { - cert = newcert.call() + cert = newcert.call } assert_nothing_raised { cert.mkselfsigned @@ -53,7 +53,7 @@ class TestCertMgr < Test::Unit::TestCase } assert_nothing_raised { - cert = newcert.call() + cert = newcert.call } assert_nothing_raised { cert.mkselfsigned @@ -110,13 +110,13 @@ class TestCertMgr < Test::Unit::TestCase def testCreateCA ca = nil assert_nothing_raised { - ca = Puppet::SSLCertificates::CA.new() + ca = Puppet::SSLCertificates::CA.new } # make the CA again and verify it doesn't fail because everything # still exists assert_nothing_raised { - ca = Puppet::SSLCertificates::CA.new() + ca = Puppet::SSLCertificates::CA.new } end diff --git a/test/certmgr/inventory.rb b/test/certmgr/inventory.rb index 71035ba03..1b2caf2c7 100755 --- a/test/certmgr/inventory.rb +++ b/test/certmgr/inventory.rb @@ -54,7 +54,7 @@ class TestCertInventory < Test::Unit::TestCase cert = mksignedcert(ca, "host.domain.com") assert_nothing_raised do - file = mock() + file = mock file.expects(:puts).with do |written| written.include? cert.subject.to_s end diff --git a/test/language/functions.rb b/test/language/functions.rb index 83bfe6e8e..eedcd35b0 100755 --- a/test/language/functions.rb +++ b/test/language/functions.rb @@ -173,7 +173,7 @@ class TestLangFunctions < Test::Unit::TestCase # Now make sure we can fully qualify files, and specify just one def test_singletemplates - template = tempfile() + template = tempfile File.open(template, "w") do |f| f.puts "template <%= @yay.nil?() ? raise('yay undefined') : @yay %>" @@ -215,7 +215,7 @@ class TestLangFunctions < Test::Unit::TestCase # Make sure that legacy template variable access works as expected. def test_legacyvariables - template = tempfile() + template = tempfile File.open(template, "w") do |f| f.puts "template <%= deprecated %>" @@ -257,7 +257,7 @@ class TestLangFunctions < Test::Unit::TestCase # Make sure that problems with kernel method visibility still exist. def test_kernel_module_shadows_deprecated_var_lookup - template = tempfile() + template = tempfile File.open(template, "w").puts("<%= binding %>") func = nil @@ -283,7 +283,7 @@ class TestLangFunctions < Test::Unit::TestCase end def test_tempatefunction_cannot_see_scopes - template = tempfile() + template = tempfile File.open(template, "w") do |f| f.puts "<%= lookupvar('myvar') %>" @@ -312,13 +312,13 @@ class TestLangFunctions < Test::Unit::TestCase end def test_template_reparses - template = tempfile() + template = tempfile File.open(template, "w") do |f| f.puts "original text" end - file = tempfile() + file = tempfile Puppet[:code] = %{file { "#{file}": content => template("#{template}") }} Puppet[:environment] = "yay" @@ -355,7 +355,7 @@ class TestLangFunctions < Test::Unit::TestCase end def test_template_defined_vars - template = tempfile() + template = tempfile File.open(template, "w") do |f| f.puts "template <%= @yayness %>" @@ -400,7 +400,7 @@ class TestLangFunctions < Test::Unit::TestCase #assert_equal(false, Puppet::Parser::Functions.function(:autofunc), # "Got told autofunc already exists") - dir = tempfile() + dir = tempfile $LOAD_PATH << dir newpath = File.join(dir, "puppet", "parser", "functions") FileUtils.mkdir_p(newpath) diff --git a/test/language/parser.rb b/test/language/parser.rb index a6ce8cf3f..70827634f 100755 --- a/test/language/parser.rb +++ b/test/language/parser.rb @@ -15,7 +15,7 @@ class TestParser < Test::Unit::TestCase def setup super Puppet[:parseonly] = true - #@lexer = Puppet::Parser::Lexer.new() + #@lexer = Puppet::Parser::Lexer.new end def teardown @@ -28,7 +28,7 @@ class TestParser < Test::Unit::TestCase Puppet::Node::Environment.clear parser = mkparser Puppet.debug("parsing #{file}") if __FILE__ == $0 - assert_nothing_raised() { + assert_nothing_raised { parser.file = file parser.parse } @@ -52,7 +52,7 @@ class TestParser < Test::Unit::TestCase def test_arrayrvalues parser = mkparser ret = nil - file = tempfile() + file = tempfile assert_nothing_raised { parser.string = "file { \"#{file}\": mode => [755, 640] }" } @@ -65,7 +65,7 @@ class TestParser < Test::Unit::TestCase def test_arrayrvalueswithtrailingcomma parser = mkparser ret = nil - file = tempfile() + file = tempfile assert_nothing_raised { parser.string = "file { \"#{file}\": mode => [755, 640,] }" } @@ -85,7 +85,7 @@ class TestParser < Test::Unit::TestCase end def test_importglobbing - basedir = File.join(tmpdir(), "importesting") + basedir = File.join(tmpdir, "importesting") @@tmpfiles << basedir Dir.mkdir(basedir) @@ -109,7 +109,7 @@ class TestParser < Test::Unit::TestCase end def test_nonexistent_import - basedir = File.join(tmpdir(), "importesting") + basedir = File.join(tmpdir, "importesting") @@tmpfiles << basedir Dir.mkdir(basedir) manifest = File.join(basedir, "manifest") @@ -124,7 +124,7 @@ class TestParser < Test::Unit::TestCase end def test_trailingcomma - path = tempfile() + path = tempfile str = %{file { "#{path}": ensure => file, } } @@ -137,10 +137,10 @@ class TestParser < Test::Unit::TestCase end def test_importedclasses - imported = tempfile() - importer = tempfile() + imported = tempfile + importer = tempfile - made = tempfile() + made = tempfile File.open(imported, "w") do |f| f.puts %{class foo { file { "#{made}": ensure => file }}} @@ -164,7 +164,7 @@ class TestParser < Test::Unit::TestCase # Make sure fully qualified and unqualified files can be imported def test_fqfilesandlocalfiles - dir = tempfile() + dir = tempfile Dir.mkdir(dir) importer = File.join(dir, "site.pp") fullfile = File.join(dir, "full.pp") @@ -176,14 +176,14 @@ class TestParser < Test::Unit::TestCase f.puts %{import "#{fullfile}"\ninclude full\nimport "local.pp"\ninclude local} end - fullmaker = tempfile() + fullmaker = tempfile files << fullmaker File.open(fullfile, "w") do |f| f.puts %{class full { file { "#{fullmaker}": ensure => file }}} end - localmaker = tempfile() + localmaker = tempfile files << localmaker File.open(localfile, "w") do |f| @@ -204,7 +204,7 @@ class TestParser < Test::Unit::TestCase # Make sure the parser adds '.pp' when necessary def test_addingpp - dir = tempfile() + dir = tempfile Dir.mkdir(dir) importer = File.join(dir, "site.pp") localfile = File.join(dir, "local.pp") @@ -215,7 +215,7 @@ class TestParser < Test::Unit::TestCase f.puts %{import "local"\ninclude local} end - file = tempfile() + file = tempfile files << file File.open(localfile, "w") do |f| @@ -232,7 +232,7 @@ class TestParser < Test::Unit::TestCase # Make sure that file importing changes file relative names. def test_changingrelativenames - dir = tempfile() + dir = tempfile Dir.mkdir(dir) Dir.mkdir(File.join(dir, "subdir")) top = File.join(dir, "site.pp") @@ -240,14 +240,14 @@ class TestParser < Test::Unit::TestCase subtwo = File.join(dir, "subdir/subtwo") files = [] - file = tempfile() + file = tempfile files << file File.open(subone + ".pp", "w") do |f| f.puts %{class one { file { "#{file}": ensure => file }}} end - otherfile = tempfile() + otherfile = tempfile files << otherfile File.open(subtwo + ".pp", "w") do |f| f.puts %{import "subone"\n class two inherits one { @@ -294,7 +294,7 @@ class TestParser < Test::Unit::TestCase end def test_emptyfile - file = tempfile() + file = tempfile File.open(file, "w") do |f| f.puts %{} end @@ -306,8 +306,8 @@ class TestParser < Test::Unit::TestCase end def test_multiple_nodes_named - file = tempfile() - other = tempfile() + file = tempfile + other = tempfile File.open(file, "w") do |f| f.puts %{ diff --git a/test/language/scope.rb b/test/language/scope.rb index 09bf8a1c5..0e99aa5ae 100755 --- a/test/language/scope.rb +++ b/test/language/scope.rb @@ -66,7 +66,7 @@ class TestScope < Test::Unit::TestCase "Recursive and non-recursive hash is identical for topscope") # Check the variable we expect is present. - assert_equal({"first" => "topval"}, topscope.to_hash(), "topscope returns the expected hash of variables") + assert_equal({"first" => "topval"}, topscope.to_hash, "topscope returns the expected hash of variables") # Now, check that midscope does the right thing in all cases. diff --git a/test/language/snippets.rb b/test/language/snippets.rb index fe22e46bf..d55b75e50 100755 --- a/test/language/snippets.rb +++ b/test/language/snippets.rb @@ -51,7 +51,7 @@ class TestSnippets < Test::Unit::TestCase end def file2ast(file) - parser = Puppet::Parser::Parser.new() + parser = Puppet::Parser::Parser.new parser.file = file ast = parser.parse @@ -59,7 +59,7 @@ class TestSnippets < Test::Unit::TestCase end def snippet2ast(text) - parser = Puppet::Parser::Parser.new() + parser = Puppet::Parser::Parser.new parser.string = text ast = parser.parse @@ -74,7 +74,7 @@ class TestSnippets < Test::Unit::TestCase end def ast2scope(ast) - scope = Puppet::Parser::Scope.new() + scope = Puppet::Parser::Scope.new ast.evaluate(scope) scope diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb index 46d557341..c8a76267e 100755 --- a/test/lib/puppettest.rb +++ b/test/lib/puppettest.rb @@ -181,8 +181,8 @@ module PuppetTest ) unless defined? $user and $group - $user = nonrootuser().uid.to_s - $group = nonrootgroup().gid.to_s + $user = nonrootuser.uid.to_s + $group = nonrootgroup.gid.to_s end Puppet.settings.clear @@ -194,7 +194,7 @@ module PuppetTest Dir.mkdir(@configpath) unless File.exists?(@configpath) - @@tmpfiles << @configpath << tmpdir() + @@tmpfiles << @configpath << tmpdir @@tmppids = [] @@cleaners = [] @@ -216,7 +216,7 @@ module PuppetTest #else # Puppet::Util::Log.close # Puppet::Util::Log.newdestination(@logs) - # Puppet[:httplog] = tempfile() + # Puppet[:httplog] = tempfile #end Puppet[:ignoreschedules] = true @@ -234,7 +234,7 @@ module PuppetTest @@tmpfilenum = 1 end - f = File.join(self.tmpdir(), "tempfile_" + @@tmpfilenum.to_s) + f = File.join(self.tmpdir, "tempfile_" + @@tmpfilenum.to_s) @@tmpfiles ||= [] @@tmpfiles << f f @@ -245,7 +245,7 @@ module PuppetTest end def tstdir - dir = tempfile() + dir = tempfile Dir.mkdir(dir) dir end @@ -287,7 +287,7 @@ module PuppetTest def teardown #@stop = Time.now #File.open("/tmp/test_times.log", ::File::WRONLY|::File::CREAT|::File::APPEND) { |f| f.puts "%0.4f %s %s" % [@stop - @start, @method_name, self.class] } - @@cleaners.each { |cleaner| cleaner.call() } + @@cleaners.each { |cleaner| cleaner.call } remove_tmp_files diff --git a/test/lib/puppettest/certificates.rb b/test/lib/puppettest/certificates.rb index 9ab64d762..501e36a0f 100644 --- a/test/lib/puppettest/certificates.rb +++ b/test/lib/puppettest/certificates.rb @@ -19,7 +19,7 @@ module PuppetTest::Certificates def mkCA ca = nil assert_nothing_raised { - ca = Puppet::SSLCertificates::CA.new() + ca = Puppet::SSLCertificates::CA.new } ca diff --git a/test/lib/puppettest/exetest.rb b/test/lib/puppettest/exetest.rb index 105ebc11c..67b4b818c 100644 --- a/test/lib/puppettest/exetest.rb +++ b/test/lib/puppettest/exetest.rb @@ -36,7 +36,7 @@ module PuppetTest::ExeTest cmd = cmd.unshift(@ruby).join(" ") out = nil - Dir.chdir(bindir()) { + Dir.chdir(bindir) { out = %x{#{@ruby} #{cmd}} } out @@ -45,7 +45,7 @@ module PuppetTest::ExeTest def startmasterd(args = "") output = nil - manifest = mktestmanifest() + manifest = mktestmanifest args += " --manifest #{manifest}" args += " --confdir #{Puppet[:confdir]}" args += " --rundir #{File.join(Puppet[:vardir], "run")}" diff --git a/test/lib/puppettest/parsertesting.rb b/test/lib/puppettest/parsertesting.rb index 3935322e6..fe85fe95e 100644 --- a/test/lib/puppettest/parsertesting.rb +++ b/test/lib/puppettest/parsertesting.rb @@ -29,11 +29,11 @@ module PuppetTest::ParserTesting end def safeevaluate(*args) - evaluate() + evaluate end def evaluate_match(othervalue, scope, options={}) - value = evaluate() + value = evaluate othervalue == value end end @@ -154,7 +154,7 @@ module PuppetTest::ParserTesting return AST::Name.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :value => name @@ -167,7 +167,7 @@ module PuppetTest::ParserTesting return AST::Type.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :value => name @@ -180,7 +180,7 @@ module PuppetTest::ParserTesting return AST::NodeDef.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :names => nameobj(name), @@ -205,7 +205,7 @@ module PuppetTest::ParserTesting return AST::ResourceInstance.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :children => params @@ -220,7 +220,7 @@ module PuppetTest::ParserTesting return AST::ResourceParam.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :param => param, @@ -233,7 +233,7 @@ module PuppetTest::ParserTesting AST::String.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :value => value @@ -246,7 +246,7 @@ module PuppetTest::ParserTesting return AST::VarDef.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :name => nameobj(name), @@ -383,7 +383,7 @@ module PuppetTest::ParserTesting bucket = top - file = tempfile() + file = tempfile depth.times do |i| resources = [] width.times do |j| @@ -419,7 +419,7 @@ module PuppetTest::ParserTesting trans = nil scope = nil assert_nothing_raised { - scope = Puppet::Parser::Scope.new() + scope = Puppet::Parser::Scope.new trans = scope.evaluate(:ast => top) } diff --git a/test/lib/puppettest/servertest.rb b/test/lib/puppettest/servertest.rb index df78159c8..4efcedddf 100644 --- a/test/lib/puppettest/servertest.rb +++ b/test/lib/puppettest/servertest.rb @@ -16,9 +16,9 @@ module PuppetTest::ServerTest # create a simple manifest that just creates a file def mktestmanifest file = File.join(Puppet[:confdir], "#{(self.class.to_s + "test")}site.pp") - #@createdfile = File.join(tmpdir(), self.class.to_s + "manifesttesting" + + #@createdfile = File.join(tmpdir, self.class.to_s + "manifesttesting" + # "_#{@method_name}") - @createdfile = tempfile() + @createdfile = tempfile File.open(file, "w") { |f| f.puts "file { \"%s\": ensure => file, mode => 755 }\n" % @createdfile @@ -38,7 +38,7 @@ module PuppetTest::ServerTest handlers = { :CA => {}, # so that certs autogenerate :Master => { - :Manifest => mktestmanifest(), + :Manifest => mktestmanifest, :UseNodes => false }, } diff --git a/test/network/authconfig.rb b/test/network/authconfig.rb index 6437aefea..18445bc8e 100755 --- a/test/network/authconfig.rb +++ b/test/network/authconfig.rb @@ -18,7 +18,7 @@ class TestAuthConfig < Test::Unit::TestCase end def test_parsingconfigfile - file = tempfile() + file = tempfile assert(Puppet[:authconfig], "No config path") Puppet[:authconfig] = file diff --git a/test/network/handler/ca.rb b/test/network/handler/ca.rb index 6a4506a86..401b8d5fe 100755 --- a/test/network/handler/ca.rb +++ b/test/network/handler/ca.rb @@ -171,7 +171,7 @@ class TestCA < Test::Unit::TestCase def test_nodefaultautosign caserv = nil assert_nothing_raised { - caserv = Puppet::Network::Handler.ca.new() + caserv = Puppet::Network::Handler.ca.new } # make sure we know what's going on @@ -204,13 +204,13 @@ class TestCA < Test::Unit::TestCase def test_autosign_true_beats_file caserv = nil assert_nothing_raised { - caserv = Puppet::Network::Handler.ca.new() + caserv = Puppet::Network::Handler.ca.new } host = "hostname.domain.com" # Create an autosign file - file = tempfile() + file = tempfile Puppet[:autosign] = file File.open(file, "w") { |f| @@ -239,7 +239,7 @@ class TestCA < Test::Unit::TestCase # Make sure that a CSR created with keys that don't match the existing # cert throws an exception on the server. def test_mismatched_public_keys_throws_exception - ca = Puppet::Network::Handler.ca.new() + ca = Puppet::Network::Handler.ca.new # First initialize the server client = Puppet::Network::Client.ca.new :CA => ca diff --git a/test/network/handler/fileserver.rb b/test/network/handler/fileserver.rb index 667adb853..bfe76d078 100755 --- a/test/network/handler/fileserver.rb +++ b/test/network/handler/fileserver.rb @@ -11,7 +11,7 @@ class TestFileServer < Test::Unit::TestCase def mkmount(path = nil) mount = nil name = "yaytest" - base = path || tempfile() + base = path || tempfile Dir.mkdir(base) unless FileTest.exists?(base) # Create a test file File.open(File.join(base, "file"), "w") { |f| f.puts "bazoo" } @@ -23,7 +23,7 @@ class TestFileServer < Test::Unit::TestCase end # make a simple file source def mktestdir - testdir = File.join(tmpdir(), "remotefilecopytesting") + testdir = File.join(tmpdir, "remotefilecopytesting") @@tmpfiles << testdir # create a tmpfile @@ -89,7 +89,7 @@ class TestFileServer < Test::Unit::TestCase # verify that listing the root behaves as expected def test_listroot server = nil - testdir, pattern, tmpfile = mktestdir() + testdir, pattern, tmpfile = mktestdir file = nil checks = Puppet::Network::Handler.fileserver::CHECKPARAMS @@ -128,7 +128,7 @@ class TestFileServer < Test::Unit::TestCase # test listing individual files def test_getfilelist server = nil - testdir, pattern, tmpfile = mktestdir() + testdir, pattern, tmpfile = mktestdir file = nil @@ -180,7 +180,7 @@ class TestFileServer < Test::Unit::TestCase # check that the fileserver is seeing newly created files def test_seenewfiles server = nil - testdir, pattern, tmpfile = mktestdir() + testdir, pattern, tmpfile = mktestdir newfile = File.join(testdir, "newfile") @@ -244,7 +244,7 @@ class TestFileServer < Test::Unit::TestCase server.mount("/", "root") } - testdir, pattern, tmpfile = mktestdir() + testdir, pattern, tmpfile = mktestdir list = nil assert_nothing_raised { @@ -273,7 +273,7 @@ class TestFileServer < Test::Unit::TestCase } # make our deep recursion - basedir = File.join(tmpdir(), "recurseremotetesting") + basedir = File.join(tmpdir, "recurseremotetesting") testdir = "#{basedir}/with/some/sub/directories/for/the/purposes/of/testing" oldfile = File.join(testdir, "oldfile") assert_nothing_raised { @@ -328,7 +328,7 @@ class TestFileServer < Test::Unit::TestCase # create a deep dir - basedir = tempfile() + basedir = tempfile testdir = "#{basedir}/with/some/sub/directories/for/testing" oldfile = File.join(testdir, "oldfile") assert_nothing_raised { @@ -372,7 +372,7 @@ class TestFileServer < Test::Unit::TestCase ) } - basedir = tempfile() + basedir = tempfile dirs = %w{a set of directories} assert_nothing_raised { Dir.mkdir(basedir) @@ -399,7 +399,7 @@ class TestFileServer < Test::Unit::TestCase # verify that 'describe' works as advertised def test_describe server = nil - testdir = tstdir() + testdir = tstdir files = mktestfiles(testdir) file = nil @@ -597,7 +597,7 @@ class TestFileServer < Test::Unit::TestCase # Test that we smoothly handle invalid config files def test_configfailures # create an example file with each of them - conffile = tempfile() + conffile = tempfile invalidmounts = { "noexist" => "[noexist] @@ -676,8 +676,8 @@ class TestFileServer < Test::Unit::TestCase def test_filereread server = nil - conffile = tempfile() - dir = tstdir() + conffile = tempfile + dir = tstdir files = mktestfiles(dir) File.open(conffile, "w") { |f| @@ -744,7 +744,7 @@ class TestFileServer < Test::Unit::TestCase def test_mountstring mount = nil name = "yaytest" - path = tmpdir() + path = tmpdir assert_nothing_raised { mount = Puppet::Network::Handler.fileserver::Mount.new(name, path) } @@ -756,7 +756,7 @@ class TestFileServer < Test::Unit::TestCase # Disable the checking, so changes propagate immediately. Puppet[:filetimeout] = -5 server = nil - source = tempfile() + source = tempfile file = File.join(source, "file") link = File.join(source, "link") Dir.mkdir(source) @@ -813,7 +813,7 @@ class TestFileServer < Test::Unit::TestCase ip = "127.0.0.1" # Setup a directory hierarchy for the tests - fsdir = File.join(tmpdir(), "host-specific") + fsdir = File.join(tmpdir, "host-specific") @@tmpfiles << fsdir hostdir = File.join(fsdir, "host") fqdndir = File.join(fsdir, "fqdn") @@ -830,7 +830,7 @@ class TestFileServer < Test::Unit::TestCase f.print contents[d] end end - conffile = tempfile() + conffile = tempfile File.open(conffile, "w") do |f| f.print(" [host] @@ -931,7 +931,7 @@ allow * # Make sure the 'subdir' method in Mount works. def test_mount_subdir mount = nil - base = tempfile() + base = tempfile Dir.mkdir(base) subdir = File.join(base, "subdir") Dir.mkdir(subdir) @@ -940,7 +940,7 @@ allow * end mount = mkmount(base) - assert_equal(base, mount.subdir(), "Did not default to base path") + assert_equal(base, mount.subdir, "Did not default to base path") assert_equal(subdir, mount.subdir("subdir"), "Did not default to base path") end @@ -948,10 +948,10 @@ allow * # the path. def test_expandable name = "yaytest" - dir = tempfile() + dir = tempfile Dir.mkdir(dir) - mount = mkmount() + mount = mkmount assert_nothing_raised { mount.path = dir } @@ -980,7 +980,7 @@ allow * end def test_mount_expand - mount = mkmount() + mount = mkmount check = proc do |client, pattern, repl| path = "/my/#{pattern}/file" @@ -1037,7 +1037,7 @@ allow * ) } - dir = tempfile() + dir = tempfile # When mocks attack, part 2 kernel_fact = Facter.value(:kernel) diff --git a/test/network/handler/report.rb b/test/network/handler/report.rb index fa55137bc..ed7a96f57 100755 --- a/test/network/handler/report.rb +++ b/test/network/handler/report.rb @@ -16,13 +16,13 @@ class TestReportServer < Test::Unit::TestCase def mkserver server = nil assert_nothing_raised { - server = Puppet::Network::Handler.report.new() + server = Puppet::Network::Handler.report.new } server end def mkclient(server = nil) - server ||= mkserver() + server ||= mkserver client = nil assert_nothing_raised { client = Puppet::Network::Client.report.new(:Report => server) diff --git a/test/network/server/webrick.rb b/test/network/server/webrick.rb index 7fd362b39..cdc682043 100755 --- a/test/network/server/webrick.rb +++ b/test/network/server/webrick.rb @@ -75,7 +75,7 @@ class TestWebrickServer < Test::Unit::TestCase def mk_status_client client = nil - assert_nothing_raised() { + assert_nothing_raised { client = Puppet::Network::Client.status.new( @@ -90,7 +90,7 @@ class TestWebrickServer < Test::Unit::TestCase def mk_status_server server = nil Puppet[:certdnsnames] = "localhost" - assert_nothing_raised() { + assert_nothing_raised { server = Puppet::Network::HTTPServer::WEBrick.new( @@ -106,7 +106,7 @@ class TestWebrickServer < Test::Unit::TestCase pid = fork { Puppet.run_mode.stubs(:master?).returns true - assert_nothing_raised() { + assert_nothing_raised { trap(:INT) { server.shutdown } server.start } diff --git a/test/network/xmlrpc/processor.rb b/test/network/xmlrpc/processor.rb index 69f4c2fdc..3bf7b7fa3 100755 --- a/test/network/xmlrpc/processor.rb +++ b/test/network/xmlrpc/processor.rb @@ -35,7 +35,7 @@ class TestXMLRPCProcessor < Test::Unit::TestCase @processor.send(:setup_processor) assert(! @processor.handler_loaded?(:ca), "already have ca handler loaded") assert_nothing_raised do - @processor.add_handler(ca.interface, ca.new()) + @processor.add_handler(ca.interface, ca.new) end assert(@processor.handler_loaded?(:puppetca), "ca handler not loaded by symbol") @@ -46,7 +46,7 @@ class TestXMLRPCProcessor < Test::Unit::TestCase ca = Puppet::Network::Handler.ca @processor.send(:setup_processor) assert_nothing_raised do - @processor.add_handler(ca.interface, ca.new()) + @processor.add_handler(ca.interface, ca.new) end fakeparser = Class.new do diff --git a/test/other/puppet.rb b/test/other/puppet.rb index 1f81bb781..7caba8996 100755 --- a/test/other/puppet.rb +++ b/test/other/puppet.rb @@ -61,8 +61,8 @@ class TestPuppetModule < Test::Unit::TestCase $LOAD_PATH.delete(dir) unless oldlibs.include?(dir) end end - one = tempfile() - two = tempfile() + one = tempfile + two = tempfile Dir.mkdir(one) Dir.mkdir(two) diff --git a/test/other/relationships.rb b/test/other/relationships.rb index 3ca944670..c270be75e 100755 --- a/test/other/relationships.rb +++ b/test/other/relationships.rb @@ -13,7 +13,7 @@ class TestRelationships < Test::Unit::TestCase end def newfile - assert_nothing_raised() { + assert_nothing_raised { return Puppet::Type.type(:file).new( @@ -57,7 +57,7 @@ class TestRelationships < Test::Unit::TestCase def test_autorequire # We know that execs autorequire their cwd, so we'll use that - path = tempfile() + path = tempfile file = Puppet::Type.type(:file).new( diff --git a/test/other/report.rb b/test/other/report.rb index d15fb5505..862e50672 100755 --- a/test/other/report.rb +++ b/test/other/report.rb @@ -16,7 +16,7 @@ class TestReports < Test::Unit::TestCase # First do some work objects = [] 6.times do |i| - file = tempfile() + file = tempfile # Make every third file File.open(file, "w") { |f| f.puts "" } if i % 3 == 0 @@ -50,7 +50,7 @@ class TestReports < Test::Unit::TestCase } # Now make a file for testing logging - file = Puppet::Type.type(:file).new(:path => tempfile(), :ensure => "file") + file = Puppet::Type.type(:file).new(:path => tempfile, :ensure => "file") file.finish log = nil diff --git a/test/other/transactions.rb b/test/other/transactions.rb index dd5348e33..26fc0b642 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -13,7 +13,7 @@ class TestTransactions < Test::Unit::TestCase include PuppetTest::Support::Resources include PuppetTest::Support::Utils class Fakeprop 1 @@ -105,7 +105,7 @@ class TestTransactions < Test::Unit::TestCase assert_equal({inst.title => inst}, $prefetched, "type prefetch was not called") - # Now make sure it gets called from within evaluate() + # Now make sure it gets called from within evaluate $prefetched = false assert_nothing_raised do trans.evaluate @@ -117,7 +117,7 @@ class TestTransactions < Test::Unit::TestCase # We need to generate resources before we prefetch them, else generated # resources that require prefetching don't work. def test_generate_before_prefetch - config = mk_catalog() + config = mk_catalog trans = Puppet::Transaction.new(config) generate = nil @@ -127,7 +127,7 @@ class TestTransactions < Test::Unit::TestCase trans.prepare return - resource = Puppet::Type.type(:file).new :ensure => :present, :path => tempfile() + resource = Puppet::Type.type(:file).new :ensure => :present, :path => tempfile other_resource = mock 'generated' def resource.generate [other_resource] @@ -186,8 +186,8 @@ class TestTransactions < Test::Unit::TestCase # Make sure changes in contained files still generate callback events. def test_generated_callbacks - dir = tempfile() - maker = tempfile() + dir = tempfile + maker = tempfile Dir.mkdir(dir) file = File.join(dir, "file") File.open(file, "w") { |f| f.puts "" } @@ -203,7 +203,7 @@ class TestTransactions < Test::Unit::TestCase assert(FileTest.exists?(maker), "Did not make callback file") end - # Testing #401 -- transactions are calling refresh() on classes that don't support it. + # Testing #401 -- transactions are calling refresh on classes that don't support it. def test_callback_availability $called = [] klass = Puppet::Type.newtype(:norefresh) do @@ -217,7 +217,7 @@ class TestTransactions < Test::Unit::TestCase Puppet::Type.rmtype(:norefresh) end - file = Puppet::Type.type(:file).new :path => tempfile(), :content => "yay" + file = Puppet::Type.type(:file).new :path => tempfile, :content => "yay" one = klass.new :name => "one", :subscribe => file assert_apply(file, one) @@ -291,7 +291,7 @@ class TestTransactions < Test::Unit::TestCase rels = {} # Now add the explicit relationship # Now files - d = tempfile() + d = tempfile f = File.join(d, "file") file = Puppet::Type.type(:file).new(:path => f, :content => "yay") dir = Puppet::Type.type(:file).new(:path => d, :ensure => :directory, :require => file) diff --git a/test/ral/manager/type.rb b/test/ral/manager/type.rb index 5190bc7c7..5fd4fd622 100755 --- a/test/ral/manager/type.rb +++ b/test/ral/manager/type.rb @@ -238,7 +238,7 @@ class TestType < Test::Unit::TestCase file = nil fileclass = Puppet::Type.type(:file) - path = tempfile() + path = tempfile assert_nothing_raised do file = fileclass.create( @@ -301,7 +301,7 @@ class TestType < Test::Unit::TestCase # Now do files, since they are. This should fail. file1 = file2 = nil - path = tempfile() + path = tempfile file1 = Puppet::Type.type(:file).new( @@ -324,7 +324,7 @@ class TestType < Test::Unit::TestCase end def test_tags - obj = Puppet::Type.type(:file).new(:path => tempfile()) + obj = Puppet::Type.type(:file).new(:path => tempfile) tags = ["some", "test", "tags"] @@ -336,7 +336,7 @@ class TestType < Test::Unit::TestCase end def test_to_hash - file = Puppet::Type.newfile :path => tempfile(), :owner => "luke", + file = Puppet::Type.newfile :path => tempfile, :owner => "luke", :recurse => true, :loglevel => "warning" hash = nil @@ -350,7 +350,7 @@ class TestType < Test::Unit::TestCase end def test_ref - path = tempfile() + path = tempfile Puppet::Type.type(:exec) # uggh, the methods need to load the types file = Puppet::Type.newfile(:path => path) assert_equal("File[#{path}]", file.ref) diff --git a/test/ral/providers/cron/crontab.rb b/test/ral/providers/cron/crontab.rb index 0da9cc232..3a996cb4e 100755 --- a/test/ral/providers/cron/crontab.rb +++ b/test/ral/providers/cron/crontab.rb @@ -259,7 +259,7 @@ class TestCronParsedProvider < Test::Unit::TestCase # A simple test to see if we can load the cron from disk. def test_load - setme() + setme records = nil assert_nothing_raised { records = @provider.retrieve(@me) @@ -271,7 +271,7 @@ class TestCronParsedProvider < Test::Unit::TestCase # it directly def test_simple_to_cron # make the cron - setme() + setme name = "yaytest" args = {:name => name, diff --git a/test/ral/providers/group.rb b/test/ral/providers/group.rb index ceba65ac4..829e7dfa2 100755 --- a/test/ral/providers/group.rb +++ b/test/ral/providers/group.rb @@ -158,7 +158,7 @@ class TestGroupProvider < Test::Unit::TestCase # Iterate over each of our groups and try to grab the gid. def test_ownprovidergroups - groupnames().each { |group| + groupnames.each { |group| gobj = nil comp = nil fakeresource = fakeresource(:group, group) diff --git a/test/ral/providers/host/parsed.rb b/test/ral/providers/host/parsed.rb index d14e33f7b..5b21abc6b 100755 --- a/test/ral/providers/host/parsed.rb +++ b/test/ral/providers/host/parsed.rb @@ -51,7 +51,7 @@ class TestParsedHostProvider < Test::Unit::TestCase end def mkhost - hash = mkhosthash() + hash = mkhosthash fakeresource = fakeresource(:host, hash[:name]) @@ -86,7 +86,7 @@ class TestParsedHostProvider < Test::Unit::TestCase # Make sure parsing gets comments, blanks, and hosts def test_blanks_and_comments - mkfaketype() + mkfaketype text = %{# comment one 192.168.43.56\tmyhost\tanother\thost @@ -191,14 +191,14 @@ class TestParsedHostProvider < Test::Unit::TestCase # Make sure we can modify the file elsewhere and those modifications will # get taken into account. def test_modifyingfile - hostfile = tempfile() + hostfile = tempfile @provider.default_target = hostfile file = @provider.target_object(hostfile) hosts = [] 3.times { - h = mkhost() + h = mkhost hosts << h } @@ -206,11 +206,11 @@ class TestParsedHostProvider < Test::Unit::TestCase host.flush end - newhost = mkhost() + newhost = mkhost hosts << newhost # Now store our new host - newhost.flush() + newhost.flush # Verify we can retrieve that info assert_nothing_raised("Could not retrieve after second write") { diff --git a/test/ral/providers/package.rb b/test/ral/providers/package.rb index b91f5d92d..6a8489c88 100755 --- a/test/ral/providers/package.rb +++ b/test/ral/providers/package.rb @@ -16,7 +16,7 @@ class TestPackageProvider < Test::Unit::TestCase # Load the testpackages hash. def self.load_test_packages require 'yaml' - file = File.join(PuppetTest.datadir(), "providers", "package", "testpackages.yaml") + file = File.join(PuppetTest.datadir, "providers", "package", "testpackages.yaml") raise "Could not find file #{file}" unless FileTest.exists?(file) array = YAML::load(File.read(file)).collect { |hash| # Stupid ruby 1.8.1. YAML is sometimes broken such that diff --git a/test/ral/providers/parsedfile.rb b/test/ral/providers/parsedfile.rb index 93716a3ce..53a37cfc2 100755 --- a/test/ral/providers/parsedfile.rb +++ b/test/ral/providers/parsedfile.rb @@ -120,7 +120,7 @@ class TestParsedFile < Test::Unit::TestCase def test_fileobject prov = mkprovider - path = tempfile() + path = tempfile obj = nil assert_nothing_raised do obj = prov.target_object(path) @@ -295,17 +295,17 @@ class TestParsedFile < Test::Unit::TestCase files = {} # Set the default target - default = tempfile() + default = tempfile files[:default] = default prov.default_target = default # Create a file object - inmem = tempfile() + inmem = tempfile files[:inmemory] = inmem prov.target_object(inmem).write("inmem yay ness") # Lastly, create a resource with separate is and should values - mtarget = tempfile() + mtarget = tempfile files[:resources] = mtarget resource = mkresource "yay", :target => mtarget @@ -497,7 +497,7 @@ class TestParsedFile < Test::Unit::TestCase "Did not get default ensure value") # Try creating the object - assert_nothing_raised { notdisk.provider.create() } + assert_nothing_raised { notdisk.provider.create } # Now make sure all of the data is copied over correctly. notdisk.class.validproperties.each do |property| @@ -519,7 +519,7 @@ class TestParsedFile < Test::Unit::TestCase assert_equal(:present, ondisk.provider.ensure) # Now destroy the object - assert_nothing_raised { notdisk.provider.destroy() } + assert_nothing_raised { notdisk.provider.destroy } assert_nothing_raised { notdisk.flush } diff --git a/test/ral/providers/provider.rb b/test/ral/providers/provider.rb index 3ffbfd985..2ea08e068 100755 --- a/test/ral/providers/provider.rb +++ b/test/ral/providers/provider.rb @@ -185,7 +185,7 @@ class TestProvider < Test::Unit::TestCase def test_outputonfailure provider = newprovider - dir = tstdir() + dir = tstdir file = File.join(dir, "mycmd") sh = Puppet::Util.binary("sh") File.open(file, "w") { |f| @@ -345,7 +345,7 @@ class TestProvider < Test::Unit::TestCase assert_equal(:one, prov.name, "did not get name from hash") assert_nothing_raised("Could not init with no argument") do - prov = test.new() + prov = test.new end assert_raise(Puppet::DevError, "did not fail when no name is present") do diff --git a/test/ral/providers/service/base.rb b/test/ral/providers/service/base.rb index f1db0470d..ffaf5987e 100755 --- a/test/ral/providers/service/base.rb +++ b/test/ral/providers/service/base.rb @@ -11,7 +11,7 @@ class TestBaseServiceProvider < Test::Unit::TestCase include PuppetTest def test_base - running = tempfile() + running = tempfile commands = {} %w{touch rm test}.each do |c| diff --git a/test/ral/providers/user.rb b/test/ral/providers/user.rb index 7769e3a26..628d88acf 100755 --- a/test/ral/providers/user.rb +++ b/test/ral/providers/user.rb @@ -11,7 +11,7 @@ class TestUserProvider < Test::Unit::TestCase def setup super - setme() + setme @@tmpusers = [] @provider = nil assert_nothing_raised { @@ -114,7 +114,7 @@ class TestUserProvider < Test::Unit::TestCase when :ensure; :present when :comment; "Puppet's Testing User #{name}" # use a single quote a la #375 when :gid; nonrootgroup.gid - when :shell; findshell() + when :shell; findshell when :home; "/home/#{name}" else return nil diff --git a/test/ral/type/cron.rb b/test/ral/type/cron.rb index 384a6ad32..1bf8bafc0 100755 --- a/test/ral/type/cron.rb +++ b/test/ral/type/cron.rb @@ -12,7 +12,7 @@ class TestCron < Test::Unit::TestCase def setup super - setme() + setme @crontype = Puppet::Type.type(:cron) @provider = @crontype.defaultprovider diff --git a/test/ral/type/exec.rb b/test/ral/type/exec.rb index 7ddb4650d..eacb12a07 100755 --- a/test/ral/type/exec.rb +++ b/test/ral/type/exec.rb @@ -113,7 +113,7 @@ class TestExec < Test::Unit::TestCase def test_refreshonly_functional file = nil cmd = nil - tmpfile = tempfile() + tmpfile = tempfile @@tmpfiles.push tmpfile trans = nil @@ -127,7 +127,7 @@ class TestExec < Test::Unit::TestCase assert_apply(file) # Now make an exec - maker = tempfile() + maker = tempfile assert_nothing_raised { cmd = Puppet::Type.type(:exec).new( @@ -180,7 +180,7 @@ class TestExec < Test::Unit::TestCase end def test_creates - file = tempfile() + file = tempfile exec = nil assert(! FileTest.exists?(file), "File already exists") assert_nothing_raised { @@ -201,8 +201,8 @@ class TestExec < Test::Unit::TestCase # Verify that we can download the file that we're going to execute. def test_retrievethenmkexe - exe = tempfile() - oexe = tempfile() + exe = tempfile + oexe = tempfile sh = %x{which sh} File.open(exe, "w") { |f| f.puts "#!#{sh}\necho yup" } @@ -230,8 +230,8 @@ class TestExec < Test::Unit::TestCase # Verify that we auto-require any managed scripts. def test_autorequire_files - exe = tempfile() - oexe = tempfile() + exe = tempfile + oexe = tempfile sh = %x{which sh} File.open(exe, "w") { |f| f.puts "#!#{sh}\necho yup" } @@ -304,8 +304,8 @@ class TestExec < Test::Unit::TestCase end def test_ifonly - afile = tempfile() - bfile = tempfile() + afile = tempfile + bfile = tempfile exec = nil assert_nothing_raised { @@ -328,8 +328,8 @@ class TestExec < Test::Unit::TestCase end def test_unless - afile = tempfile() - bfile = tempfile() + afile = tempfile + bfile = tempfile exec = nil assert_nothing_raised { @@ -399,14 +399,14 @@ class TestExec < Test::Unit::TestCase end def test_userngroup - file = tempfile() + file = tempfile [ - [nonrootuser()], # just user, by name - [nonrootuser(), nil, true], # user, by uid - [nil, nonrootgroup()], # just group - [nil, nonrootgroup(), true], # just group, by id - [nonrootuser(), nonrootgroup()], # user and group, by name - [nonrootuser(), nonrootgroup(), true], # user and group, by id + [nonrootuser], # just user, by name + [nonrootuser, nil, true], # user, by uid + [nil, nonrootgroup], # just group + [nil, nonrootgroup, true], # just group, by id + [nonrootuser, nonrootgroup], # user and group, by name + [nonrootuser, nonrootgroup, true], # user and group, by id ].each { |ary| mknverify(file, *ary) { } @@ -448,7 +448,7 @@ class TestExec < Test::Unit::TestCase def test_execthenfile exec = nil file = nil - basedir = tempfile() + basedir = tempfile path = File.join(basedir, "subfile") assert_nothing_raised { @@ -503,8 +503,8 @@ class TestExec < Test::Unit::TestCase def test_createcwdandexe exec1 = exec2 = nil - dir = tempfile() - file = tempfile() + dir = tempfile + file = tempfile assert_nothing_raised { @@ -550,7 +550,7 @@ class TestExec < Test::Unit::TestCase def test_checkarrays exec = nil - file = tempfile() + file = tempfile test = "test -f #{file}" @@ -756,8 +756,8 @@ and stuff" end def test_checks_apply_to_refresh - file = tempfile() - maker = tempfile() + file = tempfile + maker = tempfile exec = Puppet::Type.type(:exec).new( @@ -798,8 +798,8 @@ and stuff" end def test_explicit_refresh - refresher = tempfile() - maker = tempfile() + refresher = tempfile + maker = tempfile exec = Puppet::Type.type(:exec).new( diff --git a/test/ral/type/file.rb b/test/ral/type/file.rb index 726dcb72f..06795de7d 100755 --- a/test/ral/type/file.rb +++ b/test/ral/type/file.rb @@ -20,7 +20,7 @@ class TestFile < Test::Unit::TestCase end def mktestfile - tmpfile = tempfile() + tmpfile = tempfile File.open(tmpfile, "w") { |f| f.puts rand(100) } @@tmpfiles.push tmpfile mkfile(:name => tmpfile) @@ -50,7 +50,7 @@ class TestFile < Test::Unit::TestCase end def test_owner - file = mktestfile() + file = mktestfile users = {} count = 0 @@ -82,10 +82,10 @@ class TestFile < Test::Unit::TestCase us[uid] = name users.each { |uid, name| assert_apply(file) - assert_nothing_raised() { + assert_nothing_raised { file[:owner] = name } - assert_nothing_raised() { + assert_nothing_raised { file.retrieve } assert_apply(file) @@ -93,9 +93,9 @@ class TestFile < Test::Unit::TestCase end def test_group - file = mktestfile() + file = mktestfile [%x{groups}.chomp.split(/ /), Process.groups].flatten.each { |group| - assert_nothing_raised() { + assert_nothing_raised { file[:group] = group } assert(file.property(:group)) @@ -111,9 +111,9 @@ class TestFile < Test::Unit::TestCase if Puppet.features.root? def test_createasuser - dir = tmpdir() + dir = tmpdir - user = nonrootuser() + user = nonrootuser path = File.join(tmpdir, "createusertesting") @@tmpfiles << path @@ -136,7 +136,7 @@ class TestFile < Test::Unit::TestCase end def test_nofollowlinks - basedir = tempfile() + basedir = tempfile Dir.mkdir(basedir) file = File.join(basedir, "file") link = File.join(basedir, "link") @@ -145,7 +145,7 @@ class TestFile < Test::Unit::TestCase File.symlink(file, link) # First test 'user' - user = nonrootuser() + user = nonrootuser inituser = File.lstat(link).uid File.lchown(inituser, nil, link) @@ -205,7 +205,7 @@ class TestFile < Test::Unit::TestCase end def test_ownerasroot - file = mktestfile() + file = mktestfile users = {} count = 0 @@ -234,13 +234,13 @@ class TestFile < Test::Unit::TestCase end users.each { |uid, name| - assert_nothing_raised() { + assert_nothing_raised { file[:owner] = name } assert_apply(file) currentvalue = file.retrieve assert(file.insync?(currentvalue)) - assert_nothing_raised() { + assert_nothing_raised { file[:owner] = uid } assert_apply(file) @@ -261,10 +261,10 @@ class TestFile < Test::Unit::TestCase end def test_groupasroot - file = mktestfile() + file = mktestfile [%x{groups}.chomp.split(/ /), Process.groups].flatten.each { |group| next unless Puppet::Util.gid(group) # grr. - assert_nothing_raised() { + assert_nothing_raised { file[:group] = group } assert(file.property(:group)) @@ -272,7 +272,7 @@ class TestFile < Test::Unit::TestCase assert_apply(file) currentvalue = file.retrieve assert(file.insync?(currentvalue)) - assert_nothing_raised() { + assert_nothing_raised { file.delete(:group) } } @@ -280,7 +280,7 @@ class TestFile < Test::Unit::TestCase if Facter.value(:operatingsystem) == "Darwin" def test_sillyowner - file = tempfile() + file = tempfile File.open(file, "w") { |f| f.puts "" } File.chown(-2, nil, file) @@ -304,9 +304,9 @@ class TestFile < Test::Unit::TestCase end def test_create - %w{a b c d}.collect { |name| tempfile() + name.to_s }.each { |path| + %w{a b c d}.collect { |name| tempfile + name.to_s }.each { |path| file =nil - assert_nothing_raised() { + assert_nothing_raised { file = Puppet::Type.type(:file).new( @@ -323,11 +323,11 @@ class TestFile < Test::Unit::TestCase end def test_create_dir - basedir = tempfile() + basedir = tempfile Dir.mkdir(basedir) %w{a b c d}.collect { |name| "#{basedir}/#{name}" }.each { |path| file = nil - assert_nothing_raised() { + assert_nothing_raised { file = Puppet::Type.type(:file).new( @@ -349,13 +349,13 @@ class TestFile < Test::Unit::TestCase # Set it to something else initially File.chmod(0775, file.title) [0644,0755,0777,0641].each { |mode| - assert_nothing_raised() { + assert_nothing_raised { file[:mode] = mode } assert_events([:mode_changed], file) assert_events([], file) - assert_nothing_raised() { + assert_nothing_raised { file.delete(:mode) } } @@ -403,7 +403,7 @@ class TestFile < Test::Unit::TestCase file = Puppet::Type.type(:file).new( - :name => tmpdir(), + :name => tmpdir, :check => :type ) @@ -416,7 +416,7 @@ class TestFile < Test::Unit::TestCase file = Puppet::Type.type(:file).new( - :name => tempfile(), + :name => tempfile, :ensure => "file" ) @@ -430,7 +430,7 @@ class TestFile < Test::Unit::TestCase end def test_path - dir = tempfile() + dir = tempfile path = File.join(dir, "subdir") @@ -467,7 +467,7 @@ class TestFile < Test::Unit::TestCase end def test_autorequire - basedir = tempfile() + basedir = tempfile subfile = File.join(basedir, "subfile") @@ -496,7 +496,7 @@ class TestFile < Test::Unit::TestCase # Unfortunately, I know this fails def disabled_test_recursivemkdir - path = tempfile() + path = tempfile subpath = File.join(path, "this", "is", "a", "dir") file = nil assert_nothing_raised { @@ -520,7 +520,7 @@ class TestFile < Test::Unit::TestCase # Make sure that content updates the checksum on the same run def test_checksumchange_for_content - dest = tempfile() + dest = tempfile File.open(dest, "w") { |f| f.puts "yayness" } file = nil @@ -545,7 +545,7 @@ class TestFile < Test::Unit::TestCase # Make sure that content updates the checksum on the same run def test_checksumchange_for_ensure - dest = tempfile() + dest = tempfile file = nil assert_nothing_raised { @@ -567,7 +567,7 @@ class TestFile < Test::Unit::TestCase end def test_nameandpath - path = tempfile() + path = tempfile file = nil assert_nothing_raised { @@ -593,7 +593,7 @@ class TestFile < Test::Unit::TestCase file = Puppet::Type.type(:file).new( - :path => tempfile(), + :path => tempfile, :group => "fakegroup" ) @@ -603,7 +603,7 @@ class TestFile < Test::Unit::TestCase end def test_modecreation - path = tempfile() + path = tempfile file = Puppet::Type.type(:file).new( @@ -624,7 +624,7 @@ class TestFile < Test::Unit::TestCase # If both 'ensure' and 'content' are used, make sure that all of the other # properties are handled correctly. def test_contentwithmode - path = tempfile() + path = tempfile file = nil assert_nothing_raised { @@ -644,8 +644,8 @@ class TestFile < Test::Unit::TestCase end def test_replacefilewithlink - path = tempfile() - link = tempfile() + path = tempfile + link = tempfile File.open(path, "w") { |f| f.puts "yay" } File.open(link, "w") { |f| f.puts "a file" } @@ -670,7 +670,7 @@ class TestFile < Test::Unit::TestCase end def test_file_with_spaces - dir = tempfile() + dir = tempfile Dir.mkdir(dir) source = File.join(dir, "file spaces") dest = File.join(dir, "another space") @@ -692,8 +692,8 @@ class TestFile < Test::Unit::TestCase # Testing #274. Make sure target can be used without 'ensure'. def test_target_without_ensure - source = tempfile() - dest = tempfile() + source = tempfile + dest = tempfile File.open(source, "w") { |f| f.puts "funtest" } obj = nil @@ -705,7 +705,7 @@ class TestFile < Test::Unit::TestCase end def test_autorequire_owner_and_group - file = tempfile() + file = tempfile comp = nil user = nil group =nil @@ -759,7 +759,7 @@ class TestFile < Test::Unit::TestCase # Testing #364. def test_writing_in_directories_with_no_write_access # Make a directory that our user does not have access to - dir = tempfile() + dir = tempfile Dir.mkdir(dir) # Get a fake user @@ -796,7 +796,7 @@ class TestFile < Test::Unit::TestCase # #366 def test_replace_aliases - file = Puppet::Type.newfile :path => tempfile() + file = Puppet::Type.newfile :path => tempfile file[:replace] = :yes assert_equal(:true, file[:replace], ":replace did not alias :true to :yes") file[:replace] = :no @@ -804,7 +804,7 @@ class TestFile < Test::Unit::TestCase end def test_pathbuilder - dir = tempfile() + dir = tempfile Dir.mkdir(dir) file = File.join(dir, "file") File.open(file, "w") { |f| f.puts "" } @@ -822,7 +822,7 @@ class TestFile < Test::Unit::TestCase # Testing #403 def test_removal_with_content_set - path = tempfile() + path = tempfile File.open(path, "w") { |f| f.puts "yay" } file = Puppet::Type.newfile(:name => path, :ensure => :absent, :content => "foo", :backup => false) @@ -832,9 +832,9 @@ class TestFile < Test::Unit::TestCase # Testing #438 def test_creating_properties_conflict - file = tempfile() - first = tempfile() - second = tempfile() + file = tempfile + first = tempfile + second = tempfile params = [:content, :source, :target] params.each do |param| assert_nothing_raised("#{param} conflicted with ensure") do @@ -852,14 +852,14 @@ class TestFile < Test::Unit::TestCase # Testing #508 if Process.uid == 0 def test_files_replace_with_right_attrs - source = tempfile() + source = tempfile File.open(source, "w") { |f| f.puts "some text" } File.chmod(0755, source) user = nonrootuser group = nonrootgroup - path = tempfile() + path = tempfile good = {:uid => user.uid, :gid => group.gid, :mode => 0640} run = Proc.new do |obj, msg| diff --git a/test/ral/type/file/target.rb b/test/ral/type/file/target.rb index 20e68a578..ac3b7474f 100755 --- a/test/ral/type/file/target.rb +++ b/test/ral/type/file/target.rb @@ -17,8 +17,8 @@ class TestFileTarget < Test::Unit::TestCase # Make sure we can create symlinks def test_symlinks - path = tempfile() - link = tempfile() + path = tempfile + link = tempfile File.open(path, "w") { |f| f.puts "yay" } @@ -47,8 +47,8 @@ class TestFileTarget < Test::Unit::TestCase end def test_simplerecursivelinking - source = tempfile() - path = tempfile() + source = tempfile + path = tempfile subdir = File.join(source, "subdir") file = File.join(subdir, "file") @@ -79,8 +79,8 @@ class TestFileTarget < Test::Unit::TestCase end def test_recursivelinking - source = tempfile() - dest = tempfile() + source = tempfile + dest = tempfile files = [] dirs = [] @@ -132,7 +132,7 @@ class TestFileTarget < Test::Unit::TestCase end def test_localrelativelinks - dir = tempfile() + dir = tempfile Dir.mkdir(dir) source = File.join(dir, "source") File.open(source, "w") { |f| f.puts "yay" } @@ -156,8 +156,8 @@ class TestFileTarget < Test::Unit::TestCase end def test_recursivelinkingmissingtarget - source = tempfile() - dest = tempfile() + source = tempfile + dest = tempfile resources = [] @@ -186,8 +186,8 @@ class TestFileTarget < Test::Unit::TestCase end def test_insync? - source = tempfile() - dest = tempfile() + source = tempfile + dest = tempfile obj = @file.create(:path => source, :target => dest) @@ -220,8 +220,8 @@ class TestFileTarget < Test::Unit::TestCase def test_replacedirwithlink Puppet[:trace] = false - path = tempfile() - link = tempfile() + path = tempfile + link = tempfile File.open(path, "w") { |f| f.puts "yay" } Dir.mkdir(link) @@ -254,7 +254,7 @@ class TestFileTarget < Test::Unit::TestCase end def test_replace_links_with_files - base = tempfile() + base = tempfile Dir.mkdir(base) @@ -282,7 +282,7 @@ class TestFileTarget < Test::Unit::TestCase end def test_no_erase_linkedto_files - base = tempfile() + base = tempfile Dir.mkdir(base) @@ -329,9 +329,9 @@ class TestFileTarget < Test::Unit::TestCase end def test_replace_links - dest = tempfile() - otherdest = tempfile() - link = tempfile() + dest = tempfile + otherdest = tempfile + link = tempfile File.open(dest, "w") { |f| f.puts "boo" } File.open(otherdest, "w") { |f| f.puts "yay" } diff --git a/test/ral/type/fileignoresource.rb b/test/ral/type/fileignoresource.rb index 19f510957..89e51a7fb 100755 --- a/test/ral/type/fileignoresource.rb +++ b/test/ral/type/fileignoresource.rb @@ -36,7 +36,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase def test_ignore_simple_source #Temp directory to run tests in - path = tempfile() + path = tempfile @@tmpfiles.push path #source directory @@ -101,7 +101,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase def test_ignore_with_wildcard #Temp directory to run tests in - path = tempfile() + path = tempfile @@tmpfiles.push path #source directory @@ -177,7 +177,7 @@ class TestFileIgnoreSources < Test::Unit::TestCase def test_ignore_array #Temp directory to run tests in - path = tempfile() + path = tempfile @@tmpfiles.push path #source directory diff --git a/test/ral/type/filesources.rb b/test/ral/type/filesources.rb index 2b43424ac..605704b0a 100755 --- a/test/ral/type/filesources.rb +++ b/test/ral/type/filesources.rb @@ -42,12 +42,12 @@ class TestFileSources < Test::Unit::TestCase # Make a simple recursive tree. def mk_sourcetree - source = tempfile() + source = tempfile sourcefile = File.join(source, "file") Dir.mkdir source File.open(sourcefile, "w") { |f| f.puts "yay" } - dest = tempfile() + dest = tempfile destfile = File.join(dest, "file") return source, dest, sourcefile, destfile end @@ -73,7 +73,7 @@ class TestFileSources < Test::Unit::TestCase end def run_complex_sources(networked = false) - path = tempfile() + path = tempfile # first create the source directory FileUtils.mkdir_p path @@ -181,7 +181,7 @@ class TestFileSources < Test::Unit::TestCase # Make sure added files get correctly caught during recursion def test_RecursionWithAddedFiles - basedir = tempfile() + basedir = tempfile Dir.mkdir(basedir) @@tmpfiles << basedir file1 = File.join(basedir, "file1") @@ -216,7 +216,7 @@ class TestFileSources < Test::Unit::TestCase end def mkfileserverconf(mounts) - file = tempfile() + file = tempfile File.open(file, "w") { |f| mounts.each { |path, name| f.puts "[#{name}]\n\tpath #{path}\n\tallow *\n" @@ -258,7 +258,7 @@ class TestFileSources < Test::Unit::TestCase } serverpid = fork { - assert_nothing_raised() { + assert_nothing_raised { #trap(:INT) { server.shutdown; Kernel.exit! } trap(:INT) { server.shutdown } server.start @@ -268,7 +268,7 @@ class TestFileSources < Test::Unit::TestCase sleep(1) - name = File.join(tmpdir(), "nosourcefile") + name = File.join(tmpdir, "nosourcefile") file = Puppet::Type.type(:file).new( @@ -290,10 +290,10 @@ class TestFileSources < Test::Unit::TestCase def test_sourcepaths files = [] 3.times { - files << tempfile() + files << tempfile } - to = tempfile() + to = tempfile File.open(files[-1], "w") { |f| f.puts "yee-haw" } @@ -321,8 +321,8 @@ class TestFileSources < Test::Unit::TestCase # Make sure that source-copying updates the checksum on the same run def test_sourcebeatsensure - source = tempfile() - dest = tempfile() + source = tempfile + dest = tempfile File.open(source, "w") { |f| f.puts "yay" } file = nil @@ -346,9 +346,9 @@ class TestFileSources < Test::Unit::TestCase end def test_sourcewithlinks - source = tempfile() - link = tempfile() - dest = tempfile() + source = tempfile + link = tempfile + dest = tempfile File.open(source, "w") { |f| f.puts "yay" } File.symlink(source, link) @@ -370,7 +370,7 @@ class TestFileSources < Test::Unit::TestCase # Make sure files aren't replaced when replace is false, but otherwise # are. def test_replace - dest = tempfile() + dest = tempfile file = Puppet::Type.newfile( @@ -400,11 +400,11 @@ class TestFileSources < Test::Unit::TestCase end def test_sourceselect - dest = tempfile() + dest = tempfile sources = [] 2.times { |i| i = i + 1 - source = tempfile() + source = tempfile sources << source file = File.join(source, "file#{i}") Dir.mkdir(source) @@ -452,9 +452,9 @@ class TestFileSources < Test::Unit::TestCase end def test_recursive_sourceselect - dest = tempfile() - source1 = tempfile() - source2 = tempfile() + dest = tempfile + source1 = tempfile + source2 = tempfile files = [] [source1, source2, File.join(source1, "subdir"), File.join(source2, "subdir")].each_with_index do |dir, i| Dir.mkdir(dir) @@ -482,8 +482,8 @@ class TestFileSources < Test::Unit::TestCase # #594 def test_purging_missing_remote_files - source = tempfile() - dest = tempfile() + source = tempfile + dest = tempfile s1 = File.join(source, "file1") s2 = File.join(source, "file2") d1 = File.join(dest, "file1") diff --git a/test/ral/type/host.rb b/test/ral/type/host.rb index 2715f6438..d05d67c67 100755 --- a/test/ral/type/host.rb +++ b/test/ral/type/host.rb @@ -27,7 +27,7 @@ class TestHost < Test::Unit::TestCase cleanup do @provider.default_target = @default_file end - @target = tempfile() + @target = tempfile @provider.default_target = @target end end @@ -98,7 +98,7 @@ class TestHost < Test::Unit::TestCase end def test_moddinghost - host = mkhost() + host = mkhost cleanup do host[:ensure] = :absent assert_apply(host) @@ -119,7 +119,7 @@ class TestHost < Test::Unit::TestCase end def test_invalid_ipaddress - host = mkhost() + host = mkhost assert_raise(Puppet::Error) { host[:ip] = "abc.def.ghi.jkl" @@ -127,7 +127,7 @@ class TestHost < Test::Unit::TestCase end def test_invalid_hostname - host = mkhost() + host = mkhost assert_raise(Puppet::Error) { host[:name] = "!invalid.hostname.$PID$" @@ -147,7 +147,7 @@ class TestHost < Test::Unit::TestCase end def test_valid_hostname - host = mkhost() + host = mkhost assert_nothing_raised { host[:name] = "yayness" diff --git a/test/ral/type/mailalias.rb b/test/ral/type/mailalias.rb index ff0e62e09..4d98a8f2a 100755 --- a/test/ral/type/mailalias.rb +++ b/test/ral/type/mailalias.rb @@ -26,7 +26,7 @@ class TestMailAlias < Test::Unit::TestCase cleanup do @provider.default_target = @default_file end - @target = tempfile() + @target = tempfile @provider.default_target = @target end end diff --git a/test/ral/type/port.rb b/test/ral/type/port.rb index d48aa8c2a..85592d14a 100755 --- a/test/ral/type/port.rb +++ b/test/ral/type/port.rb @@ -27,7 +27,7 @@ require 'puppettest' # cleanup do # @provider.default_target = oldpath # end -# @provider.default_target = tempfile() +# @provider.default_target = tempfile # end # end # @@ -105,7 +105,7 @@ require 'puppettest' # end # # def test_removal -# port = mkport() +# port = mkport # assert_nothing_raised { # port[:ensure] = :present # } @@ -123,7 +123,7 @@ require 'puppettest' # end # # def test_addingproperties -# port = mkport() +# port = mkport # assert_events([:port_created], port) # # port.delete(:alias) diff --git a/test/ral/type/resources.rb b/test/ral/type/resources.rb index 50d6839e7..d6c6c60ba 100755 --- a/test/ral/type/resources.rb +++ b/test/ral/type/resources.rb @@ -66,7 +66,7 @@ class TestResources < Test::Unit::TestCase assert_nothing_raised { assert(res.check("A String"), "String failed check") - assert(res.check(Puppet::Type.type(:file).new(:path => tempfile())), "File failed check") + assert(res.check(Puppet::Type.type(:file).new(:path => tempfile)), "File failed check") assert(res.check(Puppet::Type.type(:user).new(:name => "yayness")), "User failed check in package") } diff --git a/test/ral/type/sshkey.rb b/test/ral/type/sshkey.rb index 4e5525bd3..a23ddf151 100755 --- a/test/ral/type/sshkey.rb +++ b/test/ral/type/sshkey.rb @@ -26,7 +26,7 @@ class TestSSHKey < Test::Unit::TestCase cleanup do @provider.default_target = oldpath end - @provider.default_target = tempfile() + @provider.default_target = tempfile end end @@ -78,7 +78,7 @@ class TestSSHKey < Test::Unit::TestCase def test_simplekey key = mkkey - file = tempfile() + file = tempfile key[:target] = file key[:provider] = :parsed @@ -100,7 +100,7 @@ class TestSSHKey < Test::Unit::TestCase end def test_removal - sshkey = mkkey() + sshkey = mkkey assert_nothing_raised { sshkey[:ensure] = :present } @@ -121,7 +121,7 @@ class TestSSHKey < Test::Unit::TestCase keys = [] names = [] 3.times { - k = mkkey() + k = mkkey #h[:ensure] = :present #h.retrieve keys << k @@ -133,7 +133,7 @@ class TestSSHKey < Test::Unit::TestCase @catalog.clear(true) @catalog = nil - newkey = mkkey() + newkey = mkkey #newkey[:ensure] = :present names << newkey.name assert_apply(newkey) diff --git a/test/ral/type/user.rb b/test/ral/type/user.rb index 26cf7b1e8..9927d705e 100755 --- a/test/ral/type/user.rb +++ b/test/ral/type/user.rb @@ -70,7 +70,7 @@ class TestUser < Test::Unit::TestCase :name => name, :comment => "Puppet Testing User", :gid => Puppet::Util::SUIDManager.gid, - :shell => findshell(), + :shell => findshell, :home => "/home/#{name}" ) @@ -82,7 +82,7 @@ class TestUser < Test::Unit::TestCase end def test_autorequire - file = tempfile() + file = tempfile comp = nil user = nil group =nil @@ -116,11 +116,11 @@ class TestUser < Test::Unit::TestCase } rels = nil - assert_nothing_raised() { rels = user.autorequire } + assert_nothing_raised { rels = user.autorequire } assert(rels.detect { |r| r.source == group }, "User did not require group") assert(rels.detect { |r| r.source == ogroup }, "User did not require other groups") - assert_nothing_raised() { rels = home.autorequire } + assert_nothing_raised { rels = home.autorequire } assert(rels.detect { |r| r.source == user }, "Homedir did not require user") end diff --git a/test/ral/type/yumrepo.rb b/test/ral/type/yumrepo.rb index 8efa83518..5469ae485 100755 --- a/test/ral/type/yumrepo.rb +++ b/test/ral/type/yumrepo.rb @@ -10,7 +10,7 @@ class TestYumRepo < Test::Unit::TestCase def setup super - @yumdir = tempfile() + @yumdir = tempfile Dir.mkdir(@yumdir) @yumconf = File.join(@yumdir, "yum.conf") File.open(@yumconf, "w") do |f| @@ -33,7 +33,7 @@ class TestYumRepo < Test::Unit::TestCase assert_equal('New description', devel.property(:descr).should) assert_apply(devel) - inifile = Puppet::Type.type(:yumrepo).read() + inifile = Puppet::Type.type(:yumrepo).read assert_equal('New description', inifile['development']['name']) assert_equal('Fedora Core $releasever - $basearch - Base', inifile['base']['name']) assert_equal("foo\n bar\n baz", inifile['base']['exclude']) @@ -56,7 +56,7 @@ class TestYumRepo < Test::Unit::TestCase repo = make_repo("base", values) assert_apply(repo) - inifile = Puppet::Type.type(:yumrepo).read() + inifile = Puppet::Type.type(:yumrepo).read sections = all_sections(inifile) assert_equal(['base', 'main'], sections) text = inifile["base"].format @@ -75,7 +75,7 @@ class TestYumRepo < Test::Unit::TestCase :baseurl => baseurl }) devel.retrieve assert_apply(devel) - inifile = Puppet::Type.type(:yumrepo).read() + inifile = Puppet::Type.type(:yumrepo).read sec = inifile["development"] assert_nil(sec["mirrorlist"]) assert_equal(baseurl, sec["baseurl"]) diff --git a/test/ral/type/zone.rb b/test/ral/type/zone.rb index f6ef98a6e..21440168c 100755 --- a/test/ral/type/zone.rb +++ b/test/ral/type/zone.rb @@ -16,7 +16,7 @@ class TestZone < PuppetTest::TestCase def mkzone(name) zone = nil - base = tempfile() + base = tempfile Dir.mkdir(base) File.chmod(0700, base) root = File.join(base, "zonebase") @@ -214,7 +214,7 @@ class TestZoneAsRoot < TestZone def test_getconfig zone = mkzone("configtesting") - base = tempfile() + base = tempfile zone[:path] = base ip = "192.168.0.1" @@ -223,7 +223,7 @@ class TestZoneAsRoot < TestZone IO.popen("zonecfg -z configtesting -f -", "w") do |f| f.puts %{create -b -set zonepath=#{tempfile()} +set zonepath=#{tempfile} set autoboot=true add inherit-pkg-dir set dir=/lib diff --git a/test/util/inifile.rb b/test/util/inifile.rb index 2d5841ca0..f465dfd58 100755 --- a/test/util/inifile.rb +++ b/test/util/inifile.rb @@ -131,7 +131,7 @@ class TestFileType < Test::Unit::TestCase end def mkfile(content) - file = tempfile() + file = tempfile File.open(file, "w") { |f| f.print(content) } file end diff --git a/test/util/log.rb b/test/util/log.rb index cbaa71a55..8d5c8c558 100755 --- a/test/util/log.rb +++ b/test/util/log.rb @@ -23,7 +23,7 @@ class TestLog < Test::Unit::TestCase def getlevels levels = nil - assert_nothing_raised() { + assert_nothing_raised { levels = [] Puppet::Util::Log.eachlevel { |level| levels << level } } @@ -34,7 +34,7 @@ class TestLog < Test::Unit::TestCase def mkmsgs(levels) levels.collect { |level| next if level == :alert - assert_nothing_raised() { + assert_nothing_raised { Puppet::Util::Log.new( @@ -52,9 +52,9 @@ class TestLog < Test::Unit::TestCase levels = nil Puppet::Util::Log.level = :debug levels = getlevels - logfile = tempfile() + logfile = tempfile fact = nil - assert_nothing_raised() { + assert_nothing_raised { Puppet::Util::Log.newdestination(logfile) } msgs = mkmsgs(levels) @@ -64,7 +64,7 @@ class TestLog < Test::Unit::TestCase assert(FileTest.exists?(logfile), "Did not create logfile") - assert_nothing_raised() { + assert_nothing_raised { File.open(logfile) { |of| count = of.readlines.length } @@ -74,12 +74,12 @@ class TestLog < Test::Unit::TestCase def test_syslog levels = nil - assert_nothing_raised() { + assert_nothing_raised { levels = getlevels.reject { |level| level == :emerg || level == :crit } } - assert_nothing_raised() { + assert_nothing_raised { Puppet::Util::Log.newdestination("syslog") } # there's really no way to verify that we got syslog messages... @@ -88,11 +88,11 @@ class TestLog < Test::Unit::TestCase end def test_levelmethods - assert_nothing_raised() { + assert_nothing_raised { Puppet::Util::Log.newdestination("/dev/null") } getlevels.each { |level| - assert_nothing_raised() { + assert_nothing_raised { Puppet.send(level,"Testing for #{level}") } } @@ -108,7 +108,7 @@ class TestLog < Test::Unit::TestCase end def test_creatingdirs - dir = tempfile() + dir = tempfile file = File.join(dir, "logfile") Puppet::Util::Log.newdestination file Puppet.info "testing logs" @@ -137,7 +137,7 @@ class TestLog < Test::Unit::TestCase file = Puppet::Type.type(:file).new( - :path => tempfile(), + :path => tempfile, :check => %w{owner group} ) diff --git a/test/util/settings.rb b/test/util/settings.rb index 2e2d0b019..d05f555ec 100755 --- a/test/util/settings.rb +++ b/test/util/settings.rb @@ -60,7 +60,7 @@ class TestSettings < Test::Unit::TestCase newc[name] = true end - newfile = tempfile() + newfile = tempfile File.open(newfile, "w") { |f| @config.to_config.split("\n").each do |line| # Uncomment the settings, so they actually take. @@ -207,7 +207,7 @@ class TestSettings < Test::Unit::TestCase attr3 = $attrdir/other } - file = tempfile() + file = tempfile File.open(file, "w") { |f| f.puts text } result = nil @@ -338,7 +338,7 @@ class TestSettings < Test::Unit::TestCase end def test_groupsetting - cfile = tempfile() + cfile = tempfile group = "yayness" @@ -363,15 +363,15 @@ class TestSettings < Test::Unit::TestCase def test_writingfiles File.umask(0022) - path = tempfile() + path = tempfile mode = 0644 config = mkconfig args = { :default => path, :mode => mode, :desc => "yay" } - user = nonrootuser() - group = nonrootgroup() + user = nonrootuser + group = nonrootgroup if Puppet.features.root? args[:owner] = user.name @@ -403,15 +403,15 @@ class TestSettings < Test::Unit::TestCase def test_mkdir File.umask(0022) - path = tempfile() + path = tempfile mode = 0755 config = mkconfig args = { :default => path, :mode => mode, :desc => "a file" } - user = nonrootuser() - group = nonrootgroup() + user = nonrootuser + group = nonrootgroup if Puppet.features.root? args[:owner] = user.name @@ -442,7 +442,7 @@ class TestSettings < Test::Unit::TestCase # Make sure that tags are ignored when configuring def test_configs_ignore_tags config = mkconfig - file = tempfile() + file = tempfile config.setdefaults( @@ -517,13 +517,13 @@ class TestSettings < Test::Unit::TestCase end def test_parse_removes_quotes - config = mkconfig() + config = mkconfig config.setdefaults(:mysection, :singleq => ["single", "yay"]) config.setdefaults(:mysection, :doubleq => ["double", "yay"]) config.setdefaults(:mysection, :none => ["noquote", "yay"]) config.setdefaults(:mysection, :middle => ["midquote", "yay"]) - file = tempfile() + file = tempfile # Set one parameter in the file File.open(file, "w") { |f| f.puts %{[main]\n @@ -549,7 +549,7 @@ class TestSettings < Test::Unit::TestCase # Test that config parameters correctly call passed-in blocks when the value # is set. def test_paramblocks - config = mkconfig() + config = mkconfig testing = nil assert_nothing_raised do @@ -603,7 +603,7 @@ class TestSettings < Test::Unit::TestCase config.setdefaults( :yay, - :mydir => {:default => tempfile(), + :mydir => {:default => tempfile, :mode => 0644, :owner => "root", @@ -642,8 +642,8 @@ class TestSettings < Test::Unit::TestCase # #415 def test_remove_trailing_spaces - config = mkconfig() - file = tempfile() + config = mkconfig + file = tempfile File.open(file, "w") { |f| f.puts "rah = something " } config.setdefaults(:yay, :config => [file, "eh"], :rah => ["testing", "a desc"]) @@ -654,9 +654,9 @@ class TestSettings < Test::Unit::TestCase # #484 def test_parsing_unknown_variables - logstore() - config = mkconfig() - file = tempfile() + logstore + config = mkconfig + file = tempfile File.open(file, "w") { |f| f.puts %{[main]\n one = one diff --git a/test/util/storage.rb b/test/util/storage.rb index ae28bf992..cde5d6414 100755 --- a/test/util/storage.rb +++ b/test/util/storage.rb @@ -9,7 +9,7 @@ class TestStorage < Test::Unit::TestCase include PuppetTest def mkfile - path = tempfile() + path = tempfile File.open(path, "w") { |f| f.puts :yayness } @@ -24,9 +24,9 @@ class TestStorage < Test::Unit::TestCase end def test_storeandretrieve - path = tempfile() + path = tempfile - f = mkfile() + f = mkfile # Load first, since that's what we do in the code base; this creates # all of the necessary directories. @@ -72,7 +72,7 @@ class TestStorage < Test::Unit::TestCase Puppet::Util::Storage.clear Puppet::Util::Storage.load - f = mkfile() + f = mkfile state = Puppet::Util::Storage.cache(f) assert_same Hash, state.class assert_equal 0, state.size diff --git a/test/util/subclass_loader.rb b/test/util/subclass_loader.rb index d2b035f6c..946bc2b34 100755 --- a/test/util/subclass_loader.rb +++ b/test/util/subclass_loader.rb @@ -16,7 +16,7 @@ class TestPuppetUtilSubclassLoader < Test::Unit::TestCase def mk_subclass(name, path, parent) # Make a fake client unless defined?(@basedir) - @basedir ||= tempfile() + @basedir ||= tempfile $LOAD_PATH << @basedir cleanup { $LOAD_PATH.delete(@basedir) if $LOAD_PATH.include?(@basedir) } end diff --git a/test/util/utiltest.rb b/test/util/utiltest.rb index a66b175e5..45c48727d 100755 --- a/test/util/utiltest.rb +++ b/test/util/utiltest.rb @@ -11,7 +11,7 @@ class TestPuppetUtil < Test::Unit::TestCase def test_withumask oldmask = File.umask - path = tempfile() + path = tempfile # FIXME this fails on FreeBSD with a mode of 01777 Puppet::Util.withumask(000) do @@ -23,7 +23,7 @@ class TestPuppetUtil < Test::Unit::TestCase end def test_benchmark - path = tempfile() + path = tempfile str = "yayness" File.open(path, "w") do |f| f.print "yayness" end @@ -119,7 +119,7 @@ class TestPuppetUtil < Test::Unit::TestCase end def test_execute - command = tempfile() + command = tempfile File.open(command, "w") { |f| f.puts %{#!/bin/sh\n/bin/echo "$1">&1; echo "$2">&2} } @@ -148,7 +148,7 @@ class TestPuppetUtil < Test::Unit::TestCase end # And that we can tell it not to fail - assert_nothing_raised() do + assert_nothing_raised do out = Puppet::Util.execute(["touch", "/no/such/file/could/exist"], :failonfail => false) end @@ -156,7 +156,7 @@ class TestPuppetUtil < Test::Unit::TestCase # Make sure we correctly set our uid and gid user = nonrootuser group = nonrootgroup - file = tempfile() + file = tempfile assert_nothing_raised do Puppet::Util.execute(["touch", file], :uid => user.name, :gid => group.name) end @@ -170,7 +170,7 @@ class TestPuppetUtil < Test::Unit::TestCase end # (#565) Test the case of patricide. - patricidecommand = tempfile() + patricidecommand = tempfile File.open(patricidecommand, "w") { |f| f.puts %{#!/bin/bash\n/bin/bash -c 'kill -TERM \$PPID' &;\n while [ 1 ]; do echo -n ''; done;\n} } @@ -220,7 +220,7 @@ class TestPuppetUtil < Test::Unit::TestCase end - # Check whether execute() accepts strings in addition to arrays. + # Check whether execute accepts strings in addition to arrays. def test_string_exec cmd = "/bin/echo howdy" output = nil -- cgit