From c5a1ca0b34a57366415df60099ab0918a7579469 Mon Sep 17 00:00:00 2001 From: Derek Olsen Date: Wed, 24 Nov 2010 11:11:43 -0800 Subject: (#5391) Include additional zfs properties We added the following zfs properties to the zfs provider :recordsize, :aclmode, :aclinherit, :primarycache, :secondarycache Currently zfs users have to chain an exec to the zfs filesystem creation and the inclusion of these properties would allow puppet to set them natively. --- lib/puppet/provider/zfs/solaris.rb | 2 +- lib/puppet/type/zfs.rb | 23 +++++++++++++++++++++-- spec/unit/provider/zfs/solaris_spec.rb | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/zfs/solaris.rb b/lib/puppet/provider/zfs/solaris.rb index 85d054f86..9aec9d801 100644 --- a/lib/puppet/provider/zfs/solaris.rb +++ b/lib/puppet/provider/zfs/solaris.rb @@ -31,7 +31,7 @@ Puppet::Type.type(:zfs).provide(:solaris) do end end - [:mountpoint, :compression, :copies, :quota, :reservation, :sharenfs, :snapdir].each do |field| + [:mountpoint, :recordsize, :aclmode, :aclinherit, :primarycache, :secondarycache, :compression, :copies, :quota, :reservation, :sharenfs, :snapdir].each do |field| define_method(field) do zfs(:get, "-H", "-o", "value", field, @resource[:name]).strip end diff --git a/lib/puppet/type/zfs.rb b/lib/puppet/type/zfs.rb index e1a972ddf..be18ab5aa 100755 --- a/lib/puppet/type/zfs.rb +++ b/lib/puppet/type/zfs.rb @@ -12,6 +12,26 @@ module Puppet desc "The mountpoint property." end + newproperty(:recordsize) do + desc "The recordsize property." + end + + newproperty(:aclmode) do + desc "The aclmode property." + end + + newproperty(:aclinherit) do + desc "The aclinherit property." + end + + newproperty(:primarycache) do + desc "The primarycache property." + end + + newproperty(:secondarycache) do + desc "The secondarycache property." + end + newproperty(:compression) do desc "The compression property." end @@ -33,7 +53,7 @@ module Puppet end newproperty(:snapdir) do - desc "The sharenfs property." + desc "The snapdir property." end autorequire(:zpool) do @@ -48,4 +68,3 @@ module Puppet end end end - diff --git a/spec/unit/provider/zfs/solaris_spec.rb b/spec/unit/provider/zfs/solaris_spec.rb index 43a88b1c7..9d1f364e0 100755 --- a/spec/unit/provider/zfs/solaris_spec.rb +++ b/spec/unit/provider/zfs/solaris_spec.rb @@ -75,7 +75,7 @@ describe provider_class do end - [:mountpoint, :compression, :copies, :quota, :reservation, :sharenfs, :snapdir].each do |prop| + [:mountpoint, :recordsize, :aclmode, :aclinherit, :primarycache, :secondarycache, :compression, :copies, :quota, :reservation, :sharenfs, :snapdir].each do |prop| describe "when getting the #{prop} value" do it "should call zfs with :get, #{prop} and this zfs" do @provider.expects(:zfs).with(:get, "-H", "-o", "value", prop, @resource[:name]).returns("value\n") -- cgit From 0f00bf45872412605a497b3929df0bbb0fa7dd67 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Wed, 24 Nov 2010 12:22:34 -0800 Subject: Maint: Removed unused monkey patch that connected OpenSSL::PKey::RSA to indirector This file was never being required, and was inconsistent with the way SSL is used in the indirector. Paired-with: Jesse Wolfe --- lib/puppet/sslcertificates/monkey_patch.rb | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 lib/puppet/sslcertificates/monkey_patch.rb diff --git a/lib/puppet/sslcertificates/monkey_patch.rb b/lib/puppet/sslcertificates/monkey_patch.rb deleted file mode 100644 index 663b944c1..000000000 --- a/lib/puppet/sslcertificates/monkey_patch.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This is the file that we use to add indirection to all the SSL Certificate classes. - -require 'puppet/indirector' - -OpenSSL::PKey::RSA.extend Puppet::Indirector -OpenSSL::PKey::RSA.indirects :ssl_rsa, :terminus_class => :file -- cgit From 83f878e2304595f803e105abb9b5e77d7ce3272a Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Mon, 29 Nov 2010 18:37:44 +1100 Subject: Renamed Reductive to Puppet I swear I've done this before. *confused* --- ext/nagios/naggen | 2 +- ext/puppet-test | 2 +- lib/puppet/util/command_line/filebucket | 2 +- lib/puppet/util/command_line/pi | 2 +- lib/puppet/util/command_line/puppet | 2 +- lib/puppet/util/command_line/puppetca | 2 +- lib/puppet/util/command_line/puppetd | 2 +- lib/puppet/util/command_line/puppetdoc | 4 ++-- lib/puppet/util/command_line/puppetmasterd | 2 +- lib/puppet/util/command_line/puppetqd | 2 +- lib/puppet/util/command_line/puppetrun | 2 +- lib/puppet/util/command_line/ralsh | 2 +- man/man8/filebucket.8 | 2 +- man/man8/pi.8 | 2 +- man/man8/puppetca.8 | 2 +- man/man8/puppetd.8 | 2 +- man/man8/puppetdoc.8 | 4 ++-- man/man8/puppetmasterd.8 | 2 +- man/man8/puppetqd.8 | 2 +- man/man8/puppetrun.8 | 2 +- man/man8/ralsh.8 | 2 +- test/test | 2 +- 22 files changed, 24 insertions(+), 24 deletions(-) diff --git a/ext/nagios/naggen b/ext/nagios/naggen index a9e04c47a..c6ca15a55 100755 --- a/ext/nagios/naggen +++ b/ext/nagios/naggen @@ -63,7 +63,7 @@ # # = Copyright # -# Copyright (c) 2009 Reductive Labs, LLC +# Copyright (c) 2009 Puppet Labs, LLC # Licensed under the GPL 2 require 'puppet' diff --git a/ext/puppet-test b/ext/puppet-test index 61397e74b..f2648c9ee 100755 --- a/ext/puppet-test +++ b/ext/puppet-test @@ -90,7 +90,7 @@ # # = Copyright # -# Copyright (c) 2005, 2006 Reductive Labs, LLC +# Copyright (c) 2005, 2006 Puppet Labs, LLC # Licensed under the GNU Public License # Do an initial trap, so that cancels don't get a stack trace. diff --git a/lib/puppet/util/command_line/filebucket b/lib/puppet/util/command_line/filebucket index 8302d7b12..34b01508e 100755 --- a/lib/puppet/util/command_line/filebucket +++ b/lib/puppet/util/command_line/filebucket @@ -91,7 +91,7 @@ # # = Copyright # -# Copyright (c) 2005 Reductive Labs, LLC +# Copyright (c) 2005 Puppet Labs, LLC # Licensed under the GNU Public License #Puppet::Application[:filebucket].run diff --git a/lib/puppet/util/command_line/pi b/lib/puppet/util/command_line/pi index ae3c46e9a..3d80eea8f 100755 --- a/lib/puppet/util/command_line/pi +++ b/lib/puppet/util/command_line/pi @@ -42,7 +42,7 @@ # # = Copyright # -# Copyright (c) 2005 Reductive Labs, LLC +# Copyright (c) 2005 Puppet Labs, LLC # Licensed under the GNU Public License #Puppet::Application[:describe].run diff --git a/lib/puppet/util/command_line/puppet b/lib/puppet/util/command_line/puppet index 7b6c0ae7f..e75b92af8 100755 --- a/lib/puppet/util/command_line/puppet +++ b/lib/puppet/util/command_line/puppet @@ -63,7 +63,7 @@ # # = Copyright # -# Copyright (c) 2005 Reductive Labs, LLC +# Copyright (c) 2005 Puppet Labs, LLC # Licensed under the GNU Public License #Puppet::Application[:apply].run diff --git a/lib/puppet/util/command_line/puppetca b/lib/puppet/util/command_line/puppetca index 4f1a88da5..9aa7e907c 100755 --- a/lib/puppet/util/command_line/puppetca +++ b/lib/puppet/util/command_line/puppetca @@ -104,7 +104,7 @@ # # = Copyright # -# Copyright (c) 2005 Reductive Labs, LLC +# Copyright (c) 2005 Puppet Labs, LLC # Licensed under the GNU Public License #Puppet::Application[:cert].run diff --git a/lib/puppet/util/command_line/puppetd b/lib/puppet/util/command_line/puppetd index 571b15486..cb8589c5f 100755 --- a/lib/puppet/util/command_line/puppetd +++ b/lib/puppet/util/command_line/puppetd @@ -180,7 +180,7 @@ # # = Copyright # -# Copyright (c) 2005, 2006 Reductive Labs, LLC +# Copyright (c) 2005, 2006 Puppet Labs, LLC # Licensed under the GNU Public License #Puppet::Application[:agent].run diff --git a/lib/puppet/util/command_line/puppetdoc b/lib/puppet/util/command_line/puppetdoc index 0fa1830d6..8f24ea5ef 100755 --- a/lib/puppet/util/command_line/puppetdoc +++ b/lib/puppet/util/command_line/puppetdoc @@ -3,7 +3,7 @@ # # = Synopsis # -# Generate a reference for all Puppet types. Largely meant for internal Reductive +# Generate a reference for all Puppet types. Largely meant for internal Puppet # Labs use. # # = Usage @@ -61,7 +61,7 @@ # # = Copyright # -# Copyright (c) 2005-2007 Reductive Labs, LLC +# Copyright (c) 2005-2007 Puppet Labs, LLC # Licensed under the GNU Public License #Puppet::Application[:doc].run diff --git a/lib/puppet/util/command_line/puppetmasterd b/lib/puppet/util/command_line/puppetmasterd index 74efb3818..baf8a7581 100755 --- a/lib/puppet/util/command_line/puppetmasterd +++ b/lib/puppet/util/command_line/puppetmasterd @@ -59,7 +59,7 @@ # # = Copyright # -# Copyright (c) 2005 Reductive Labs, LLC +# Copyright (c) 2005 Puppet Labs, LLC # Licensed under the GNU Public License #Puppet::Application[:master].run diff --git a/lib/puppet/util/command_line/puppetqd b/lib/puppet/util/command_line/puppetqd index 48fc952bd..81963d537 100755 --- a/lib/puppet/util/command_line/puppetqd +++ b/lib/puppet/util/command_line/puppetqd @@ -47,7 +47,7 @@ # # = Copyright # -# Copyright (c) 2009 Reductive Labs, LLC +# Copyright (c) 2009 Puppet Labs, LLC # Licensed under the GNU Public License #Puppet::Application[:queue].run diff --git a/lib/puppet/util/command_line/puppetrun b/lib/puppet/util/command_line/puppetrun index 27cd775b9..7eba3b2c4 100755 --- a/lib/puppet/util/command_line/puppetrun +++ b/lib/puppet/util/command_line/puppetrun @@ -120,7 +120,7 @@ # # = Copyright # -# Copyright (c) 2005 Reductive Labs, LLC +# Copyright (c) 2005 Puppet Labs, LLC # Licensed under the GNU Public License #Puppet::Application[:kick].run diff --git a/lib/puppet/util/command_line/ralsh b/lib/puppet/util/command_line/ralsh index 83338fcbc..5c1f719e2 100755 --- a/lib/puppet/util/command_line/ralsh +++ b/lib/puppet/util/command_line/ralsh @@ -83,7 +83,7 @@ # # = Copyright # -# Copyright (c) 2005-2007 Reductive Labs, LLC +# Copyright (c) 2005-2007 Puppet Labs, LLC # Licensed under the GNU Public License #Puppet::Application[:resource].run diff --git a/man/man8/filebucket.8 b/man/man8/filebucket.8 index 60a6eb28e..59afc2ed3 100644 --- a/man/man8/filebucket.8 +++ b/man/man8/filebucket.8 @@ -102,4 +102,4 @@ server: The server to send the file to, instead of locally\. verbose: Print extra information\. . .P -version: Print version information\.puppet filebucket \-b /tmp/filebucket /my/fileLuke KaniesCopyright (c) 2005 Reductive Labs, LLC Licensed under the GNU Public License +version: Print version information\.puppet filebucket \-b /tmp/filebucket /my/fileLuke KaniesCopyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/pi.8 b/man/man8/pi.8 index e8f5ab531..b70a128e7 100644 --- a/man/man8/pi.8 +++ b/man/man8/pi.8 @@ -14,4 +14,4 @@ list: List all types meta: List all metaparameters . .P -short: List only parameters without detailpuppet describe \-\-list puppet describe file \-\-providers puppet describe user \-s \-mDavid LutterkortCopyright (c) 2005 Reductive Labs, LLC Licensed under the GNU Public License +short: List only parameters without detailpuppet describe \-\-list puppet describe file \-\-providers puppet describe user \-s \-mDavid LutterkortCopyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppetca.8 b/man/man8/puppetca.8 index 17369aa20..62fa7a5bf 100644 --- a/man/man8/puppetca.8 +++ b/man/man8/puppetca.8 @@ -166,4 +166,4 @@ verify: Verify the named certificate against the local CA .fi . .IP "" 0 -$ puppet cert \-l culain\.madstop\.com $ puppet cert \-s culain\.madstop\.comLuke KaniesCopyright (c) 2005 Reductive Labs, LLC Licensed under the GNU Public License +$ puppet cert \-l culain\.madstop\.com $ puppet cert \-s culain\.madstop\.comLuke KaniesCopyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppetd.8 b/man/man8/puppetd.8 index 32aede791..861137553 100644 --- a/man/man8/puppetd.8 +++ b/man/man8/puppetd.8 @@ -280,4 +280,4 @@ waitforcert: This option only matters for daemons that do not yet .fi . .IP "" 0 -puppet agent \-\-server puppet\.domain\.comLuke KaniesCopyright (c) 2005, 2006 Reductive Labs, LLC Licensed under the GNU Public License +puppet agent \-\-server puppet\.domain\.comLuke KaniesCopyright (c) 2005, 2006 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppetdoc.8 b/man/man8/puppetdoc.8 index 5fc01c2ba..47df0e764 100644 --- a/man/man8/puppetdoc.8 +++ b/man/man8/puppetdoc.8 @@ -2,7 +2,7 @@ .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "PUPPETDOC" "8" "August 2010" "" "" -Generate a reference for all Puppet types\. Largely meant for internal Reductive Labs use\.puppet doc [\-a|\-\-all] [\-h|\-\-help] [\-o|\-\-outputdir \fIrdoc outputdir\fR] [\-m|\-\-mode \fItext|pdf|rdoc\fR] +Generate a reference for all Puppet types\. Largely meant for internal Puppet Labs use\.puppet doc [\-a|\-\-all] [\-h|\-\-help] [\-o|\-\-outputdir \fIrdoc outputdir\fR] [\-m|\-\-mode \fItext|pdf|rdoc\fR] . .IP "" 4 . @@ -105,4 +105,4 @@ $ puppet doc /etc/puppet/manifests/site\.pp or . .P -$ puppet doc \-m pdf \-r configurationLuke KaniesCopyright (c) 2005\-2007 Reductive Labs, LLC Licensed under the GNU Public License +$ puppet doc \-m pdf \-r configurationLuke KaniesCopyright (c) 2005\-2007 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppetmasterd.8 b/man/man8/puppetmasterd.8 index 3ae567a69..dde93a3d6 100644 --- a/man/man8/puppetmasterd.8 +++ b/man/man8/puppetmasterd.8 @@ -49,4 +49,4 @@ logdest: Where to send messages\. Choose between syslog, the verbose: Enable verbosity\. . .P -version: Print the puppet version number and exit\.puppet masterLuke KaniesCopyright (c) 2005 Reductive Labs, LLC Licensed under the GNU Public License +version: Print the puppet version number and exit\.puppet masterLuke KaniesCopyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppetqd.8 b/man/man8/puppetqd.8 index 137a13af3..f630c74a5 100644 --- a/man/man8/puppetqd.8 +++ b/man/man8/puppetqd.8 @@ -17,4 +17,4 @@ help: Print this help message verbose: Turn on verbose reporting\. . .P -version: Print the puppet version number and exit\.puppet queueLuke KaniesCopyright (c) 2009 Reductive Labs, LLC Licensed under the GNU Public License +version: Print the puppet version number and exit\.puppet queueLuke KaniesCopyright (c) 2009 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/puppetrun.8 b/man/man8/puppetrun.8 index b3c27c3a7..09fa31b15 100644 --- a/man/man8/puppetrun.8 +++ b/man/man8/puppetrun.8 @@ -170,4 +170,4 @@ test: Print the hosts you would connect to but do not ping:: . .P -Do a ICMP echo against the target host\. Skip hosts that don\'t respond to ping\.sudo puppet kick \-p 10 \-t remotefile \-t webserver host1 host2Luke KaniesCopyright (c) 2005 Reductive Labs, LLC Licensed under the GNU Public License +Do a ICMP echo against the target host\. Skip hosts that don\'t respond to ping\.sudo puppet kick \-p 10 \-t remotefile \-t webserver host1 host2Luke KaniesCopyright (c) 2005 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/man/man8/ralsh.8 b/man/man8/ralsh.8 index e387e2324..bdc81e90a 100644 --- a/man/man8/ralsh.8 +++ b/man/man8/ralsh.8 @@ -82,4 +82,4 @@ Print extra information\.This example uses \fBpuppet resource\fR to return Puppe .fi . .IP "" 0 -Luke KaniesCopyright (c) 2005\-2007 Reductive Labs, LLC Licensed under the GNU Public License +Luke KaniesCopyright (c) 2005\-2007 Puppet Labs, LLC Licensed under the GNU Public License diff --git a/test/test b/test/test index 097885751..c8b9b08ef 100755 --- a/test/test +++ b/test/test @@ -68,7 +68,7 @@ # # = Copyright # -# Copyright (c) 2005 Reductive Labs, LLC +# Copyright (c) 2005 Puppet Labs, LLC # Licensed under the GNU Public License require 'find' -- cgit From 14f8160674628340ccfd79baeb84f66cf1e0398a Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 29 Nov 2010 11:55:00 -0800 Subject: Maint: Refactor tests to use .indirection. Replaced uses of the find, search, destroy, and expire methods on model classes with direct calls to the indirection objects. This change affects tests only. --- spec/integration/defaults_spec.rb | 32 ++--- .../indirector/catalog/compiler_spec.rb | 6 +- .../indirector/file_content/file_server_spec.rb | 6 +- spec/integration/indirector/node/ldap_spec.rb | 2 +- spec/integration/network/server/webrick_spec.rb | 2 +- spec/integration/node/facts_spec.rb | 6 +- spec/integration/node_spec.rb | 18 +-- spec/integration/resource/catalog_spec.rb | 8 +- spec/integration/ssl/certificate_authority_spec.rb | 10 +- spec/integration/ssl/certificate_request_spec.rb | 4 +- spec/integration/ssl/host_spec.rb | 4 +- spec/shared_behaviours/file_serving.rb | 14 +- spec/unit/application/agent_spec.rb | 22 ++-- spec/unit/application/apply_spec.rb | 20 +-- spec/unit/application/kick_spec.rb | 6 +- spec/unit/application/master_spec.rb | 22 ++-- spec/unit/application/queue_spec.rb | 6 +- spec/unit/application/resource_spec.rb | 20 +-- spec/unit/configurer/fact_handler_spec.rb | 6 +- spec/unit/configurer_spec.rb | 40 +++--- spec/unit/file_bucket/dipper_spec.rb | 4 +- spec/unit/file_bucket/file_spec.rb | 16 +-- spec/unit/indirector/catalog/active_record_spec.rb | 2 +- spec/unit/indirector/catalog/compiler_spec.rb | 32 ++--- spec/unit/indirector/node/ldap_spec.rb | 2 +- spec/unit/indirector_spec.rb | 48 ------- spec/unit/network/http/webrick_spec.rb | 4 +- spec/unit/node/facts_spec.rb | 6 - spec/unit/node_spec.rb | 11 +- spec/unit/resource/catalog_spec.rb | 6 - spec/unit/ssl/certificate_authority_spec.rb | 66 +++++----- spec/unit/ssl/host_spec.rb | 142 ++++++++++----------- spec/unit/ssl/inventory_spec.rb | 4 +- spec/unit/status_spec.rb | 4 +- spec/unit/transaction/report_spec.rb | 7 - spec/unit/type/file/source_spec.rb | 14 +- spec/unit/type/file_spec.rb | 18 +-- test/language/parser.rb | 12 +- test/language/scope.rb | 6 +- test/language/snippets.rb | 2 +- test/network/handler/master.rb | 6 +- 41 files changed, 292 insertions(+), 374 deletions(-) diff --git a/spec/integration/defaults_spec.rb b/spec/integration/defaults_spec.rb index 2f30014e8..051f3e528 100755 --- a/spec/integration/defaults_spec.rb +++ b/spec/integration/defaults_spec.rb @@ -116,31 +116,31 @@ describe "Puppet defaults" do describe "when enabling storeconfigs" do before do - Puppet::Resource::Catalog.stubs(:cache_class=) - Puppet::Node::Facts.stubs(:cache_class=) - Puppet::Node.stubs(:cache_class=) + Puppet::Resource::Catalog.indirection.stubs(:cache_class=) + Puppet::Node::Facts.indirection.stubs(:cache_class=) + Puppet::Node.indirection.stubs(:cache_class=) Puppet.features.stubs(:rails?).returns true end it "should set the Catalog cache class to :active_record" do - Puppet::Resource::Catalog.expects(:cache_class=).with(:active_record) + Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(:active_record) Puppet.settings[:storeconfigs] = true end it "should not set the Catalog cache class to :active_record if asynchronous storeconfigs is enabled" do - Puppet::Resource::Catalog.expects(:cache_class=).with(:active_record).never + Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(:active_record).never Puppet.settings.expects(:value).with(:async_storeconfigs).returns true Puppet.settings[:storeconfigs] = true end it "should set the Facts cache class to :active_record" do - Puppet::Node::Facts.expects(:cache_class=).with(:active_record) + Puppet::Node::Facts.indirection.expects(:cache_class=).with(:active_record) Puppet.settings[:storeconfigs] = true end it "should set the Node cache class to :active_record" do - Puppet::Node.expects(:cache_class=).with(:active_record) + Puppet::Node.indirection.expects(:cache_class=).with(:active_record) Puppet.settings[:storeconfigs] = true end @@ -152,9 +152,9 @@ describe "Puppet defaults" do describe "when enabling asynchronous storeconfigs" do before do - Puppet::Resource::Catalog.stubs(:cache_class=) - Puppet::Node::Facts.stubs(:cache_class=) - Puppet::Node.stubs(:cache_class=) + Puppet::Resource::Catalog.indirection.stubs(:cache_class=) + Puppet::Node::Facts.indirection.stubs(:cache_class=) + Puppet::Node.indirection.stubs(:cache_class=) Puppet.features.stubs(:rails?).returns true end @@ -164,26 +164,26 @@ describe "Puppet defaults" do end it "should set the Catalog cache class to :queue" do - Puppet::Resource::Catalog.expects(:cache_class=).with(:queue) + Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(:queue) Puppet.settings[:async_storeconfigs] = true end it "should set the Facts cache class to :active_record" do - Puppet::Node::Facts.expects(:cache_class=).with(:active_record) + Puppet::Node::Facts.indirection.expects(:cache_class=).with(:active_record) Puppet.settings[:storeconfigs] = true end it "should set the Node cache class to :active_record" do - Puppet::Node.expects(:cache_class=).with(:active_record) + Puppet::Node.indirection.expects(:cache_class=).with(:active_record) Puppet.settings[:storeconfigs] = true end end describe "when enabling thin storeconfigs" do before do - Puppet::Resource::Catalog.stubs(:cache_class=) - Puppet::Node::Facts.stubs(:cache_class=) - Puppet::Node.stubs(:cache_class=) + Puppet::Resource::Catalog.indirection.stubs(:cache_class=) + Puppet::Node::Facts.indirection.stubs(:cache_class=) + Puppet::Node.indirection.stubs(:cache_class=) Puppet.features.stubs(:rails?).returns true end diff --git a/spec/integration/indirector/catalog/compiler_spec.rb b/spec/integration/indirector/catalog/compiler_spec.rb index ede502e3c..dcb7eb425 100755 --- a/spec/integration/indirector/catalog/compiler_spec.rb +++ b/spec/integration/indirector/catalog/compiler_spec.rb @@ -42,7 +42,7 @@ describe Puppet::Resource::Catalog::Compiler do Puppet::Resource::Catalog.indirection.terminus.stubs(:node_from_request) Puppet::Resource::Catalog.indirection.terminus.stubs(:compile).returns(@catalog) - Puppet::Resource::Catalog.find(request).resource_refs.should == [ @two.ref ] + Puppet::Resource::Catalog.indirection.find(request).resource_refs.should == [ @two.ref ] end it "should not filter out exported resources when finding a catalog" do @@ -52,7 +52,7 @@ describe Puppet::Resource::Catalog::Compiler do Puppet::Resource::Catalog.indirection.terminus.stubs(:node_from_request) Puppet::Resource::Catalog.indirection.terminus.stubs(:compile).returns(@catalog) - Puppet::Resource::Catalog.find(request).resource_refs.sort.should == [ @one.ref, @two.ref ] + Puppet::Resource::Catalog.indirection.find(request).resource_refs.sort.should == [ @one.ref, @two.ref ] end it "should filter out virtual exported resources when finding a catalog" do @@ -63,6 +63,6 @@ describe Puppet::Resource::Catalog::Compiler do Puppet::Resource::Catalog.indirection.terminus.stubs(:node_from_request) Puppet::Resource::Catalog.indirection.terminus.stubs(:compile).returns(@catalog) - Puppet::Resource::Catalog.find(request).resource_refs.should == [ @two.ref ] + Puppet::Resource::Catalog.indirection.find(request).resource_refs.should == [ @two.ref ] end end diff --git a/spec/integration/indirector/file_content/file_server_spec.rb b/spec/integration/indirector/file_content/file_server_spec.rb index 5de7f1de0..2992c40f2 100755 --- a/spec/integration/indirector/file_content/file_server_spec.rb +++ b/spec/integration/indirector/file_content/file_server_spec.rb @@ -34,7 +34,7 @@ describe Puppet::Indirector::FileContent::FileServer, " when finding files" do env = Puppet::Node::Environment.new("foo") env.stubs(:modulepath).returns [path] - result = Puppet::FileServing::Content.search("plugins", :environment => "foo", :recurse => true) + result = Puppet::FileServing::Content.indirection.search("plugins", :environment => "foo", :recurse => true) result.should_not be_nil result.length.should == 2 @@ -54,7 +54,7 @@ describe Puppet::Indirector::FileContent::FileServer, " when finding files" do Puppet.settings[:modulepath] = path - result = Puppet::FileServing::Content.find("modules/mymod/myfile") + result = Puppet::FileServing::Content.indirection.find("modules/mymod/myfile") result.should_not be_nil result.should be_instance_of(Puppet::FileServing::Content) @@ -85,7 +85,7 @@ describe Puppet::Indirector::FileContent::FileServer, " when finding files" do path = File.join(@path, "myfile") - result = Puppet::FileServing::Content.find("one/myfile", :environment => "foo", :node => "mynode") + result = Puppet::FileServing::Content.indirection.find("one/myfile", :environment => "foo", :node => "mynode") result.should_not be_nil result.should be_instance_of(Puppet::FileServing::Content) diff --git a/spec/integration/indirector/node/ldap_spec.rb b/spec/integration/indirector/node/ldap_spec.rb index e4c0867ad..b13f3c033 100755 --- a/spec/integration/indirector/node/ldap_spec.rb +++ b/spec/integration/indirector/node/ldap_spec.rb @@ -10,6 +10,6 @@ describe Puppet::Node::Ldap do Puppet::Node.indirection.stubs(:terminus).returns ldap ldap.expects(:ldapsearch).with("(&(objectclass=puppetClient)(puppetclass=foo))") - Puppet::Node.search "eh", :class => "foo" + Puppet::Node.indirection.search "eh", :class => "foo" end end diff --git a/spec/integration/network/server/webrick_spec.rb b/spec/integration/network/server/webrick_spec.rb index 2b14dfb37..37a6bd5c5 100755 --- a/spec/integration/network/server/webrick_spec.rb +++ b/spec/integration/network/server/webrick_spec.rb @@ -23,7 +23,7 @@ describe Puppet::Network::Server do Puppet::SSL::Host.ca_location = :local ca = Puppet::SSL::CertificateAuthority.new - ca.generate(Puppet[:certname]) unless Puppet::SSL::Certificate.find(Puppet[:certname]) + ca.generate(Puppet[:certname]) unless Puppet::SSL::Certificate.indirection.find(Puppet[:certname]) end after do diff --git a/spec/integration/node/facts_spec.rb b/spec/integration/node/facts_spec.rb index 4cc2f4c1f..047d9d461 100755 --- a/spec/integration/node/facts_spec.rb +++ b/spec/integration/node/facts_spec.rb @@ -16,7 +16,7 @@ describe Puppet::Node::Facts do terminus = Puppet::Node::Facts.indirection.terminus(:yaml) terminus.stubs :save - Puppet::Node.expects(:expire).with("me") + Puppet::Node.indirection.expects(:expire).with("me") facts = Puppet::Node::Facts.new("me") facts.save @@ -31,7 +31,7 @@ describe Puppet::Node::Facts do terminus.expects(:path).with("me").returns "/my/yaml/file" FileTest.expects(:exist?).with("/my/yaml/file").returns false - Puppet::Node::Facts.find("me").should be_nil + Puppet::Node::Facts.indirection.find("me").should be_nil end it "should be able to delegate to the :facter terminus" do @@ -41,7 +41,7 @@ describe Puppet::Node::Facts do facts = Puppet::Node::Facts.new("me") Puppet::Node::Facts.expects(:new).with("me", "facter_hash").returns facts - Puppet::Node::Facts.find("me").should equal(facts) + Puppet::Node::Facts.indirection.find("me").should equal(facts) end end end diff --git a/spec/integration/node_spec.rb b/spec/integration/node_spec.rb index c635e7f32..0d46259dd 100755 --- a/spec/integration/node_spec.rb +++ b/spec/integration/node_spec.rb @@ -24,7 +24,7 @@ describe Puppet::Node do terminus.expects(:translate).with(@name, "myresults").returns "translated_results" terminus.expects(:create_node).with(@name, "translated_results").returns @node - Puppet::Node.find(@name).should equal(@node) + Puppet::Node.indirection.find(@name).should equal(@node) end it "should be able to use the yaml terminus" do @@ -36,7 +36,7 @@ describe Puppet::Node do terminus.expects(:path).with(@name).returns "/my/yaml/file" FileTest.expects(:exist?).with("/my/yaml/file").returns false - Puppet::Node.find(@name).should be_nil + Puppet::Node.indirection.find(@name).should be_nil end it "should have an ldap terminus" do @@ -51,7 +51,7 @@ describe Puppet::Node do Puppet::Node.expects(:new).with(@name).returns @node - Puppet::Node.find(@name).should equal(@node) + Puppet::Node.indirection.find(@name).should equal(@node) end describe "and using the memory terminus" do @@ -64,29 +64,29 @@ describe Puppet::Node do end it "should find no nodes by default" do - Puppet::Node.find(@name).should be_nil + Puppet::Node.indirection.find(@name).should be_nil end it "should be able to find nodes that were previously saved" do @node.save - Puppet::Node.find(@name).should equal(@node) + Puppet::Node.indirection.find(@name).should equal(@node) end it "should replace existing saved nodes when a new node with the same name is saved" do @node.save two = Puppet::Node.new(@name) two.save - Puppet::Node.find(@name).should equal(two) + Puppet::Node.indirection.find(@name).should equal(two) end it "should be able to remove previously saved nodes" do @node.save - Puppet::Node.destroy(@node.name) - Puppet::Node.find(@name).should be_nil + Puppet::Node.indirection.destroy(@node.name) + Puppet::Node.indirection.find(@name).should be_nil end it "should fail when asked to destroy a node that does not exist" do - proc { Puppet::Node.destroy(@node) }.should raise_error(ArgumentError) + proc { Puppet::Node.indirection.destroy(@node) }.should raise_error(ArgumentError) end end end diff --git a/spec/integration/resource/catalog_spec.rb b/spec/integration/resource/catalog_spec.rb index 0a3d47a80..206fe909c 100755 --- a/spec/integration/resource/catalog_spec.rb +++ b/spec/integration/resource/catalog_spec.rb @@ -30,7 +30,7 @@ describe Puppet::Resource::Catalog do terminus.expects(:path).with("me").returns "/my/yaml/file" FileTest.expects(:exist?).with("/my/yaml/file").returns false - Puppet::Resource::Catalog.find("me").should be_nil + Puppet::Resource::Catalog.indirection.find("me").should be_nil end it "should be able to delegate to the :compiler terminus" do @@ -42,10 +42,10 @@ describe Puppet::Resource::Catalog do node = mock 'node' node.stub_everything - Puppet::Node.expects(:find).returns(node) + Puppet::Node.indirection.expects(:find).returns(node) compiler.expects(:compile).with(node).returns nil - Puppet::Resource::Catalog.find("me").should be_nil + Puppet::Resource::Catalog.indirection.find("me").should be_nil end it "should pass provided node information directly to the terminus" do @@ -55,7 +55,7 @@ describe Puppet::Resource::Catalog do node = mock 'node' terminus.expects(:find).with { |request| request.options[:use_node] == node } - Puppet::Resource::Catalog.find("me", :use_node => node) + Puppet::Resource::Catalog.indirection.find("me", :use_node => node) end end end diff --git a/spec/integration/ssl/certificate_authority_spec.rb b/spec/integration/ssl/certificate_authority_spec.rb index 67ff6f215..622f7ed01 100755 --- a/spec/integration/ssl/certificate_authority_spec.rb +++ b/spec/integration/ssl/certificate_authority_spec.rb @@ -47,7 +47,7 @@ describe Puppet::SSL::CertificateAuthority do it "should be able to generate a new host certificate" do @ca.generate("newhost") - Puppet::SSL::Certificate.find("newhost").should be_instance_of(Puppet::SSL::Certificate) + Puppet::SSL::Certificate.indirection.find("newhost").should be_instance_of(Puppet::SSL::Certificate) end it "should be able to revoke a host certificate" do @@ -94,7 +94,7 @@ describe Puppet::SSL::CertificateAuthority do it "should save the signed certificate" do @ca.sign("luke.madstop.com") - Puppet::SSL::Certificate.find("luke.madstop.com").should be_instance_of(Puppet::SSL::Certificate) + Puppet::SSL::Certificate.indirection.find("luke.madstop.com").should be_instance_of(Puppet::SSL::Certificate) end it "should be able to sign multiple certificates" do @@ -107,15 +107,15 @@ describe Puppet::SSL::CertificateAuthority do @ca.sign("luke.madstop.com") @ca.sign("other.madstop.com") - Puppet::SSL::Certificate.find("other.madstop.com").should be_instance_of(Puppet::SSL::Certificate) - Puppet::SSL::Certificate.find("luke.madstop.com").should be_instance_of(Puppet::SSL::Certificate) + Puppet::SSL::Certificate.indirection.find("other.madstop.com").should be_instance_of(Puppet::SSL::Certificate) + Puppet::SSL::Certificate.indirection.find("luke.madstop.com").should be_instance_of(Puppet::SSL::Certificate) end it "should save the signed certificate to the :signeddir" do @ca.sign("luke.madstop.com") client_cert = File.join(Puppet[:signeddir], "luke.madstop.com.pem") - File.read(client_cert).should == Puppet::SSL::Certificate.find("luke.madstop.com").content.to_s + File.read(client_cert).should == Puppet::SSL::Certificate.indirection.find("luke.madstop.com").content.to_s end it "should save valid certificates" do diff --git a/spec/integration/ssl/certificate_request_spec.rb b/spec/integration/ssl/certificate_request_spec.rb index 8426b9dc5..e04360548 100755 --- a/spec/integration/ssl/certificate_request_spec.rb +++ b/spec/integration/ssl/certificate_request_spec.rb @@ -50,13 +50,13 @@ describe Puppet::SSL::CertificateRequest do @csr.generate(@key) @csr.save - Puppet::SSL::CertificateRequest.find("luke.madstop.com").should be_instance_of(Puppet::SSL::CertificateRequest) + Puppet::SSL::CertificateRequest.indirection.find("luke.madstop.com").should be_instance_of(Puppet::SSL::CertificateRequest) end it "should save the completely CSR when saving" do @csr.generate(@key) @csr.save - Puppet::SSL::CertificateRequest.find("luke.madstop.com").content.to_s.should == @csr.content.to_s + Puppet::SSL::CertificateRequest.indirection.find("luke.madstop.com").content.to_s.should == @csr.content.to_s end end diff --git a/spec/integration/ssl/host_spec.rb b/spec/integration/ssl/host_spec.rb index 05862dfc4..c488eb229 100755 --- a/spec/integration/ssl/host_spec.rb +++ b/spec/integration/ssl/host_spec.rb @@ -45,7 +45,7 @@ describe Puppet::SSL::Host do it "should save the key such that the Indirector can find it" do @host.generate_key - Puppet::SSL::Key.find(@host.name).content.to_s.should == @host.key.to_s + Puppet::SSL::Key.indirection.find(@host.name).content.to_s.should == @host.key.to_s end it "should save the private key into the :privatekeydir" do @@ -62,7 +62,7 @@ describe Puppet::SSL::Host do it "should save the certificate request such that the Indirector can find it" do @host.generate_certificate_request - Puppet::SSL::CertificateRequest.find(@host.name).content.to_s.should == @host.certificate_request.to_s + Puppet::SSL::CertificateRequest.indirection.find(@host.name).content.to_s.should == @host.certificate_request.to_s end it "should save the private certificate request into the :privatekeydir" do diff --git a/spec/shared_behaviours/file_serving.rb b/spec/shared_behaviours/file_serving.rb index 5f5b2b0af..91594452d 100644 --- a/spec/shared_behaviours/file_serving.rb +++ b/spec/shared_behaviours/file_serving.rb @@ -12,7 +12,7 @@ describe "Puppet::FileServing::Files", :shared => true do term = @indirection.terminus(:rest) @indirection.stubs(:terminus).with(:rest).returns term term.expects(:find) - @test_class.find(uri) + @indirection.find(uri) end it "should use the rest terminus when the 'puppet' URI scheme is used, no host name is present, and the process name is not 'puppet' or 'apply'" do @@ -21,7 +21,7 @@ describe "Puppet::FileServing::Files", :shared => true do Puppet.settings.stubs(:value).with(:name).returns("puppetd") Puppet.settings.stubs(:value).with(:modulepath).returns("") @indirection.terminus(:rest).expects(:find) - @test_class.find(uri) + @indirection.find(uri) end it "should use the file_server terminus when the 'puppet' URI scheme is used, no host name is present, and the process name is 'puppet'" do @@ -32,7 +32,7 @@ describe "Puppet::FileServing::Files", :shared => true do Puppet.settings.stubs(:value).with(:fileserverconfig).returns("/whatever") @indirection.terminus(:file_server).expects(:find) @indirection.terminus(:file_server).stubs(:authorized?).returns(true) - @test_class.find(uri) + @indirection.find(uri) end it "should use the file_server terminus when the 'puppet' URI scheme is used, no host name is present, and the process name is 'apply'" do @@ -43,19 +43,19 @@ describe "Puppet::FileServing::Files", :shared => true do Puppet.settings.stubs(:value).with(:fileserverconfig).returns("/whatever") @indirection.terminus(:file_server).expects(:find) @indirection.terminus(:file_server).stubs(:authorized?).returns(true) - @test_class.find(uri) + @indirection.find(uri) end it "should use the file terminus when the 'file' URI scheme is used" do uri = "file:///fakemod/my/file" @indirection.terminus(:file).expects(:find) - @test_class.find(uri) + @indirection.find(uri) end it "should use the file terminus when a fully qualified path is provided" do uri = "/fakemod/my/file" @indirection.terminus(:file).expects(:find) - @test_class.find(uri) + @indirection.find(uri) end it "should use the configuration to test whether the request is allowed" do @@ -66,6 +66,6 @@ describe "Puppet::FileServing::Files", :shared => true do @indirection.terminus(:file_server).expects(:find) mount.expects(:allowed?).returns(true) - @test_class.find(uri, :node => "foo", :ip => "bar") + @indirection.find(uri, :node => "foo", :ip => "bar") end end diff --git a/spec/unit/application/agent_spec.rb b/spec/unit/application/agent_spec.rb index 50ef00c57..151d85a58 100755 --- a/spec/unit/application/agent_spec.rb +++ b/spec/unit/application/agent_spec.rb @@ -21,9 +21,9 @@ describe Puppet::Application::Agent do Puppet::Util::Log.stubs(:newdestination) Puppet::Util::Log.stubs(:level=) - Puppet::Node.stubs(:terminus_class=) - Puppet::Node.stubs(:cache_class=) - Puppet::Node::Facts.stubs(:terminus_class=) + Puppet::Node.indirection.stubs(:terminus_class=) + Puppet::Node.indirection.stubs(:cache_class=) + Puppet::Node::Facts.indirection.stubs(:terminus_class=) end it "should operate in agent run_mode" do @@ -179,11 +179,11 @@ describe Puppet::Application::Agent do FileTest.stubs(:exists?).returns(true) Puppet[:libdir] = "/dev/null/lib" Puppet::SSL::Host.stubs(:ca_location=) - Puppet::Transaction::Report.stubs(:terminus_class=) - Puppet::Transaction::Report.stubs(:cache_class=) - Puppet::Resource::Catalog.stubs(:terminus_class=) - Puppet::Resource::Catalog.stubs(:cache_class=) - Puppet::Node::Facts.stubs(:terminus_class=) + Puppet::Transaction::Report.indirection.stubs(:terminus_class=) + Puppet::Transaction::Report.indirection.stubs(:cache_class=) + Puppet::Resource::Catalog.indirection.stubs(:terminus_class=) + Puppet::Resource::Catalog.indirection.stubs(:cache_class=) + Puppet::Node::Facts.indirection.stubs(:terminus_class=) @host = stub_everything 'host' Puppet::SSL::Host.stubs(:new).returns(@host) Puppet.stubs(:settraps) @@ -307,13 +307,13 @@ describe Puppet::Application::Agent do end it "should tell the report handler to use REST" do - Puppet::Transaction::Report.expects(:terminus_class=).with(:rest) + Puppet::Transaction::Report.indirection.expects(:terminus_class=).with(:rest) @puppetd.setup end it "should tell the report handler to cache locally as yaml" do - Puppet::Transaction::Report.expects(:cache_class=).with(:yaml) + Puppet::Transaction::Report.indirection.expects(:cache_class=).with(:yaml) @puppetd.setup end @@ -325,7 +325,7 @@ describe Puppet::Application::Agent do end it "should tell the catalog handler to use cache" do - Puppet::Resource::Catalog.expects(:cache_class=).with(:yaml) + Puppet::Resource::Catalog.indirection.expects(:cache_class=).with(:yaml) @puppetd.setup end diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb index f07416378..52b84e6f2 100755 --- a/spec/unit/application/apply_spec.rb +++ b/spec/unit/application/apply_spec.rb @@ -57,7 +57,7 @@ describe Puppet::Application::Apply do Puppet.stubs(:parse_config) Puppet::FileBucket::Dipper.stubs(:new) STDIN.stubs(:read) - Puppet::Transaction::Report.stubs(:cache_class=) + Puppet::Transaction::Report.indirection.stubs(:cache_class=) @apply.options.stubs(:[]).with(any_parameters) end @@ -116,7 +116,7 @@ describe Puppet::Application::Apply do end it "should tell the report handler to cache locally as yaml" do - Puppet::Transaction::Report.expects(:cache_class=).with(:yaml) + Puppet::Transaction::Report.indirection.expects(:cache_class=).with(:yaml) @apply.setup end @@ -185,14 +185,14 @@ describe Puppet::Application::Apply do @apply.options.stubs(:[]) @facts = stub_everything 'facts' - Puppet::Node::Facts.stubs(:find).returns(@facts) + Puppet::Node::Facts.indirection.stubs(:find).returns(@facts) @node = stub_everything 'node' - Puppet::Node.stubs(:find).returns(@node) + Puppet::Node.indirection.stubs(:find).returns(@node) @catalog = stub_everything 'catalog' @catalog.stubs(:to_ral).returns(@catalog) - Puppet::Resource::Catalog.stubs(:find).returns(@catalog) + Puppet::Resource::Catalog.indirection.stubs(:find).returns(@catalog) STDIN.stubs(:read) @@ -248,25 +248,25 @@ describe Puppet::Application::Apply do end it "should collect the node facts" do - Puppet::Node::Facts.expects(:find).returns(@facts) + Puppet::Node::Facts.indirection.expects(:find).returns(@facts) @apply.main end it "should raise an error if we can't find the node" do - Puppet::Node::Facts.expects(:find).returns(nil) + Puppet::Node::Facts.indirection.expects(:find).returns(nil) lambda { @apply.main }.should raise_error end it "should look for the node" do - Puppet::Node.expects(:find).returns(@node) + Puppet::Node.indirection.expects(:find).returns(@node) @apply.main end it "should raise an error if we can't find the node" do - Puppet::Node.expects(:find).returns(nil) + Puppet::Node.indirection.expects(:find).returns(nil) lambda { @apply.main }.should raise_error end @@ -292,7 +292,7 @@ describe Puppet::Application::Apply do end it "should compile the catalog" do - Puppet::Resource::Catalog.expects(:find).returns(@catalog) + Puppet::Resource::Catalog.indirection.expects(:find).returns(@catalog) @apply.main end diff --git a/spec/unit/application/kick_spec.rb b/spec/unit/application/kick_spec.rb index dea7ec147..3a7106338 100755 --- a/spec/unit/application/kick_spec.rb +++ b/spec/unit/application/kick_spec.rb @@ -163,7 +163,7 @@ describe Puppet::Application::Kick do @kick.options.stubs(:[]).with(:all).returns(true) @kick.stubs(:puts) - Puppet::Node.expects(:search).with("whatever",:fqdn => :something).returns([]) + Puppet::Node.indirection.expects(:search).with("whatever",:fqdn => :something).returns([]) @kick.setup end @@ -172,7 +172,7 @@ describe Puppet::Application::Kick do @kick.options.stubs(:[]).with(:all).returns(true) @kick.stubs(:puts) - Puppet::Node.expects(:search).with("whatever",:fqdn => nil).returns([]) + Puppet::Node.indirection.expects(:search).with("whatever",:fqdn => nil).returns([]) @kick.setup end @@ -182,7 +182,7 @@ describe Puppet::Application::Kick do @kick.stubs(:puts) @kick.classes = ['class'] - Puppet::Node.expects(:search).with("whatever", :class => "class", :fqdn => nil).returns([]) + Puppet::Node.indirection.expects(:search).with("whatever", :class => "class", :fqdn => nil).returns([]) @kick.setup end diff --git a/spec/unit/application/master_spec.rb b/spec/unit/application/master_spec.rb index e657445a4..86e38efcb 100644 --- a/spec/unit/application/master_spec.rb +++ b/spec/unit/application/master_spec.rb @@ -14,12 +14,12 @@ describe Puppet::Application::Master do Puppet::Util::Log.stubs(:newdestination) Puppet::Util::Log.stubs(:level=) - Puppet::Node.stubs(:terminus_class=) - Puppet::Node.stubs(:cache_class=) - Puppet::Node::Facts.stubs(:terminus_class=) - Puppet::Node::Facts.stubs(:cache_class=) - Puppet::Transaction::Report.stubs(:terminus_class=) - Puppet::Resource::Catalog.stubs(:terminus_class=) + Puppet::Node.indirection.stubs(:terminus_class=) + Puppet::Node.indirection.stubs(:cache_class=) + Puppet::Node::Facts.indirection.stubs(:terminus_class=) + Puppet::Node::Facts.indirection.stubs(:cache_class=) + Puppet::Transaction::Report.indirection.stubs(:terminus_class=) + Puppet::Resource::Catalog.indirection.stubs(:terminus_class=) end it "should operate in master run_mode" do @@ -183,7 +183,7 @@ describe Puppet::Application::Master do end it "should cache class in yaml" do - Puppet::Node.expects(:cache_class=).with(:yaml) + Puppet::Node.indirection.expects(:cache_class=).with(:yaml) @master.setup end @@ -298,7 +298,7 @@ describe Puppet::Application::Master do it "should compile a catalog for the specified node" do @master.options[:node] = "foo" - Puppet::Resource::Catalog.expects(:find).with("foo").returns Puppet::Resource::Catalog.new + Puppet::Resource::Catalog.indirection.expects(:find).with("foo").returns Puppet::Resource::Catalog.new $stdout.stubs(:puts) @master.compile @@ -306,7 +306,7 @@ describe Puppet::Application::Master do it "should convert the catalog to a pure-resource catalog and use 'jj' to pretty-print the catalog" do catalog = Puppet::Resource::Catalog.new - Puppet::Resource::Catalog.expects(:find).returns catalog + Puppet::Resource::Catalog.indirection.expects(:find).returns catalog catalog.expects(:to_resource).returns("rescat") @@ -318,7 +318,7 @@ describe Puppet::Application::Master do it "should exit with error code 30 if no catalog can be found" do @master.options[:node] = "foo" - Puppet::Resource::Catalog.expects(:find).returns nil + Puppet::Resource::Catalog.indirection.expects(:find).returns nil @master.expects(:exit).with(30) $stderr.expects(:puts) @@ -327,7 +327,7 @@ describe Puppet::Application::Master do it "should exit with error code 30 if there's a failure" do @master.options[:node] = "foo" - Puppet::Resource::Catalog.expects(:find).raises ArgumentError + Puppet::Resource::Catalog.indirection.expects(:find).raises ArgumentError @master.expects(:exit).with(30) $stderr.expects(:puts) diff --git a/spec/unit/application/queue_spec.rb b/spec/unit/application/queue_spec.rb index bd0d53ab1..18fd8cea2 100755 --- a/spec/unit/application/queue_spec.rb +++ b/spec/unit/application/queue_spec.rb @@ -13,7 +13,7 @@ describe Puppet::Application::Queue do Puppet::Util::Log.stubs(:newdestination) Puppet::Util::Log.stubs(:level=) - Puppet::Resource::Catalog.stubs(:terminus_class=) + Puppet::Resource::Catalog.indirection.stubs(:terminus_class=) end it "should ask Puppet::Application to parse Puppet configuration file" do @@ -80,7 +80,7 @@ describe Puppet::Application::Queue do @queue.daemon.stubs(:daemonize) Puppet.stubs(:info) Puppet.features.stubs(:stomp?).returns true - Puppet::Resource::Catalog.stubs(:terminus_class=) + Puppet::Resource::Catalog.indirection.stubs(:terminus_class=) Puppet.stubs(:settraps) Puppet.settings.stubs(:print_config?) Puppet.settings.stubs(:print_config) @@ -144,7 +144,7 @@ describe Puppet::Application::Queue do end it "should configure the Catalog class to use ActiveRecord" do - Puppet::Resource::Catalog.expects(:terminus_class=).with(:active_record) + Puppet::Resource::Catalog.indirection.expects(:terminus_class=).with(:active_record) @queue.setup end diff --git a/spec/unit/application/resource_spec.rb b/spec/unit/application/resource_spec.rb index b6c52b11e..6ab99945c 100755 --- a/spec/unit/application/resource_spec.rb +++ b/spec/unit/application/resource_spec.rb @@ -162,21 +162,21 @@ describe Puppet::Application::Resource do @resource.stubs(:puts) @resource.host = 'host' - Puppet::Resource.stubs(:find ).never - Puppet::Resource.stubs(:search).never - Puppet::Resource.stubs(:save ).never + Puppet::Resource.indirection.stubs(:find ).never + Puppet::Resource.indirection.stubs(:search).never + Puppet::Resource.indirection.stubs(:save ).never end it "should search for resources" do @resource.command_line.stubs(:args).returns(['type']) - Puppet::Resource.expects(:search).with('https://host:8139/production/resources/type/', {}).returns([]) + Puppet::Resource.indirection.expects(:search).with('https://host:8139/production/resources/type/', {}).returns([]) @resource.main end it "should describe the given resource" do @resource.command_line.stubs(:args).returns(['type', 'name']) x = stub_everything 'resource' - Puppet::Resource.expects(:find).with('https://host:8139/production/resources/type/name').returns(x) + Puppet::Resource.indirection.expects(:find).with('https://host:8139/production/resources/type/name').returns(x) @resource.main end @@ -199,20 +199,20 @@ describe Puppet::Application::Resource do @resource.stubs(:puts) @resource.host = nil - Puppet::Resource.stubs(:find ).never - Puppet::Resource.stubs(:search).never - Puppet::Resource.stubs(:save ).never + Puppet::Resource.indirection.stubs(:find ).never + Puppet::Resource.indirection.stubs(:search).never + Puppet::Resource.indirection.stubs(:save ).never end it "should search for resources" do - Puppet::Resource.expects(:search).with('type/', {}).returns([]) + Puppet::Resource.indirection.expects(:search).with('type/', {}).returns([]) @resource.main end it "should describe the given resource" do @resource.command_line.stubs(:args).returns(['type','name']) x = stub_everything 'resource' - Puppet::Resource.expects(:find).with('type/name').returns(x) + Puppet::Resource.indirection.expects(:find).with('type/name').returns(x) @resource.main end diff --git a/spec/unit/configurer/fact_handler_spec.rb b/spec/unit/configurer/fact_handler_spec.rb index 051270144..70918c039 100755 --- a/spec/unit/configurer/fact_handler_spec.rb +++ b/spec/unit/configurer/fact_handler_spec.rb @@ -66,7 +66,7 @@ describe Puppet::Configurer::FactHandler do it "should use the Facts class with the :certname to find the facts" do Puppet.settings.expects(:value).with(:certname).returns "foo" - Puppet::Node::Facts.expects(:find).with("foo").returns "myfacts" + Puppet::Node::Facts.indirection.expects(:find).with("foo").returns "myfacts" @facthandler.stubs(:reload_facter) @facthandler.find_facts.should == "myfacts" end @@ -75,7 +75,7 @@ describe Puppet::Configurer::FactHandler do @facthandler.expects(:reload_facter) Puppet.settings.expects(:value).with(:certname).returns "myhost" - Puppet::Node::Facts.expects(:find).with("myhost") + Puppet::Node::Facts.indirection.expects(:find).with("myhost") @facthandler.find_facts end @@ -85,7 +85,7 @@ describe Puppet::Configurer::FactHandler do Puppet.settings.stubs(:value).with(:trace).returns false Puppet.settings.stubs(:value).with(:certname).returns "myhost" - Puppet::Node::Facts.expects(:find).raises RuntimeError + Puppet::Node::Facts.indirection.expects(:find).raises RuntimeError lambda { @facthandler.find_facts }.should raise_error(Puppet::Error) end diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index e34e6fffb..bb3a73994 100755 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -357,15 +357,15 @@ describe Puppet::Configurer, "when retrieving a catalog" do end it "should first look in the cache for a catalog" do - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.never + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.never @agent.retrieve_catalog.should == @catalog end it "should compile a new catalog if none is found in the cache" do - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog @agent.retrieve_catalog.should == @catalog end @@ -374,7 +374,7 @@ describe Puppet::Configurer, "when retrieving a catalog" do describe "when not using a REST terminus for catalogs" do it "should not pass any facts when retrieving the catalog" do @agent.expects(:facts_for_uploading).never - Puppet::Resource::Catalog.expects(:find).with { |name, options| + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:facts].nil? }.returns @catalog @@ -385,7 +385,7 @@ describe Puppet::Configurer, "when retrieving a catalog" do describe "when using a REST terminus for catalogs" do it "should pass the prepared facts and the facts format as arguments when retrieving the catalog" do @agent.expects(:facts_for_uploading).returns(:facts => "myfacts", :facts_format => :foo) - Puppet::Resource::Catalog.expects(:find).with { |name, options| + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:facts] == "myfacts" and options[:facts_format] == :foo }.returns @catalog @@ -394,7 +394,7 @@ describe Puppet::Configurer, "when retrieving a catalog" do end it "should use the Catalog class to get its catalog" do - Puppet::Resource::Catalog.expects(:find).returns @catalog + Puppet::Resource::Catalog.indirection.expects(:find).returns @catalog @agent.retrieve_catalog end @@ -402,20 +402,20 @@ describe Puppet::Configurer, "when retrieving a catalog" do it "should use its certname to retrieve the catalog" do Facter.stubs(:value).returns "eh" Puppet.settings[:certname] = "myhost.domain.com" - Puppet::Resource::Catalog.expects(:find).with { |name, options| name == "myhost.domain.com" }.returns @catalog + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| name == "myhost.domain.com" }.returns @catalog @agent.retrieve_catalog end it "should default to returning a catalog retrieved directly from the server, skipping the cache" do - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog @agent.retrieve_catalog.should == @catalog end it "should log and return the cached catalog when no catalog can be retrieved from the server" do - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog Puppet.expects(:notice) @@ -423,15 +423,15 @@ describe Puppet::Configurer, "when retrieving a catalog" do end it "should not look in the cache for a catalog if one is returned from the server" do - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.never + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns @catalog + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.never @agent.retrieve_catalog.should == @catalog end it "should return the cached catalog when retrieving the remote catalog throws an exception" do - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.raises "eh" - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.raises "eh" + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns @catalog @agent.retrieve_catalog.should == @catalog end @@ -439,7 +439,7 @@ describe Puppet::Configurer, "when retrieving a catalog" do it "should log and return nil if no catalog can be retrieved from the server and :usecacheonfailure is disabled" do Puppet.stubs(:[]) Puppet.expects(:[]).with(:usecacheonfailure).returns false - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil Puppet.expects(:warning) @@ -447,21 +447,21 @@ describe Puppet::Configurer, "when retrieving a catalog" do end it "should return nil if no cached catalog is available and no catalog can be retrieved from the server" do - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil - Puppet::Resource::Catalog.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_cache] == true }.returns nil + Puppet::Resource::Catalog.indirection.expects(:find).with { |name, options| options[:ignore_terminus] == true }.returns nil @agent.retrieve_catalog.should be_nil end it "should convert the catalog before returning" do - Puppet::Resource::Catalog.stubs(:find).returns @catalog + Puppet::Resource::Catalog.indirection.stubs(:find).returns @catalog @agent.expects(:convert_catalog).with { |cat, dur| cat == @catalog }.returns "converted catalog" @agent.retrieve_catalog.should == "converted catalog" end it "should return nil if there is an error while retrieving the catalog" do - Puppet::Resource::Catalog.expects(:find).raises "eh" + Puppet::Resource::Catalog.indirection.expects(:find).raises "eh" @agent.retrieve_catalog.should be_nil end diff --git a/spec/unit/file_bucket/dipper_spec.rb b/spec/unit/file_bucket/dipper_spec.rb index 799e899e7..4897dc1f8 100755 --- a/spec/unit/file_bucket/dipper_spec.rb +++ b/spec/unit/file_bucket/dipper_spec.rb @@ -60,7 +60,7 @@ describe Puppet::FileBucket::Dipper do bucketfile = stub "bucketfile" bucketfile.stubs(:to_s).returns "Content" - Puppet::FileBucket::File.expects(:find).with{|x,opts| + Puppet::FileBucket::File.indirection.expects(:find).with{|x,opts| x == 'md5/DIGEST123' }.returns(bucketfile) @@ -111,7 +111,7 @@ describe Puppet::FileBucket::Dipper do bucketfile = stub "bucketfile" bucketfile.stubs(:to_s).returns "Content" - Puppet::FileBucket::File.expects(:find).with{|x,opts| + Puppet::FileBucket::File.indirection.expects(:find).with{|x,opts| x == 'https://puppetmaster:31337/production/file_bucket_file/md5/DIGEST123' }.returns(bucketfile) diff --git a/spec/unit/file_bucket/file_spec.rb b/spec/unit/file_bucket/file_spec.rb index 3ad70c203..42ed94253 100644 --- a/spec/unit/file_bucket/file_spec.rb +++ b/spec/unit/file_bucket/file_spec.rb @@ -97,14 +97,6 @@ describe Puppet::FileBucket::File do it "should have a :save instance method" do Puppet::FileBucket::File.new("mysum").should respond_to(:save) end - - it "should respond to :find" do - Puppet::FileBucket::File.should respond_to(:find) - end - - it "should respond to :destroy" do - Puppet::FileBucket::File.should respond_to(:destroy) - end end describe "when saving files" do @@ -195,7 +187,7 @@ describe Puppet::FileBucket::File do it "should return nil if a file doesn't exist" do ::File.expects(:exist?).with("#{@dir}/contents").returns false - bucketfile = Puppet::FileBucket::File.find("{md5}#{@digest}") + bucketfile = Puppet::FileBucket::File.indirection.find("{md5}#{@digest}") bucketfile.should == nil end @@ -204,7 +196,7 @@ describe Puppet::FileBucket::File do ::File.expects(:exist?).with("#{@dir}/paths").returns false ::File.expects(:read).with("#{@dir}/contents").returns @contents - bucketfile = Puppet::FileBucket::File.find("{md5}#{@digest}") + bucketfile = Puppet::FileBucket::File.indirection.find("{md5}#{@digest}") bucketfile.should_not == nil end @@ -212,7 +204,7 @@ describe Puppet::FileBucket::File do it "should return nil if a file doesn't exist" do ::File.expects(:exist?).with("#{@dir}/contents").returns false - bucketfile = Puppet::FileBucket::File.find("md5/#{@digest}") + bucketfile = Puppet::FileBucket::File.indirection.find("md5/#{@digest}") bucketfile.should == nil end @@ -221,7 +213,7 @@ describe Puppet::FileBucket::File do ::File.expects(:exist?).with("#{@dir}/paths").returns false ::File.expects(:read).with("#{@dir}/contents").returns @contents - bucketfile = Puppet::FileBucket::File.find("md5/#{@digest}") + bucketfile = Puppet::FileBucket::File.indirection.find("md5/#{@digest}") bucketfile.should_not == nil end diff --git a/spec/unit/indirector/catalog/active_record_spec.rb b/spec/unit/indirector/catalog/active_record_spec.rb index 4e9d049a1..09e943376 100755 --- a/spec/unit/indirector/catalog/active_record_spec.rb +++ b/spec/unit/indirector/catalog/active_record_spec.rb @@ -80,7 +80,7 @@ describe "Puppet::Resource::Catalog::ActiveRecord" do @host.stubs(:railsmark).yields @node = stub_everything 'node', :parameters => {} - Puppet::Node.stubs(:find).returns(@node) + Puppet::Node.indirection.stubs(:find).returns(@node) Puppet::Rails::Host.stubs(:find_by_name).returns @host @catalog = Puppet::Resource::Catalog.new("foo") diff --git a/spec/unit/indirector/catalog/compiler_spec.rb b/spec/unit/indirector/catalog/compiler_spec.rb index 49b8986eb..264af2635 100755 --- a/spec/unit/indirector/catalog/compiler_spec.rb +++ b/spec/unit/indirector/catalog/compiler_spec.rb @@ -32,8 +32,8 @@ describe Puppet::Resource::Catalog::Compiler do node1 = stub 'node1', :merge => nil node2 = stub 'node2', :merge => nil compiler.stubs(:compile) - Puppet::Node.stubs(:find).with('node1').returns(node1) - Puppet::Node.stubs(:find).with('node2').returns(node2) + Puppet::Node.indirection.stubs(:find).with('node1').returns(node1) + Puppet::Node.indirection.stubs(:find).with('node2').returns(node2) compiler.find(stub('request', :key => 'node1', :node => 'node1', :options => {})) compiler.find(stub('node2request', :key => 'node2', :node => 'node2', :options => {})) @@ -71,12 +71,12 @@ describe Puppet::Resource::Catalog::Compiler do @name = "me" @node = Puppet::Node.new @name @node.stubs(:merge) - Puppet::Node.stubs(:find).returns @node + Puppet::Node.indirection.stubs(:find).returns @node @request = stub 'request', :key => @name, :node => @name, :options => {} end it "should directly use provided nodes" do - Puppet::Node.expects(:find).never + Puppet::Node.indirection.expects(:find).never @compiler.expects(:compile).with(@node) @request.stubs(:options).returns(:use_node => @node) @compiler.find(@request) @@ -84,7 +84,7 @@ describe Puppet::Resource::Catalog::Compiler do it "should use the authenticated node name if no request key is provided" do @request.stubs(:key).returns(nil) - Puppet::Node.expects(:find).with(@name).returns(@node) + Puppet::Node.indirection.expects(:find).with(@name).returns(@node) @compiler.expects(:compile).with(@node) @compiler.find(@request) end @@ -92,37 +92,37 @@ describe Puppet::Resource::Catalog::Compiler do it "should use the provided node name by default" do @request.expects(:key).returns "my_node" - Puppet::Node.expects(:find).with("my_node").returns @node + Puppet::Node.indirection.expects(:find).with("my_node").returns @node @compiler.expects(:compile).with(@node) @compiler.find(@request) end it "should fail if no node is passed and none can be found" do - Puppet::Node.stubs(:find).with(@name).returns(nil) + Puppet::Node.indirection.stubs(:find).with(@name).returns(nil) proc { @compiler.find(@request) }.should raise_error(ArgumentError) end it "should fail intelligently when searching for a node raises an exception" do - Puppet::Node.stubs(:find).with(@name).raises "eh" + Puppet::Node.indirection.stubs(:find).with(@name).raises "eh" proc { @compiler.find(@request) }.should raise_error(Puppet::Error) end it "should pass the found node to the compiler for compiling" do - Puppet::Node.expects(:find).with(@name).returns(@node) + Puppet::Node.indirection.expects(:find).with(@name).returns(@node) config = mock 'config' Puppet::Parser::Compiler.expects(:compile).with(@node) @compiler.find(@request) end it "should extract and save any facts from the request" do - Puppet::Node.expects(:find).with(@name).returns @node + Puppet::Node.indirection.expects(:find).with(@name).returns @node @compiler.expects(:extract_facts_from_request).with(@request) Puppet::Parser::Compiler.stubs(:compile) @compiler.find(@request) end it "should return the results of compiling as the catalog" do - Puppet::Node.stubs(:find).returns(@node) + Puppet::Node.indirection.stubs(:find).returns(@node) config = mock 'config' result = mock 'result' @@ -131,7 +131,7 @@ describe Puppet::Resource::Catalog::Compiler do end it "should benchmark the compile process" do - Puppet::Node.stubs(:find).returns(@node) + Puppet::Node.indirection.stubs(:find).returns(@node) @compiler.stubs(:networked?).returns(true) @compiler.expects(:benchmark).with do |level, message| level == :notice and message =~ /^Compiled catalog/ @@ -141,7 +141,7 @@ describe Puppet::Resource::Catalog::Compiler do end it "should log the benchmark result" do - Puppet::Node.stubs(:find).returns(@node) + Puppet::Node.indirection.stubs(:find).returns(@node) @compiler.stubs(:networked?).returns(true) Puppet::Parser::Compiler.stubs(:compile) @@ -162,7 +162,7 @@ describe Puppet::Resource::Catalog::Compiler do end it "should do nothing if no facts are provided" do - Puppet::Node::Facts.expects(:convert_from).never + Puppet::Node::Facts.indirection.expects(:convert_from).never @request.options[:facts] = nil @compiler.extract_facts_from_request(@request) @@ -212,7 +212,7 @@ describe Puppet::Resource::Catalog::Compiler do it "should look node information up via the Node class with the provided key" do @node.stubs :merge - Puppet::Node.expects(:find).with(@name).returns(@node) + Puppet::Node.indirection.expects(:find).with(@name).returns(@node) @compiler.find(@request) end end @@ -227,7 +227,7 @@ describe Puppet::Resource::Catalog::Compiler do @node = mock 'node' @request = stub 'request', :key => @name, :options => {} @compiler.stubs(:compile) - Puppet::Node.stubs(:find).with(@name).returns(@node) + Puppet::Node.indirection.stubs(:find).with(@name).returns(@node) end it "should add the server's Puppet version to the node's parameters as 'serverversion'" do diff --git a/spec/unit/indirector/node/ldap_spec.rb b/spec/unit/indirector/node/ldap_spec.rb index 042e7bd54..95ec12c80 100755 --- a/spec/unit/indirector/node/ldap_spec.rb +++ b/spec/unit/indirector/node/ldap_spec.rb @@ -311,7 +311,7 @@ describe Puppet::Node::Ldap do @options = {} @request = stub 'request', :key => "foo", :options => @options - Puppet::Node::Facts.stubs(:terminus_class).returns :yaml + Puppet::Node::Facts.indirection.stubs(:terminus_class).returns :yaml end it "should find all nodes if no arguments are provided" do diff --git a/spec/unit/indirector_spec.rb b/spec/unit/indirector_spec.rb index fb21532ba..5aae5d00e 100755 --- a/spec/unit/indirector_spec.rb +++ b/spec/unit/indirector_spec.rb @@ -64,24 +64,6 @@ describe Puppet::Indirector, "when registering an indirection" do end end -describe "Delegated Indirection Method", :shared => true do - it "should delegate to the indirection" do - @indirection.expects(@method) - @thingie.send(@method, "me") - end - - it "should pass all of the passed arguments directly to the indirection instance" do - @indirection.expects(@method).with("me", :one => :two) - @thingie.send(@method, "me", :one => :two) - end - - it "should return the results of the delegation as its result" do - request = mock 'request' - @indirection.expects(@method).returns "yay" - @thingie.send(@method, "me").should == "yay" - end -end - describe Puppet::Indirector, "when redirecting a model" do before do @thingie = Class.new do @@ -98,26 +80,6 @@ describe Puppet::Indirector, "when redirecting a model" do @thingie.ancestors.should be_include(Puppet::Indirector::Envelope) end - describe "when finding instances via the model" do - before { @method = :find } - it_should_behave_like "Delegated Indirection Method" - end - - describe "when destroying instances via the model" do - before { @method = :destroy } - it_should_behave_like "Delegated Indirection Method" - end - - describe "when searching for instances via the model" do - before { @method = :search } - it_should_behave_like "Delegated Indirection Method" - end - - describe "when expiring instances via the model" do - before { @method = :expire } - it_should_behave_like "Delegated Indirection Method" - end - # This is an instance method, so it behaves a bit differently. describe "when saving instances via the model" do before do @@ -141,16 +103,6 @@ describe Puppet::Indirector, "when redirecting a model" do end end - it "should give the model the ability to set the indirection terminus class" do - @indirection.expects(:terminus_class=).with(:myterm) - @thingie.terminus_class = :myterm - end - - it "should give the model the ability to set the indirection cache class" do - @indirection.expects(:cache_class=).with(:mycache) - @thingie.cache_class = :mycache - end - after do @indirection.delete end diff --git a/spec/unit/network/http/webrick_spec.rb b/spec/unit/network/http/webrick_spec.rb index 8e7c92b71..91a35435a 100755 --- a/spec/unit/network/http/webrick_spec.rb +++ b/spec/unit/network/http/webrick_spec.rb @@ -282,7 +282,7 @@ describe Puppet::Network::HTTP::WEBrick do @cert = stub 'cert', :content => "mycert" @host = stub 'host', :key => @key, :certificate => @cert, :name => "yay", :ssl_store => "mystore" - Puppet::SSL::Certificate.stubs(:find).with('ca').returns @cert + Puppet::SSL::Certificate.indirection.stubs(:find).with('ca').returns @cert Puppet::SSL::Host.stubs(:localhost).returns @host end @@ -299,7 +299,7 @@ describe Puppet::Network::HTTP::WEBrick do end it "should fail if no CA certificate can be found" do - Puppet::SSL::Certificate.stubs(:find).with('ca').returns nil + Puppet::SSL::Certificate.indirection.stubs(:find).with('ca').returns nil lambda { @server.setup_ssl }.should raise_error(Puppet::Error) end diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb index cb2aa3dc7..7873b415d 100755 --- a/spec/unit/node/facts_spec.rb +++ b/spec/unit/node/facts_spec.rb @@ -76,12 +76,6 @@ describe Puppet::Node::Facts, "when indirecting" do @facts = Puppet::Node::Facts.new("me", "one" => "two") end - it "should redirect to the specified fact store for retrieval" do - Puppet::Node::Facts.stubs(:indirection).returns(@indirection) - @indirection.expects(:find) - Puppet::Node::Facts.find(:my_facts) - end - it "should redirect to the specified fact store for storage" do Puppet::Node::Facts.stubs(:indirection).returns(@indirection) @indirection.expects(:save) diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index 36334ea05..725075cb3 100755 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -84,11 +84,11 @@ end describe Puppet::Node, "when merging facts" do before do @node = Puppet::Node.new("testnode") - Puppet::Node::Facts.stubs(:find).with(@node.name).returns(Puppet::Node::Facts.new(@node.name, "one" => "c", "two" => "b")) + Puppet::Node::Facts.indirection.stubs(:find).with(@node.name).returns(Puppet::Node::Facts.new(@node.name, "one" => "c", "two" => "b")) end it "should fail intelligently if it cannot find facts" do - Puppet::Node::Facts.expects(:find).with(@node.name).raises "foo" + Puppet::Node::Facts.indirection.expects(:find).with(@node.name).raises "foo" lambda { @node.fact_merge }.should raise_error(Puppet::Error) end @@ -128,13 +128,6 @@ describe Puppet::Node, "when merging facts" do end describe Puppet::Node, "when indirecting" do - it "should redirect to the indirection" do - @indirection = stub 'indirection', :name => :node - Puppet::Node.stubs(:indirection).returns(@indirection) - @indirection.expects(:find) - Puppet::Node.find(:my_node.to_s) - end - it "should default to the 'plain' node terminus" do Puppet::Node.indirection.terminus_class.should == :plain end diff --git a/spec/unit/resource/catalog_spec.rb b/spec/unit/resource/catalog_spec.rb index fbfe29ff3..672bb8ffc 100755 --- a/spec/unit/resource/catalog_spec.rb +++ b/spec/unit/resource/catalog_spec.rb @@ -818,12 +818,6 @@ describe Puppet::Resource::Catalog, "when compiling" do Puppet::Util::Cacher.expire end - it "should redirect to the indirection for retrieval" do - Puppet::Resource::Catalog.stubs(:indirection).returns(@indirection) - @indirection.expects(:find) - Puppet::Resource::Catalog.find(:myconfig) - end - it "should use the value of the 'catalog_terminus' setting to determine its terminus class" do # Puppet only checks the terminus setting the first time you ask # so this returns the object to the clean state diff --git a/spec/unit/ssl/certificate_authority_spec.rb b/spec/unit/ssl/certificate_authority_spec.rb index 39fee3f0a..2219aa99d 100755 --- a/spec/unit/ssl/certificate_authority_spec.rb +++ b/spec/unit/ssl/certificate_authority_spec.rb @@ -138,13 +138,13 @@ describe Puppet::SSL::CertificateAuthority do it "should return any found CRL instance" do crl = mock 'crl' - Puppet::SSL::CertificateRevocationList.expects(:find).returns crl + Puppet::SSL::CertificateRevocationList.indirection.expects(:find).returns crl @ca.crl.should equal(crl) end it "should create, generate, and save a new CRL instance of no CRL can be found" do crl = mock 'crl' - Puppet::SSL::CertificateRevocationList.expects(:find).returns nil + Puppet::SSL::CertificateRevocationList.indirection.expects(:find).returns nil Puppet::SSL::CertificateRevocationList.expects(:new).returns crl @@ -252,7 +252,7 @@ describe Puppet::SSL::CertificateAuthority do @inventory = stub 'inventory', :add => nil @ca.stubs(:inventory).returns @inventory - Puppet::SSL::CertificateRequest.stubs(:destroy) + Puppet::SSL::CertificateRequest.indirection.stubs(:destroy) end describe "and calculating the next certificate serial number" do @@ -295,7 +295,7 @@ describe Puppet::SSL::CertificateAuthority do end it "should not look up a certificate request for the host" do - Puppet::SSL::CertificateRequest.expects(:find).never + Puppet::SSL::CertificateRequest.indirection.expects(:find).never @ca.sign(@name, :ca, @request) end @@ -340,7 +340,7 @@ describe Puppet::SSL::CertificateAuthority do @serial = 10 @ca.stubs(:next_serial).returns @serial - Puppet::SSL::CertificateRequest.stubs(:find).with(@name).returns @request + Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request @cert.stubs :save end @@ -353,13 +353,13 @@ describe Puppet::SSL::CertificateAuthority do end it "should use look up a CSR for the host in the :ca_file terminus" do - Puppet::SSL::CertificateRequest.expects(:find).with(@name).returns @request + Puppet::SSL::CertificateRequest.indirection.expects(:find).with(@name).returns @request @ca.sign(@name) end it "should fail if no CSR can be found for the host" do - Puppet::SSL::CertificateRequest.expects(:find).with(@name).returns nil + Puppet::SSL::CertificateRequest.indirection.expects(:find).with(@name).returns nil lambda { @ca.sign(@name) }.should raise_error(ArgumentError) end @@ -395,7 +395,7 @@ describe Puppet::SSL::CertificateAuthority do end it "should remove the host's certificate request" do - Puppet::SSL::CertificateRequest.expects(:destroy).with(@name) + Puppet::SSL::CertificateRequest.indirection.expects(:destroy).with(@name) @ca.sign(@name) end @@ -405,7 +405,7 @@ describe Puppet::SSL::CertificateAuthority do @serial = 10 @ca.stubs(:next_serial).returns @serial - Puppet::SSL::CertificateRequest.stubs(:find).with(@name).returns @request + Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request @cert.stubs :save Puppet::SSL::Certificate.expects(:new).with(@name).returns @cert @@ -414,7 +414,7 @@ describe Puppet::SSL::CertificateAuthority do it "should return the certificate instance" do @ca.stubs(:next_serial).returns @serial - Puppet::SSL::CertificateRequest.stubs(:find).with(@name).returns @request + Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request @cert.stubs :save @ca.sign(@name).should equal(@cert) end @@ -423,7 +423,7 @@ describe Puppet::SSL::CertificateAuthority do @ca.stubs(:next_serial).returns @serial @inventory.expects(:add).with(@cert) - Puppet::SSL::CertificateRequest.stubs(:find).with(@name).returns @request + Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request @cert.stubs :save @ca.sign(@name) end @@ -436,7 +436,7 @@ describe Puppet::SSL::CertificateAuthority do it "should do nothing if autosign is disabled" do Puppet.settings.expects(:value).with(:autosign).returns 'false' - Puppet::SSL::CertificateRequest.expects(:search).never + Puppet::SSL::CertificateRequest.indirection.expects(:search).never @ca.autosign end @@ -444,7 +444,7 @@ describe Puppet::SSL::CertificateAuthority do Puppet.settings.expects(:value).with(:autosign).returns '/auto/sign' FileTest.expects(:exist?).with("/auto/sign").returns false - Puppet::SSL::CertificateRequest.expects(:search).never + Puppet::SSL::CertificateRequest.indirection.expects(:search).never @ca.autosign end @@ -454,7 +454,7 @@ describe Puppet::SSL::CertificateAuthority do FileTest.stubs(:exist?).with("/auto/sign").returns true File.stubs(:readlines).with("/auto/sign").returns ["one\n", "two\n"] - Puppet::SSL::CertificateRequest.stubs(:search).returns [] + Puppet::SSL::CertificateRequest.indirection.stubs(:search).returns [] @store = stub 'store', :allow => nil Puppet::Network::AuthStore.stubs(:new).returns @store @@ -495,13 +495,13 @@ describe Puppet::SSL::CertificateAuthority do it "should sign all CSRs whose hostname matches the autosign configuration" do csr1 = mock 'csr1' csr2 = mock 'csr2' - Puppet::SSL::CertificateRequest.stubs(:search).returns [csr1, csr2] + Puppet::SSL::CertificateRequest.indirection.stubs(:search).returns [csr1, csr2] end it "should not sign CSRs whose hostname does not match the autosign configuration" do csr1 = mock 'csr1' csr2 = mock 'csr2' - Puppet::SSL::CertificateRequest.stubs(:search).returns [csr1, csr2] + Puppet::SSL::CertificateRequest.indirection.stubs(:search).returns [csr1, csr2] end end end @@ -548,7 +548,7 @@ describe Puppet::SSL::CertificateAuthority do it "should be able to list waiting certificate requests" do req1 = stub 'req1', :name => "one" req2 = stub 'req2', :name => "two" - Puppet::SSL::CertificateRequest.expects(:search).with("*").returns [req1, req2] + Puppet::SSL::CertificateRequest.indirection.expects(:search).with("*").returns [req1, req2] @ca.waiting?.should == %w{one two} end @@ -566,19 +566,19 @@ describe Puppet::SSL::CertificateAuthority do it "should list certificates as the sorted list of all existing signed certificates" do cert1 = stub 'cert1', :name => "cert1" cert2 = stub 'cert2', :name => "cert2" - Puppet::SSL::Certificate.expects(:search).with("*").returns [cert1, cert2] + Puppet::SSL::Certificate.indirection.expects(:search).with("*").returns [cert1, cert2] @ca.list.should == %w{cert1 cert2} end describe "and printing certificates" do it "should return nil if the certificate cannot be found" do - Puppet::SSL::Certificate.expects(:find).with("myhost").returns nil + Puppet::SSL::Certificate.indirection.expects(:find).with("myhost").returns nil @ca.print("myhost").should be_nil end it "should print certificates by calling :to_text on the host's certificate" do cert1 = stub 'cert1', :name => "cert1", :to_text => "mytext" - Puppet::SSL::Certificate.expects(:find).with("myhost").returns cert1 + Puppet::SSL::Certificate.indirection.expects(:find).with("myhost").returns cert1 @ca.print("myhost").should == "mytext" end end @@ -586,19 +586,19 @@ describe Puppet::SSL::CertificateAuthority do describe "and fingerprinting certificates" do before :each do @cert = stub 'cert', :name => "cert", :fingerprint => "DIGEST" - Puppet::SSL::Certificate.stubs(:find).with("myhost").returns @cert - Puppet::SSL::CertificateRequest.stubs(:find).with("myhost") + Puppet::SSL::Certificate.indirection.stubs(:find).with("myhost").returns @cert + Puppet::SSL::CertificateRequest.indirection.stubs(:find).with("myhost") end it "should raise an error if the certificate or CSR cannot be found" do - Puppet::SSL::Certificate.expects(:find).with("myhost").returns nil - Puppet::SSL::CertificateRequest.expects(:find).with("myhost").returns nil + Puppet::SSL::Certificate.indirection.expects(:find).with("myhost").returns nil + Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myhost").returns nil lambda { @ca.fingerprint("myhost") }.should raise_error end it "should try to find a CSR if no certificate can be found" do - Puppet::SSL::Certificate.expects(:find).with("myhost").returns nil - Puppet::SSL::CertificateRequest.expects(:find).with("myhost").returns @cert + Puppet::SSL::Certificate.indirection.expects(:find).with("myhost").returns nil + Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myhost").returns @cert @cert.expects(:fingerprint) @ca.fingerprint("myhost") end @@ -623,7 +623,7 @@ describe Puppet::SSL::CertificateAuthority do Puppet.settings.stubs(:value).returns "crtstuff" @cert = stub 'cert', :content => "mycert" - Puppet::SSL::Certificate.stubs(:find).returns @cert + Puppet::SSL::Certificate.indirection.stubs(:find).returns @cert @crl = stub('crl', :content => "mycrl") @@ -631,7 +631,7 @@ describe Puppet::SSL::CertificateAuthority do end it "should fail if the host's certificate cannot be found" do - Puppet::SSL::Certificate.expects(:find).with("me").returns(nil) + Puppet::SSL::Certificate.indirection.expects(:find).with("me").returns(nil) lambda { @ca.verify("me") }.should raise_error(ArgumentError) end @@ -694,7 +694,7 @@ describe Puppet::SSL::CertificateAuthority do @real_cert = stub 'real_cert', :serial => 15 @cert = stub 'cert', :content => @real_cert - Puppet::SSL::Certificate.stubs(:find).returns @cert + Puppet::SSL::Certificate.indirection.stubs(:find).returns @cert end @@ -714,7 +714,7 @@ describe Puppet::SSL::CertificateAuthority do it "should get the serial number from the local certificate if it exists" do @ca.crl.expects(:revoke).with { |serial, key| serial == 15 } - Puppet::SSL::Certificate.expects(:find).with("host").returns @cert + Puppet::SSL::Certificate.indirection.expects(:find).with("host").returns @cert @ca.revoke('host') end @@ -722,7 +722,7 @@ describe Puppet::SSL::CertificateAuthority do it "should get the serial number from inventory if no local certificate exists" do real_cert = stub 'real_cert', :serial => 15 cert = stub 'cert', :content => real_cert - Puppet::SSL::Certificate.expects(:find).with("host").returns nil + Puppet::SSL::Certificate.indirection.expects(:find).with("host").returns nil @ca.inventory.expects(:serial).with("host").returns 16 @@ -739,13 +739,13 @@ describe Puppet::SSL::CertificateAuthority do before do @host = stub 'host', :generate_certificate_request => nil Puppet::SSL::Host.stubs(:new).returns @host - Puppet::SSL::Certificate.stubs(:find).returns nil + Puppet::SSL::Certificate.indirection.stubs(:find).returns nil @ca.stubs(:sign) end it "should fail if a certificate already exists for the host" do - Puppet::SSL::Certificate.expects(:find).with("him").returns "something" + Puppet::SSL::Certificate.indirection.expects(:find).with("him").returns "something" lambda { @ca.generate("him") }.should raise_error(ArgumentError) end diff --git a/spec/unit/ssl/host_spec.rb b/spec/unit/ssl/host_spec.rb index b2e43393c..3b7ed18e1 100755 --- a/spec/unit/ssl/host_spec.rb +++ b/spec/unit/ssl/host_spec.rb @@ -22,7 +22,7 @@ describe Puppet::SSL::Host do it "should retrieve its public key from its private key" do realkey = mock 'realkey' key = stub 'key', :content => realkey - Puppet::SSL::Key.stubs(:find).returns(key) + Puppet::SSL::Key.indirection.stubs(:find).returns(key) pubkey = mock 'public_key' realkey.expects(:public_key).returns pubkey @@ -142,8 +142,8 @@ describe Puppet::SSL::Host do describe "when specifying the CA location" do before do [Puppet::SSL::Key, Puppet::SSL::Certificate, Puppet::SSL::CertificateRequest, Puppet::SSL::CertificateRevocationList].each do |klass| - klass.stubs(:terminus_class=) - klass.stubs(:cache_class=) + klass.indirection.stubs(:terminus_class=) + klass.indirection.stubs(:cache_class=) end end @@ -169,23 +169,23 @@ describe Puppet::SSL::Host do describe "as 'local'" do it "should set the cache class for Certificate, CertificateRevocationList, and CertificateRequest as :file" do - Puppet::SSL::Certificate.expects(:cache_class=).with :file - Puppet::SSL::CertificateRequest.expects(:cache_class=).with :file - Puppet::SSL::CertificateRevocationList.expects(:cache_class=).with :file + Puppet::SSL::Certificate.indirection.expects(:cache_class=).with :file + Puppet::SSL::CertificateRequest.indirection.expects(:cache_class=).with :file + Puppet::SSL::CertificateRevocationList.indirection.expects(:cache_class=).with :file Puppet::SSL::Host.ca_location = :local end it "should set the terminus class for Key as :file" do - Puppet::SSL::Key.expects(:terminus_class=).with :file + Puppet::SSL::Key.indirection.expects(:terminus_class=).with :file Puppet::SSL::Host.ca_location = :local end it "should set the terminus class for Certificate, CertificateRevocationList, and CertificateRequest as :ca" do - Puppet::SSL::Certificate.expects(:terminus_class=).with :ca - Puppet::SSL::CertificateRequest.expects(:terminus_class=).with :ca - Puppet::SSL::CertificateRevocationList.expects(:terminus_class=).with :ca + Puppet::SSL::Certificate.indirection.expects(:terminus_class=).with :ca + Puppet::SSL::CertificateRequest.indirection.expects(:terminus_class=).with :ca + Puppet::SSL::CertificateRevocationList.indirection.expects(:terminus_class=).with :ca Puppet::SSL::Host.ca_location = :local end @@ -193,23 +193,23 @@ describe Puppet::SSL::Host do describe "as 'remote'" do it "should set the cache class for Certificate, CertificateRevocationList, and CertificateRequest as :file" do - Puppet::SSL::Certificate.expects(:cache_class=).with :file - Puppet::SSL::CertificateRequest.expects(:cache_class=).with :file - Puppet::SSL::CertificateRevocationList.expects(:cache_class=).with :file + Puppet::SSL::Certificate.indirection.expects(:cache_class=).with :file + Puppet::SSL::CertificateRequest.indirection.expects(:cache_class=).with :file + Puppet::SSL::CertificateRevocationList.indirection.expects(:cache_class=).with :file Puppet::SSL::Host.ca_location = :remote end it "should set the terminus class for Key as :file" do - Puppet::SSL::Key.expects(:terminus_class=).with :file + Puppet::SSL::Key.indirection.expects(:terminus_class=).with :file Puppet::SSL::Host.ca_location = :remote end it "should set the terminus class for Certificate, CertificateRevocationList, and CertificateRequest as :rest" do - Puppet::SSL::Certificate.expects(:terminus_class=).with :rest - Puppet::SSL::CertificateRequest.expects(:terminus_class=).with :rest - Puppet::SSL::CertificateRevocationList.expects(:terminus_class=).with :rest + Puppet::SSL::Certificate.indirection.expects(:terminus_class=).with :rest + Puppet::SSL::CertificateRequest.indirection.expects(:terminus_class=).with :rest + Puppet::SSL::CertificateRevocationList.indirection.expects(:terminus_class=).with :rest Puppet::SSL::Host.ca_location = :remote end @@ -217,18 +217,18 @@ describe Puppet::SSL::Host do describe "as 'only'" do it "should set the terminus class for Key, Certificate, CertificateRevocationList, and CertificateRequest as :ca" do - Puppet::SSL::Key.expects(:terminus_class=).with :ca - Puppet::SSL::Certificate.expects(:terminus_class=).with :ca - Puppet::SSL::CertificateRequest.expects(:terminus_class=).with :ca - Puppet::SSL::CertificateRevocationList.expects(:terminus_class=).with :ca + Puppet::SSL::Key.indirection.expects(:terminus_class=).with :ca + Puppet::SSL::Certificate.indirection.expects(:terminus_class=).with :ca + Puppet::SSL::CertificateRequest.indirection.expects(:terminus_class=).with :ca + Puppet::SSL::CertificateRevocationList.indirection.expects(:terminus_class=).with :ca Puppet::SSL::Host.ca_location = :only end it "should reset the cache class for Certificate, CertificateRevocationList, and CertificateRequest to nil" do - Puppet::SSL::Certificate.expects(:cache_class=).with nil - Puppet::SSL::CertificateRequest.expects(:cache_class=).with nil - Puppet::SSL::CertificateRevocationList.expects(:cache_class=).with nil + Puppet::SSL::Certificate.indirection.expects(:cache_class=).with nil + Puppet::SSL::CertificateRequest.indirection.expects(:cache_class=).with nil + Puppet::SSL::CertificateRevocationList.indirection.expects(:cache_class=).with nil Puppet::SSL::Host.ca_location = :only end @@ -236,10 +236,10 @@ describe Puppet::SSL::Host do describe "as 'none'" do it "should set the terminus class for Key, Certificate, CertificateRevocationList, and CertificateRequest as :file" do - Puppet::SSL::Key.expects(:terminus_class=).with :file - Puppet::SSL::Certificate.expects(:terminus_class=).with :file - Puppet::SSL::CertificateRequest.expects(:terminus_class=).with :file - Puppet::SSL::CertificateRevocationList.expects(:terminus_class=).with :file + Puppet::SSL::Key.indirection.expects(:terminus_class=).with :file + Puppet::SSL::Certificate.indirection.expects(:terminus_class=).with :file + Puppet::SSL::CertificateRequest.indirection.expects(:terminus_class=).with :file + Puppet::SSL::CertificateRevocationList.indirection.expects(:terminus_class=).with :file Puppet::SSL::Host.ca_location = :none end @@ -252,21 +252,21 @@ describe Puppet::SSL::Host do describe "when destroying a host's SSL files" do before do - Puppet::SSL::Key.stubs(:destroy).returns false - Puppet::SSL::Certificate.stubs(:destroy).returns false - Puppet::SSL::CertificateRequest.stubs(:destroy).returns false + Puppet::SSL::Key.indirection.stubs(:destroy).returns false + Puppet::SSL::Certificate.indirection.stubs(:destroy).returns false + Puppet::SSL::CertificateRequest.indirection.stubs(:destroy).returns false end it "should destroy its certificate, certificate request, and key" do - Puppet::SSL::Key.expects(:destroy).with("myhost") - Puppet::SSL::Certificate.expects(:destroy).with("myhost") - Puppet::SSL::CertificateRequest.expects(:destroy).with("myhost") + Puppet::SSL::Key.indirection.expects(:destroy).with("myhost") + Puppet::SSL::Certificate.indirection.expects(:destroy).with("myhost") + Puppet::SSL::CertificateRequest.indirection.expects(:destroy).with("myhost") Puppet::SSL::Host.destroy("myhost") end it "should return true if any of the classes returned true" do - Puppet::SSL::Certificate.expects(:destroy).with("myhost").returns true + Puppet::SSL::Certificate.indirection.expects(:destroy).with("myhost").returns true Puppet::SSL::Host.destroy("myhost").should be_true end @@ -305,12 +305,12 @@ describe Puppet::SSL::Host do end it "should return nil if the key is not set and cannot be found" do - Puppet::SSL::Key.expects(:find).with("myname").returns(nil) + Puppet::SSL::Key.indirection.expects(:find).with("myname").returns(nil) @host.key.should be_nil end it "should find the key in the Key class and return the Puppet instance" do - Puppet::SSL::Key.expects(:find).with("myname").returns(@key) + Puppet::SSL::Key.indirection.expects(:find).with("myname").returns(@key) @host.key.should equal(@key) end @@ -335,7 +335,7 @@ describe Puppet::SSL::Host do end it "should return any previously found key without requerying" do - Puppet::SSL::Key.expects(:find).with("myname").returns(@key).once + Puppet::SSL::Key.indirection.expects(:find).with("myname").returns(@key).once @host.key.should equal(@key) @host.key.should equal(@key) end @@ -348,12 +348,12 @@ describe Puppet::SSL::Host do end it "should return nil if the key is not set and cannot be found" do - Puppet::SSL::CertificateRequest.expects(:find).with("myname").returns(nil) + Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myname").returns(nil) @host.certificate_request.should be_nil end it "should find the request in the Key class and return it and return the Puppet SSL request" do - Puppet::SSL::CertificateRequest.expects(:find).with("myname").returns @request + Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myname").returns @request @host.certificate_request.should equal(@request) end @@ -385,7 +385,7 @@ describe Puppet::SSL::Host do end it "should return any previously found request without requerying" do - Puppet::SSL::CertificateRequest.expects(:find).with("myname").returns(@request).once + Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myname").returns(@request).once @host.certificate_request.should equal(@request) @host.certificate_request.should equal(@request) @@ -415,36 +415,36 @@ describe Puppet::SSL::Host do end it "should find the CA certificate if it does not have a certificate" do - Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert") - Puppet::SSL::Certificate.stubs(:find).with("myname").returns @cert + Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert") + Puppet::SSL::Certificate.indirection.stubs(:find).with("myname").returns @cert @host.certificate end it "should not find the CA certificate if it is the CA host" do @host.expects(:ca?).returns true - Puppet::SSL::Certificate.stubs(:find) - Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).never + Puppet::SSL::Certificate.indirection.stubs(:find) + Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).never @host.certificate end it "should return nil if it cannot find a CA certificate" do - Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).returns nil - Puppet::SSL::Certificate.expects(:find).with("myname").never + Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns nil + Puppet::SSL::Certificate.indirection.expects(:find).with("myname").never @host.certificate.should be_nil end it "should find the key if it does not have one" do - Puppet::SSL::Certificate.stubs(:find) + Puppet::SSL::Certificate.indirection.stubs(:find) @host.expects(:key).returns mock("key") @host.certificate end it "should generate the key if one cannot be found" do - Puppet::SSL::Certificate.stubs(:find) + Puppet::SSL::Certificate.indirection.stubs(:find) @host.expects(:key).returns nil @host.expects(:generate_key) @@ -453,8 +453,8 @@ describe Puppet::SSL::Host do end it "should find the certificate in the Certificate class and return the Puppet certificate instance" do - Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert") - Puppet::SSL::Certificate.expects(:find).with("myname").returns @cert + Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert") + Puppet::SSL::Certificate.indirection.expects(:find).with("myname").returns @cert @host.certificate.should equal(@cert) end @@ -462,14 +462,14 @@ describe Puppet::SSL::Host do it "should fail if the found certificate does not match the private key" do @host.expects(:certificate_matches_key?).returns false - Puppet::SSL::Certificate.stubs(:find).returns @cert + Puppet::SSL::Certificate.indirection.stubs(:find).returns @cert lambda { @host.certificate }.should raise_error(Puppet::Error) end it "should return any previously found certificate" do - Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert") - Puppet::SSL::Certificate.expects(:find).with("myname").returns(@cert).once + Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert") + Puppet::SSL::Certificate.indirection.expects(:find).with("myname").returns(@cert).once @host.certificate.should equal(@cert) @host.certificate.should equal(@cert) @@ -482,30 +482,30 @@ describe Puppet::SSL::Host do describe "when listing certificate hosts" do it "should default to listing all clients with any file types" do - Puppet::SSL::Key.expects(:search).returns [] - Puppet::SSL::Certificate.expects(:search).returns [] - Puppet::SSL::CertificateRequest.expects(:search).returns [] + Puppet::SSL::Key.indirection.expects(:search).returns [] + Puppet::SSL::Certificate.indirection.expects(:search).returns [] + Puppet::SSL::CertificateRequest.indirection.expects(:search).returns [] Puppet::SSL::Host.search end it "should be able to list only clients with a key" do - Puppet::SSL::Key.expects(:search).returns [] - Puppet::SSL::Certificate.expects(:search).never - Puppet::SSL::CertificateRequest.expects(:search).never + Puppet::SSL::Key.indirection.expects(:search).returns [] + Puppet::SSL::Certificate.indirection.expects(:search).never + Puppet::SSL::CertificateRequest.indirection.expects(:search).never Puppet::SSL::Host.search :for => Puppet::SSL::Key end it "should be able to list only clients with a certificate" do - Puppet::SSL::Key.expects(:search).never - Puppet::SSL::Certificate.expects(:search).returns [] - Puppet::SSL::CertificateRequest.expects(:search).never + Puppet::SSL::Key.indirection.expects(:search).never + Puppet::SSL::Certificate.indirection.expects(:search).returns [] + Puppet::SSL::CertificateRequest.indirection.expects(:search).never Puppet::SSL::Host.search :for => Puppet::SSL::Certificate end it "should be able to list only clients with a certificate request" do - Puppet::SSL::Key.expects(:search).never - Puppet::SSL::Certificate.expects(:search).never - Puppet::SSL::CertificateRequest.expects(:search).returns [] + Puppet::SSL::Key.indirection.expects(:search).never + Puppet::SSL::Certificate.indirection.expects(:search).never + Puppet::SSL::CertificateRequest.indirection.expects(:search).returns [] Puppet::SSL::Host.search :for => Puppet::SSL::CertificateRequest end @@ -514,9 +514,9 @@ describe Puppet::SSL::Host do cert = stub 'cert', :name => "cert" csr = stub 'csr', :name => "csr" - Puppet::SSL::Key.expects(:search).returns [key] - Puppet::SSL::Certificate.expects(:search).returns [cert] - Puppet::SSL::CertificateRequest.expects(:search).returns [csr] + Puppet::SSL::Key.indirection.expects(:search).returns [key] + Puppet::SSL::Certificate.indirection.expects(:search).returns [cert] + Puppet::SSL::CertificateRequest.indirection.expects(:search).returns [csr] returned = [] %w{key cert csr}.each do |name| @@ -606,7 +606,7 @@ describe Puppet::SSL::Host do Puppet.settings.stubs(:value).with(:localcacert).returns "ssl_host_testing" - Puppet::SSL::CertificateRevocationList.stubs(:find).returns(nil) + Puppet::SSL::CertificateRevocationList.indirection.stubs(:find).returns(nil) end it "should accept a purpose" do @@ -628,7 +628,7 @@ describe Puppet::SSL::Host do describe "and a CRL is available" do before do @crl = stub 'crl', :content => "real_crl" - Puppet::SSL::CertificateRevocationList.stubs(:find).returns @crl + Puppet::SSL::CertificateRevocationList.indirection.stubs(:find).returns @crl Puppet.settings.stubs(:value).with(:certificate_revocation).returns true end diff --git a/spec/unit/ssl/inventory_spec.rb b/spec/unit/ssl/inventory_spec.rb index a57d6fafc..008fece0b 100755 --- a/spec/unit/ssl/inventory_spec.rb +++ b/spec/unit/ssl/inventory_spec.rb @@ -40,7 +40,7 @@ describe Puppet::SSL::Inventory do Puppet.settings.stubs(:write) FileTest.stubs(:exist?).with("/inven/tory").returns false - Puppet::SSL::Certificate.stubs(:search).returns [] + Puppet::SSL::Certificate.indirection.stubs(:search).returns [] end it "should log that it is building a new inventory file" do @@ -67,7 +67,7 @@ describe Puppet::SSL::Inventory do cert1 = mock 'cert1' cert2 = mock 'cert2' - Puppet::SSL::Certificate.expects(:search).with("*").returns [cert1, cert2] + Puppet::SSL::Certificate.indirection.expects(:search).with("*").returns [cert1, cert2] @class.any_instance.expects(:add).with(cert1) @class.any_instance.expects(:add).with(cert2) diff --git a/spec/unit/status_spec.rb b/spec/unit/status_spec.rb index 71bfa4a44..938bbdf84 100644 --- a/spec/unit/status_spec.rb +++ b/spec/unit/status_spec.rb @@ -4,8 +4,8 @@ require File.dirname(__FILE__) + '/../spec_helper' describe Puppet::Status do it "should implement find" do - Puppet::Status.find( :default ).should be_is_a(Puppet::Status) - Puppet::Status.find( :default ).status["is_alive"].should == true + Puppet::Status.indirection.find( :default ).should be_is_a(Puppet::Status) + Puppet::Status.indirection.find( :default ).status["is_alive"].should == true end it "should default to is_alive is true" do diff --git a/spec/unit/transaction/report_spec.rb b/spec/unit/transaction/report_spec.rb index b310713d2..4dd104c74 100755 --- a/spec/unit/transaction/report_spec.rb +++ b/spec/unit/transaction/report_spec.rb @@ -53,13 +53,6 @@ describe Puppet::Transaction::Report do end describe "when using the indirector" do - it "should redirect :find to the indirection" do - @indirection = stub 'indirection', :name => :report - Puppet::Transaction::Report.stubs(:indirection).returns(@indirection) - @indirection.expects(:find) - Puppet::Transaction::Report.find(:report) - end - it "should redirect :save to the indirection" do Facter.stubs(:value).returns("eh") @indirection = stub 'indirection', :name => :report diff --git a/spec/unit/type/file/source_spec.rb b/spec/unit/type/file/source_spec.rb index a45a1f74e..b6833f77c 100755 --- a/spec/unit/type/file/source_spec.rb +++ b/spec/unit/type/file/source_spec.rb @@ -54,22 +54,22 @@ describe Puppet::Type.type(:file).attrclass(:source) do it "should collect its metadata using the Metadata class if it is not already set" do @source = source.new(:resource => @resource, :value => "/foo/bar") - Puppet::FileServing::Metadata.expects(:find).with("/foo/bar").returns @metadata + Puppet::FileServing::Metadata.indirection.expects(:find).with("/foo/bar").returns @metadata @source.metadata end it "should use the metadata from the first found source" do metadata = stub 'metadata', :source= => nil @source = source.new(:resource => @resource, :value => ["/foo/bar", "/fee/booz"]) - Puppet::FileServing::Metadata.expects(:find).with("/foo/bar").returns nil - Puppet::FileServing::Metadata.expects(:find).with("/fee/booz").returns metadata + Puppet::FileServing::Metadata.indirection.expects(:find).with("/foo/bar").returns nil + Puppet::FileServing::Metadata.indirection.expects(:find).with("/fee/booz").returns metadata @source.metadata.should equal(metadata) end it "should store the found source as the metadata's source" do metadata = mock 'metadata' @source = source.new(:resource => @resource, :value => "/foo/bar") - Puppet::FileServing::Metadata.expects(:find).with("/foo/bar").returns metadata + Puppet::FileServing::Metadata.indirection.expects(:find).with("/foo/bar").returns metadata metadata.expects(:source=).with("/foo/bar") @source.metadata @@ -77,7 +77,7 @@ describe Puppet::Type.type(:file).attrclass(:source) do it "should fail intelligently if an exception is encountered while querying for metadata" do @source = source.new(:resource => @resource, :value => "/foo/bar") - Puppet::FileServing::Metadata.expects(:find).with("/foo/bar").raises RuntimeError + Puppet::FileServing::Metadata.indirection.expects(:find).with("/foo/bar").raises RuntimeError @source.expects(:fail).raises ArgumentError lambda { @source.metadata }.should raise_error(ArgumentError) @@ -85,7 +85,7 @@ describe Puppet::Type.type(:file).attrclass(:source) do it "should fail if no specified sources can be found" do @source = source.new(:resource => @resource, :value => "/foo/bar") - Puppet::FileServing::Metadata.expects(:find).with("/foo/bar").returns nil + Puppet::FileServing::Metadata.indirection.expects(:find).with("/foo/bar").returns nil @source.expects(:fail).raises RuntimeError @@ -96,7 +96,7 @@ describe Puppet::Type.type(:file).attrclass(:source) do expirer = stub 'expired', :dependent_data_expired? => true metadata = stub 'metadata', :source= => nil - Puppet::FileServing::Metadata.expects(:find).with("/fee/booz").returns metadata + Puppet::FileServing::Metadata.indirection.expects(:find).with("/fee/booz").returns metadata @source = source.new(:resource => @resource, :value => ["/fee/booz"]) @source.metadata = "foo" diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb index 7d93dfd64..943a3c38a 100755 --- a/spec/unit/type/file_spec.rb +++ b/spec/unit/type/file_spec.rb @@ -510,47 +510,47 @@ describe Puppet::Type.type(:file) do describe "when executing a recursive search" do it "should use Metadata to do its recursion" do - Puppet::FileServing::Metadata.expects(:search) + Puppet::FileServing::Metadata.indirection.expects(:search) @file.perform_recursion(@file[:path]) end it "should use the provided path as the key to the search" do - Puppet::FileServing::Metadata.expects(:search).with { |key, options| key == "/foo" } + Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| key == "/foo" } @file.perform_recursion("/foo") end it "should return the results of the metadata search" do - Puppet::FileServing::Metadata.expects(:search).returns "foobar" + Puppet::FileServing::Metadata.indirection.expects(:search).returns "foobar" @file.perform_recursion(@file[:path]).should == "foobar" end it "should pass its recursion value to the search" do @file[:recurse] = true - Puppet::FileServing::Metadata.expects(:search).with { |key, options| options[:recurse] == true } + Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:recurse] == true } @file.perform_recursion(@file[:path]) end it "should pass true if recursion is remote" do @file[:recurse] = :remote - Puppet::FileServing::Metadata.expects(:search).with { |key, options| options[:recurse] == true } + Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:recurse] == true } @file.perform_recursion(@file[:path]) end it "should pass its recursion limit value to the search" do @file[:recurselimit] = 10 - Puppet::FileServing::Metadata.expects(:search).with { |key, options| options[:recurselimit] == 10 } + Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:recurselimit] == 10 } @file.perform_recursion(@file[:path]) end it "should configure the search to ignore or manage links" do @file[:links] = :manage - Puppet::FileServing::Metadata.expects(:search).with { |key, options| options[:links] == :manage } + Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:links] == :manage } @file.perform_recursion(@file[:path]) end it "should pass its 'ignore' setting to the search if it has one" do @file[:ignore] = %w{.svn CVS} - Puppet::FileServing::Metadata.expects(:search).with { |key, options| options[:ignore] == %w{.svn CVS} } + Puppet::FileServing::Metadata.indirection.expects(:search).with { |key, options| options[:ignore] == %w{.svn CVS} } @file.perform_recursion(@file[:path]) end end @@ -597,7 +597,7 @@ describe Puppet::Type.type(:file) do it "should set checksum_type to none if this file checksum is none" do @file[:checksum] = :none - Puppet::FileServing::Metadata.expects(:search).with { |path,params| params[:checksum_type] == :none }.returns [@metadata] + Puppet::FileServing::Metadata.indirection.expects(:search).with { |path,params| params[:checksum_type] == :none }.returns [@metadata] @file.expects(:newchild).with("my/file").returns "fiebar" @file.recurse_local end diff --git a/test/language/parser.rb b/test/language/parser.rb index 6f3d751c2..93d4ae693 100755 --- a/test/language/parser.rb +++ b/test/language/parser.rb @@ -500,9 +500,9 @@ file { "/tmp/yayness": ensure if Puppet.features.rails? Puppet[:storeconfigs] = false - Puppet::Resource::Catalog.cache_class = catalog_cache_class - Puppet::Node::Facts.cache_class = facts_cache_class - Puppet::Node.cache_class = node_cache_class + Puppet::Resource::Catalog.indirection.cache_class = catalog_cache_class + Puppet::Node::Facts.indirection.cache_class = facts_cache_class + Puppet::Node.indirection.cache_class = node_cache_class end end @@ -539,9 +539,9 @@ file { "/tmp/yayness": ensure if Puppet.features.rails? Puppet[:storeconfigs] = false - Puppet::Resource::Catalog.cache_class = catalog_cache_class - Puppet::Node::Facts.cache_class = facts_cache_class - Puppet::Node.cache_class = node_cache_class + Puppet::Resource::Catalog.indirection.cache_class = catalog_cache_class + Puppet::Node::Facts.indirection.cache_class = facts_cache_class + Puppet::Node.indirection.cache_class = node_cache_class end end diff --git a/test/language/scope.rb b/test/language/scope.rb index d9c122a92..15c321166 100755 --- a/test/language/scope.rb +++ b/test/language/scope.rb @@ -233,9 +233,9 @@ Host <<||>>" } ensure Puppet[:storeconfigs] = false - Puppet::Resource::Catalog.cache_class = catalog_cache_class - Puppet::Node::Facts.cache_class = facts_cache_class - Puppet::Node.cache_class = node_cache_class + Puppet::Resource::Catalog.indirection.cache_class = catalog_cache_class + Puppet::Node::Facts.indirection.cache_class = facts_cache_class + Puppet::Node.indirection.cache_class = node_cache_class end else $stderr.puts "No ActiveRecord -- skipping collection tests" diff --git a/test/language/snippets.rb b/test/language/snippets.rb index 51c5e23fe..e5b513a46 100755 --- a/test/language/snippets.rb +++ b/test/language/snippets.rb @@ -501,7 +501,7 @@ class TestSnippets < Test::Unit::TestCase catalog = nil assert_nothing_raised("Could not compile catalog") { - catalog = Puppet::Resource::Catalog.find(node) + catalog = Puppet::Resource::Catalog.indirection.find(node) } assert_nothing_raised("Could not convert catalog") { diff --git a/test/network/handler/master.rb b/test/network/handler/master.rb index 81869ac06..018f6904b 100755 --- a/test/network/handler/master.rb +++ b/test/network/handler/master.rb @@ -13,7 +13,7 @@ class TestMaster < Test::Unit::TestCase @master = Puppet::Network::Handler.master.new(:Manifest => tempfile) @catalog = stub 'catalog', :extract => "" - Puppet::Resource::Catalog.stubs(:find).returns(@catalog) + Puppet::Resource::Catalog.indirection.stubs(:find).returns(@catalog) end def teardown @@ -53,7 +53,7 @@ class TestMaster < Test::Unit::TestCase @master.stubs(:decode_facts) - Puppet::Resource::Catalog.expects(:find).with("foo.com").returns(@catalog) + Puppet::Resource::Catalog.indirection.expects(:find).with("foo.com").returns(@catalog) @master.getconfig("facts", "yaml", "foo.com") end @@ -68,7 +68,7 @@ class TestMasterFormats < Test::Unit::TestCase @master.stubs(:decode_facts) @catalog = stub 'catalog', :extract => "" - Puppet::Resource::Catalog.stubs(:find).returns(@catalog) + Puppet::Resource::Catalog.indirection.stubs(:find).returns(@catalog) end def test_marshal_can_be_used -- cgit From 71ecad9904c8c48c023e90e5fbea5b26b180c9cf Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 29 Nov 2010 11:56:40 -0800 Subject: Maint: Refactor code to use .indirection. Replaced uses of the find, search, destroy, and expire methods on model classes with direct calls to the indirection objects. Also removed the old methods that delegated to the indirection object. --- lib/puppet/application/agent.rb | 7 +++-- lib/puppet/application/apply.rb | 8 +++--- lib/puppet/application/kick.rb | 4 +-- lib/puppet/application/master.rb | 4 +-- lib/puppet/application/queue.rb | 4 +-- lib/puppet/application/resource.rb | 4 +-- lib/puppet/configurer.rb | 4 +-- lib/puppet/configurer/fact_handler.rb | 2 +- lib/puppet/defaults.rb | 10 +++---- lib/puppet/file_bucket/dipper.rb | 2 +- lib/puppet/indirector.rb | 25 ------------------ lib/puppet/indirector/catalog/active_record.rb | 2 +- lib/puppet/indirector/catalog/compiler.rb | 2 +- lib/puppet/network/handler/filebucket.rb | 2 +- lib/puppet/network/handler/fileserver.rb | 2 +- lib/puppet/network/handler/master.rb | 2 +- lib/puppet/network/http/webrick.rb | 2 +- lib/puppet/node.rb | 2 +- lib/puppet/node/facts.rb | 2 +- lib/puppet/ssl/certificate_authority.rb | 22 ++++++++-------- lib/puppet/ssl/host.rb | 36 +++++++++++++------------- lib/puppet/ssl/inventory.rb | 2 +- lib/puppet/type/file.rb | 2 +- lib/puppet/type/file/source.rb | 4 +-- 24 files changed, 65 insertions(+), 91 deletions(-) diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb index c5ad72068..96f33296f 100644 --- a/lib/puppet/application/agent.rb +++ b/lib/puppet/application/agent.rb @@ -228,9 +228,9 @@ class Puppet::Application::Agent < Puppet::Application # access to the local files and we don't need a ca. Puppet::SSL::Host.ca_location = options[:fingerprint] ? :none : :remote - Puppet::Transaction::Report.terminus_class = :rest + Puppet::Transaction::Report.indirection.terminus_class = :rest # we want the last report to be persisted locally - Puppet::Transaction::Report.cache_class = :yaml + Puppet::Transaction::Report.indirection.cache_class = :yaml # Override the default; puppetd needs this, usually. # You can still override this on the command-line with, e.g., :compiler. @@ -239,8 +239,7 @@ class Puppet::Application::Agent < Puppet::Application # Override the default. Puppet[:facts_terminus] = :facter - Puppet::Resource::Catalog.cache_class = :yaml - + Puppet::Resource::Catalog.indirection.cache_class = :yaml # We need tomake the client either way, we just don't start it # if --no-client is set. diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index 8ec3fab6b..e5b4bb5b7 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -85,12 +85,12 @@ class Puppet::Application::Apply < Puppet::Application end # Collect our facts. - unless facts = Puppet::Node::Facts.find(Puppet[:certname]) + unless facts = Puppet::Node::Facts.indirection.find(Puppet[:certname]) raise "Could not find facts for #{Puppet[:certname]}" end # Find our Node - unless node = Puppet::Node.find(Puppet[:certname]) + unless node = Puppet::Node.indirection.find(Puppet[:certname]) raise "Could not find node #{Puppet[:certname]}" end @@ -112,7 +112,7 @@ class Puppet::Application::Apply < Puppet::Application begin # Compile our catalog starttime = Time.now - catalog = Puppet::Resource::Catalog.find(node.name, :use_node => node) + catalog = Puppet::Resource::Catalog.indirection.find(node.name, :use_node => node) # Translate it to a RAL catalog catalog = catalog.to_ral @@ -149,7 +149,7 @@ class Puppet::Application::Apply < Puppet::Application end # we want the last report to be persisted locally - Puppet::Transaction::Report.cache_class = :yaml + Puppet::Transaction::Report.indirection.cache_class = :yaml if options[:debug] Puppet::Util::Log.level = :debug diff --git a/lib/puppet/application/kick.rb b/lib/puppet/application/kick.rb index 37aeb1ef2..c6c6fd782 100644 --- a/lib/puppet/application/kick.rb +++ b/lib/puppet/application/kick.rb @@ -175,12 +175,12 @@ class Puppet::Application::Kick < Puppet::Application if Puppet[:node_terminus] == "ldap" and (options[:all] or @classes) if options[:all] - @hosts = Puppet::Node.search("whatever", :fqdn => options[:fqdn]).collect { |node| node.name } + @hosts = Puppet::Node.indirection.search("whatever", :fqdn => options[:fqdn]).collect { |node| node.name } puts "all: #{@hosts.join(", ")}" else @hosts = [] @classes.each do |klass| - list = Puppet::Node.search("whatever", :fqdn => options[:fqdn], :class => klass).collect { |node| node.name } + list = Puppet::Node.indirection.search("whatever", :fqdn => options[:fqdn], :class => klass).collect { |node| node.name } puts "#{klass}: #{list.join(", ")}" @hosts += list diff --git a/lib/puppet/application/master.rb b/lib/puppet/application/master.rb index fde474907..879b66c67 100644 --- a/lib/puppet/application/master.rb +++ b/lib/puppet/application/master.rb @@ -51,7 +51,7 @@ class Puppet::Application::Master < Puppet::Application Puppet::Util::Log.newdestination :console raise ArgumentError, "Cannot render compiled catalogs without pson support" unless Puppet.features.pson? begin - unless catalog = Puppet::Resource::Catalog.find(options[:node]) + unless catalog = Puppet::Resource::Catalog.indirection.find(options[:node]) raise "Could not compile catalog for #{options[:node]}" end @@ -139,7 +139,7 @@ class Puppet::Application::Master < Puppet::Application Puppet.settings.use :main, :master, :ssl # Cache our nodes in yaml. Currently not configurable. - Puppet::Node.cache_class = :yaml + Puppet::Node.indirection.cache_class = :yaml # Configure all of the SSL stuff. if Puppet::SSL::CertificateAuthority.ca? diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb index 239f6b2ad..c7e0ce8cc 100644 --- a/lib/puppet/application/queue.rb +++ b/lib/puppet/application/queue.rb @@ -79,7 +79,7 @@ class Puppet::Application::Queue < Puppet::Application exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs? require 'puppet/resource/catalog' - Puppet::Resource::Catalog.terminus_class = :active_record + Puppet::Resource::Catalog.indirection.terminus_class = :active_record daemon.daemonize if Puppet[:daemonize] @@ -87,6 +87,6 @@ class Puppet::Application::Queue < Puppet::Application # class set up, because if storeconfigs is enabled, # we'll get a loop of continually caching the catalog # for storage again. - Puppet::Resource::Catalog.cache_class = nil + Puppet::Resource::Catalog.indirection.cache_class = nil end end diff --git a/lib/puppet/application/resource.rb b/lib/puppet/application/resource.rb index f55caa58a..3a7fdcc37 100644 --- a/lib/puppet/application/resource.rb +++ b/lib/puppet/application/resource.rb @@ -76,12 +76,12 @@ class Puppet::Application::Resource < Puppet::Application text = if name if params.empty? - [ Puppet::Resource.find( key ) ] + [ Puppet::Resource.indirection.find( key ) ] else [ Puppet::Resource.new( type, name, :parameters => params ).save( key ) ] end else - Puppet::Resource.search( key, {} ) + Puppet::Resource.indirection.search( key, {} ) end.map(&format).join("\n") if options[:edit] diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index 1c0639029..77a9065df 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -224,7 +224,7 @@ class Puppet::Configurer def retrieve_catalog_from_cache(fact_options) result = nil @duration = thinmark do - result = Puppet::Resource::Catalog.find(Puppet[:certname], fact_options.merge(:ignore_terminus => true)) + result = Puppet::Resource::Catalog.indirection.find(Puppet[:certname], fact_options.merge(:ignore_terminus => true)) end Puppet.notice "Using cached catalog" result @@ -237,7 +237,7 @@ class Puppet::Configurer def retrieve_new_catalog(fact_options) result = nil @duration = thinmark do - result = Puppet::Resource::Catalog.find(Puppet[:certname], fact_options.merge(:ignore_cache => true)) + result = Puppet::Resource::Catalog.indirection.find(Puppet[:certname], fact_options.merge(:ignore_cache => true)) end result rescue SystemExit,NoMemoryError diff --git a/lib/puppet/configurer/fact_handler.rb b/lib/puppet/configurer/fact_handler.rb index 075a59458..abe032010 100644 --- a/lib/puppet/configurer/fact_handler.rb +++ b/lib/puppet/configurer/fact_handler.rb @@ -16,7 +16,7 @@ module Puppet::Configurer::FactHandler # compile them and then "cache" them on the server. begin reload_facter - Puppet::Node::Facts.find(Puppet[:certname]) + Puppet::Node::Facts.indirection.find(Puppet[:certname]) rescue SystemExit,NoMemoryError raise rescue Exception => detail diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 8bf1cd84d..1e7229d01 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -121,7 +121,7 @@ module Puppet :hook => proc do |value| require 'puppet/node/facts' if value.to_s == "rest" - Puppet::Node::Facts.cache_class = :yaml + Puppet::Node::Facts.indirection.cache_class = :yaml end end }, @@ -152,7 +152,7 @@ module Puppet Puppet.settings[:storeconfigs] = true # But then we modify the configuration - Puppet::Resource::Catalog.cache_class = :queue + Puppet::Resource::Catalog.indirection.cache_class = :queue else raise "Cannot disable asynchronous storeconfigs in a running process" end @@ -794,9 +794,9 @@ module Puppet if value require 'puppet/rails' raise "StoreConfigs not supported without ActiveRecord 2.1 or higher" unless Puppet.features.rails? - Puppet::Resource::Catalog.cache_class = :active_record unless Puppet.settings[:async_storeconfigs] - Puppet::Node::Facts.cache_class = :active_record - Puppet::Node.cache_class = :active_record + Puppet::Resource::Catalog.indirection.cache_class = :active_record unless Puppet.settings[:async_storeconfigs] + Puppet::Node::Facts.indirection.cache_class = :active_record + Puppet::Node.indirection.cache_class = :active_record end end } diff --git a/lib/puppet/file_bucket/dipper.rb b/lib/puppet/file_bucket/dipper.rb index dbfcdcd43..8d6938930 100644 --- a/lib/puppet/file_bucket/dipper.rb +++ b/lib/puppet/file_bucket/dipper.rb @@ -47,7 +47,7 @@ class Puppet::FileBucket::Dipper # Retrieve a file by sum. def getfile(sum) source_path = "#{@rest_path}md5/#{sum}" - file_bucket_file = Puppet::FileBucket::File.find(source_path, :bucket_path => @local_path) + file_bucket_file = Puppet::FileBucket::File.indirection.find(source_path, :bucket_path => @local_path) raise Puppet::Error, "File not found" unless file_bucket_file file_bucket_file.to_s diff --git a/lib/puppet/indirector.rb b/lib/puppet/indirector.rb index 5b737578b..b0cabab8a 100644 --- a/lib/puppet/indirector.rb +++ b/lib/puppet/indirector.rb @@ -32,31 +32,6 @@ module Puppet::Indirector module ClassMethods attr_reader :indirection - - def cache_class=(klass) - indirection.cache_class = klass - end - - def terminus_class=(klass) - indirection.terminus_class = klass - end - - # Expire any cached instance. - def expire(*args) - indirection.expire(*args) - end - - def find(*args) - indirection.find(*args) - end - - def destroy(*args) - indirection.destroy(*args) - end - - def search(*args) - indirection.search(*args) - end end module InstanceMethods diff --git a/lib/puppet/indirector/catalog/active_record.rb b/lib/puppet/indirector/catalog/active_record.rb index fabb08eb9..5157fb538 100644 --- a/lib/puppet/indirector/catalog/active_record.rb +++ b/lib/puppet/indirector/catalog/active_record.rb @@ -30,7 +30,7 @@ class Puppet::Resource::Catalog::ActiveRecord < Puppet::Indirector::ActiveRecord host.merge_resources(catalog.vertices) host.last_compile = Time.now - if node = Puppet::Node.find(catalog.name) + if node = Puppet::Node.indirection.find(catalog.name) host.ip = node.parameters["ipaddress"] host.environment = node.environment end diff --git a/lib/puppet/indirector/catalog/compiler.rb b/lib/puppet/indirector/catalog/compiler.rb index 78be4caf7..b80143a4d 100644 --- a/lib/puppet/indirector/catalog/compiler.rb +++ b/lib/puppet/indirector/catalog/compiler.rb @@ -88,7 +88,7 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code # Turn our host name into a node object. def find_node(name) begin - return nil unless node = Puppet::Node.find(name) + return nil unless node = Puppet::Node.indirection.find(name) rescue => detail puts detail.backtrace if Puppet[:trace] raise Puppet::Error, "Failed when searching for node #{name}: #{detail}" diff --git a/lib/puppet/network/handler/filebucket.rb b/lib/puppet/network/handler/filebucket.rb index 6aaa2df1c..ee10dbddb 100755 --- a/lib/puppet/network/handler/filebucket.rb +++ b/lib/puppet/network/handler/filebucket.rb @@ -33,7 +33,7 @@ class Puppet::Network::Handler # :nodoc: # Return the contents associated with a given md5 sum. def getfile(md5, client = nil, clientip = nil) - bucket = Puppet::FileBucket::File.find("md5:#{md5}") + bucket = Puppet::FileBucket::File.indirection.find("md5:#{md5}") contents = bucket.contents if client diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb index 9abc7ee1a..5b4b17a32 100755 --- a/lib/puppet/network/handler/fileserver.rb +++ b/lib/puppet/network/handler/fileserver.rb @@ -236,7 +236,7 @@ class Puppet::Network::Handler unless hostname = (client || Facter.value("hostname")) raise ArgumentError, "Could not find hostname" end - env = (node = Puppet::Node.find(hostname)) ? node.environment : nil + env = (node = Puppet::Node.indirection.find(hostname)) ? node.environment : nil # And use the environment to look up the module. (mod = Puppet::Node::Environment.new(env).module(module_name) and mod.files?) ? @mounts[MODULES].copy(mod.name, mod.file_directory) : nil diff --git a/lib/puppet/network/handler/master.rb b/lib/puppet/network/handler/master.rb index c21aafafc..5b9dd332a 100644 --- a/lib/puppet/network/handler/master.rb +++ b/lib/puppet/network/handler/master.rb @@ -49,7 +49,7 @@ class Puppet::Network::Handler # Pass the facts to the fact handler Puppet::Node::Facts.new(client, facts).save unless local? - catalog = Puppet::Resource::Catalog.find(client) + catalog = Puppet::Resource::Catalog.indirection.find(client) case format when "yaml" diff --git a/lib/puppet/network/http/webrick.rb b/lib/puppet/network/http/webrick.rb index 8ed0b28ca..54bcf30c2 100644 --- a/lib/puppet/network/http/webrick.rb +++ b/lib/puppet/network/http/webrick.rb @@ -105,7 +105,7 @@ class Puppet::Network::HTTP::WEBrick results[:SSLStartImmediately] = true results[:SSLEnable] = true - raise Puppet::Error, "Could not find CA certificate" unless Puppet::SSL::Certificate.find(Puppet::SSL::CA_NAME) + raise Puppet::Error, "Could not find CA certificate" unless Puppet::SSL::Certificate.indirection.find(Puppet::SSL::CA_NAME) results[:SSLCACertificateFile] = Puppet[:localcacert] results[:SSLVerifyClient] = OpenSSL::SSL::VERIFY_PEER diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb index e8d58e6be..5b0a98615 100644 --- a/lib/puppet/node.rb +++ b/lib/puppet/node.rb @@ -57,7 +57,7 @@ class Puppet::Node # Merge the node facts with parameters from the node source. def fact_merge - if facts = Puppet::Node::Facts.find(name) + if facts = Puppet::Node::Facts.indirection.find(name) merge(facts.values) end rescue => detail diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb index d84d54113..612dc3239 100755 --- a/lib/puppet/node/facts.rb +++ b/lib/puppet/node/facts.rb @@ -16,7 +16,7 @@ class Puppet::Node::Facts # We want to expire any cached nodes if the facts are saved. module NodeExpirer def save(key, instance) - Puppet::Node.expire(instance.name) + Puppet::Node.indirection.expire(instance.name) super end end diff --git a/lib/puppet/ssl/certificate_authority.rb b/lib/puppet/ssl/certificate_authority.rb index 0c226ca6a..5725be4d5 100644 --- a/lib/puppet/ssl/certificate_authority.rb +++ b/lib/puppet/ssl/certificate_authority.rb @@ -63,7 +63,7 @@ class Puppet::SSL::CertificateAuthority store = nil store = autosign_store(auto) if auto != true - Puppet::SSL::CertificateRequest.search("*").each do |csr| + Puppet::SSL::CertificateRequest.indirection.search("*").each do |csr| sign(csr.name) if auto == true or store.allowed?(csr.name, "127.1.1.1") end end @@ -93,7 +93,7 @@ class Puppet::SSL::CertificateAuthority # Retrieve (or create, if necessary) the certificate revocation list. def crl unless defined?(@crl) - unless @crl = Puppet::SSL::CertificateRevocationList.find(Puppet::SSL::CA_NAME) + unless @crl = Puppet::SSL::CertificateRevocationList.indirection.find(Puppet::SSL::CA_NAME) @crl = Puppet::SSL::CertificateRevocationList.new(Puppet::SSL::CA_NAME) @crl.generate(host.certificate.content, host.key.content) @crl.save @@ -109,7 +109,7 @@ class Puppet::SSL::CertificateAuthority # Generate a new certificate. def generate(name) - raise ArgumentError, "A Certificate already exists for #{name}" if Puppet::SSL::Certificate.find(name) + raise ArgumentError, "A Certificate already exists for #{name}" if Puppet::SSL::Certificate.indirection.find(name) host = Puppet::SSL::Host.new(name) host.generate_certificate_request @@ -169,7 +169,7 @@ class Puppet::SSL::CertificateAuthority # List all signed certificates. def list - Puppet::SSL::Certificate.search("*").collect { |c| c.name } + Puppet::SSL::Certificate.indirection.search("*").collect { |c| c.name } end # Read the next serial from the serial file, and increment the @@ -199,14 +199,14 @@ class Puppet::SSL::CertificateAuthority # Print a given host's certificate as text. def print(name) - (cert = Puppet::SSL::Certificate.find(name)) ? cert.to_text : nil + (cert = Puppet::SSL::Certificate.indirection.find(name)) ? cert.to_text : nil end # Revoke a given certificate. def revoke(name) raise ArgumentError, "Cannot revoke certificates when the CRL is disabled" unless crl - if cert = Puppet::SSL::Certificate.find(name) + if cert = Puppet::SSL::Certificate.indirection.find(name) serial = cert.content.serial elsif ! serial = inventory.serial(name) raise ArgumentError, "Could not find a serial number for #{name}" @@ -229,7 +229,7 @@ class Puppet::SSL::CertificateAuthority csr = self_signing_csr issuer = csr.content else - unless csr = Puppet::SSL::CertificateRequest.find(hostname) + unless csr = Puppet::SSL::CertificateRequest.indirection.find(hostname) raise ArgumentError, "Could not find certificate request for #{hostname}" end issuer = host.certificate.content @@ -251,14 +251,14 @@ class Puppet::SSL::CertificateAuthority cert.save # And remove the CSR if this wasn't self signed. - Puppet::SSL::CertificateRequest.destroy(csr.name) unless self_signing_csr + Puppet::SSL::CertificateRequest.indirection.destroy(csr.name) unless self_signing_csr cert end # Verify a given host's certificate. def verify(name) - unless cert = Puppet::SSL::Certificate.find(name) + unless cert = Puppet::SSL::Certificate.indirection.find(name) raise ArgumentError, "Could not find a certificate for #{name}" end store = OpenSSL::X509::Store.new @@ -271,7 +271,7 @@ class Puppet::SSL::CertificateAuthority end def fingerprint(name, md = :MD5) - unless cert = Puppet::SSL::Certificate.find(name) || Puppet::SSL::CertificateRequest.find(name) + unless cert = Puppet::SSL::Certificate.indirection.find(name) || Puppet::SSL::CertificateRequest.indirection.find(name) raise ArgumentError, "Could not find a certificate or csr for #{name}" end cert.fingerprint(md) @@ -279,6 +279,6 @@ class Puppet::SSL::CertificateAuthority # List the waiting certificate requests. def waiting? - Puppet::SSL::CertificateRequest.search("*").collect { |r| r.name } + Puppet::SSL::CertificateRequest.indirection.search("*").collect { |r| r.name } end end diff --git a/lib/puppet/ssl/host.rb b/lib/puppet/ssl/host.rb index 8a6f0aa6d..6539b057e 100644 --- a/lib/puppet/ssl/host.rb +++ b/lib/puppet/ssl/host.rb @@ -43,31 +43,31 @@ class Puppet::SSL::Host # Configure how our various classes interact with their various terminuses. def self.configure_indirection(terminus, cache = nil) - Certificate.terminus_class = terminus - CertificateRequest.terminus_class = terminus - CertificateRevocationList.terminus_class = terminus + Certificate.indirection.terminus_class = terminus + CertificateRequest.indirection.terminus_class = terminus + CertificateRevocationList.indirection.terminus_class = terminus if cache # This is weird; we don't actually cache our keys, we # use what would otherwise be the cache as our normal # terminus. - Key.terminus_class = cache + Key.indirection.terminus_class = cache else - Key.terminus_class = terminus + Key.indirection.terminus_class = terminus end if cache - Certificate.cache_class = cache - CertificateRequest.cache_class = cache - CertificateRevocationList.cache_class = cache + Certificate.indirection.cache_class = cache + CertificateRequest.indirection.cache_class = cache + CertificateRevocationList.indirection.cache_class = cache else # Make sure we have no cache configured. puppet master # switches the configurations around a bit, so it's important # that we specify the configs for absolutely everything, every # time. - Certificate.cache_class = nil - CertificateRequest.cache_class = nil - CertificateRevocationList.cache_class = nil + Certificate.indirection.cache_class = nil + CertificateRequest.indirection.cache_class = nil + CertificateRevocationList.indirection.cache_class = nil end end @@ -94,7 +94,7 @@ class Puppet::SSL::Host # Remove all traces of a given host def self.destroy(name) - [Key, Certificate, CertificateRequest].collect { |part| part.destroy(name) }.any? { |x| x } + [Key, Certificate, CertificateRequest].collect { |part| part.indirection.destroy(name) }.any? { |x| x } end # Search for more than one host, optionally only specifying @@ -106,7 +106,7 @@ class Puppet::SSL::Host # Collect the results from each class, flatten them, collect all of the names, make the name list unique, # then create a Host instance for each one. - classlist.collect { |klass| klass.search }.flatten.collect { |r| r.name }.uniq.collect do |name| + classlist.collect { |klass| klass.indirection.search }.flatten.collect { |r| r.name }.uniq.collect do |name| new(name) end end @@ -117,7 +117,7 @@ class Puppet::SSL::Host end def key - @key ||= Key.find(name) + @key ||= Key.indirection.find(name) end # This is the private key; we can create it from scratch @@ -135,7 +135,7 @@ class Puppet::SSL::Host end def certificate_request - @certificate_request ||= CertificateRequest.find(name) + @certificate_request ||= CertificateRequest.indirection.find(name) end # Our certificate request requires the key but that's all. @@ -159,8 +159,8 @@ class Puppet::SSL::Host # get the CA cert first, since it's required for the normal cert # to be of any use. - return nil unless Certificate.find("ca") unless ca? - return nil unless @certificate = Certificate.find(name) + return nil unless Certificate.indirection.find("ca") unless ca? + return nil unless @certificate = Certificate.indirection.find(name) unless certificate_matches_key? raise Puppet::Error, "Retrieved certificate does not match private key; please remove certificate from server and regenerate it with the current key" @@ -212,7 +212,7 @@ class Puppet::SSL::Host @ssl_store.add_file(Puppet[:localcacert]) # If there's a CRL, add it to our store. - if crl = Puppet::SSL::CertificateRevocationList.find(CA_NAME) + if crl = Puppet::SSL::CertificateRevocationList.indirection.find(CA_NAME) @ssl_store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL|OpenSSL::X509::V_FLAG_CRL_CHECK if Puppet.settings[:certificate_revocation] @ssl_store.add_crl(crl.content) end diff --git a/lib/puppet/ssl/inventory.rb b/lib/puppet/ssl/inventory.rb index b2b402a53..e094da100 100644 --- a/lib/puppet/ssl/inventory.rb +++ b/lib/puppet/ssl/inventory.rb @@ -36,7 +36,7 @@ class Puppet::SSL::Inventory f.print "# Inventory of signed certificates\n# SERIAL NOT_BEFORE NOT_AFTER SUBJECT\n" end - Puppet::SSL::Certificate.search("*").each { |cert| add(cert) } + Puppet::SSL::Certificate.indirection.search("*").each { |cert| add(cert) } end # Find the serial number for a given certificate. diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index f35a26408..0a07b6798 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -587,7 +587,7 @@ Puppet::Type.newtype(:file) do def perform_recursion(path) - Puppet::FileServing::Metadata.search( + Puppet::FileServing::Metadata.indirection.search( path, :links => self[:links], diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb index 7d03de2b0..19dabbdc3 100755 --- a/lib/puppet/type/file/source.rb +++ b/lib/puppet/type/file/source.rb @@ -98,7 +98,7 @@ module Puppet cached_attr(:content) do raise Puppet::DevError, "No source for content was stored with the metadata" unless metadata.source - unless tmp = Puppet::FileServing::Content.find(metadata.source) + unless tmp = Puppet::FileServing::Content.indirection.find(metadata.source) fail "Could not find any content at %s" % metadata.source end tmp.content @@ -148,7 +148,7 @@ module Puppet result = nil value.each do |source| begin - if data = Puppet::FileServing::Metadata.find(source) + if data = Puppet::FileServing::Metadata.indirection.find(source) result = data result.source = source break -- cgit From 8766efea906f57428ff175cae9355d4b03d499d9 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Tue, 30 Nov 2010 11:09:20 -0800 Subject: Maint: Make http handler code call the indirector through ".indirection" In commit 71ecad9904c8c48c023e90e5fbea5b26b180c9cf we removed the delegation from model class to indirection for the "find", "search", "destroy", and "expire" methods. When we did this we neglected to modify http handler code to call the indirector directly. This patch makes the appropriate changes to http handler code. --- lib/puppet/network/http/handler.rb | 6 +++--- spec/unit/network/http/handler_spec.rb | 36 ++++++++++++++++++---------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb index 82238aa0a..fbd7d195f 100644 --- a/lib/puppet/network/http/handler.rb +++ b/lib/puppet/network/http/handler.rb @@ -103,7 +103,7 @@ module Puppet::Network::HTTP::Handler # Execute our find. def do_find(indirection_name, key, params, request, response) - unless result = model(indirection_name).find(key, params) + unless result = model(indirection_name).indirection.find(key, params) Puppet.info("Could not find #{indirection_name} for '#{key}'") return do_exception(response, "Could not find #{indirection_name} #{key}", 404) end @@ -120,7 +120,7 @@ module Puppet::Network::HTTP::Handler # Execute our search. def do_search(indirection_name, key, params, request, response) model = self.model(indirection_name) - result = model.search(key, params) + result = model.indirection.search(key, params) if result.nil? return do_exception(response, "Could not find instances in #{indirection_name} with '#{key}'", 404) @@ -134,7 +134,7 @@ module Puppet::Network::HTTP::Handler # Execute our destroy. def do_destroy(indirection_name, key, params, request, response) - result = model(indirection_name).destroy(key, params) + result = model(indirection_name).indirection.destroy(key, params) return_yaml_response(response, result) end diff --git a/spec/unit/network/http/handler_spec.rb b/spec/unit/network/http/handler_spec.rb index 16f1b5349..9dddc9962 100755 --- a/spec/unit/network/http/handler_spec.rb +++ b/spec/unit/network/http/handler_spec.rb @@ -46,6 +46,8 @@ describe Puppet::Network::HTTP::Handler do @request.stubs(:[]).returns "foo" @response = stub('http response') @model_class = stub('indirected model class') + @indirection = stub('indirection') + @model_class.stubs(:indirection).returns(@indirection) @result = stub 'result', :render => "mytext" @@ -126,7 +128,7 @@ describe Puppet::Network::HTTP::Handler do describe "when finding a model instance" do before do - @model_class.stubs(:find).returns @result + @indirection.stubs(:find).returns @result Puppet::Indirector::Indirection.expects(:instance).with(:my_handler).returns( stub "indirection", :model => @model_class ) @format = stub 'format', :suitable? => true, :mime => "text/format", :name => "format" @@ -141,14 +143,14 @@ describe Puppet::Network::HTTP::Handler do end it "should use the escaped request key" do - @model_class.expects(:find).with do |key, args| + @indirection.expects(:find).with do |key, args| key == "my_result" end.returns @result @handler.do_find("my_handler", "my_result", {}, @request, @response) end it "should use a common method for determining the request parameters" do - @model_class.expects(:find).with do |key, args| + @indirection.expects(:find).with do |key, args| args[:foo] == :baz and args[:bar] == :xyzzy end.returns @result @handler.do_find("my_handler", "my_result", {:foo => :baz, :bar => :xyzzy}, @request, @response) @@ -200,20 +202,20 @@ describe Puppet::Network::HTTP::Handler do @model_instance.expects(:render).returns "my_rendered_object" @handler.expects(:set_response).with { |response, body, status| body == "my_rendered_object" } - @model_class.stubs(:find).returns(@model_instance) + @indirection.stubs(:find).returns(@model_instance) @handler.do_find("my_handler", "my_result", {}, @request, @response) end it "should return a 404 when no model instance can be found" do @model_class.stubs(:name).returns "my name" @handler.expects(:set_response).with { |response, body, status| status == 404 } - @model_class.stubs(:find).returns(nil) + @indirection.stubs(:find).returns(nil) @handler.do_find("my_handler", "my_result", {}, @request, @response) end it "should write a log message when no model instance can be found" do @model_class.stubs(:name).returns "my name" - @model_class.stubs(:find).returns(nil) + @indirection.stubs(:find).returns(nil) Puppet.expects(:info).with("Could not find my_handler for 'my_result'") @@ -226,7 +228,7 @@ describe Puppet::Network::HTTP::Handler do @handler.expects(:format_to_use).returns(@oneformat) @model_instance.expects(:render).with(@oneformat).returns "my_rendered_object" - @model_class.stubs(:find).returns(@model_instance) + @indirection.stubs(:find).returns(@model_instance) @handler.do_find("my_handler", "my_result", {}, @request, @response) end end @@ -240,7 +242,7 @@ describe Puppet::Network::HTTP::Handler do @result = [@result1, @result2] @model_class.stubs(:render_multiple).returns "my rendered instances" - @model_class.stubs(:search).returns(@result) + @indirection.stubs(:search).returns(@result) @format = stub 'format', :suitable? => true, :mime => "text/format", :name => "format" Puppet::Network::FormatHandler.stubs(:format).returns @format @@ -254,14 +256,14 @@ describe Puppet::Network::HTTP::Handler do end it "should use a common method for determining the request parameters" do - @model_class.expects(:search).with do |key, args| + @indirection.expects(:search).with do |key, args| args[:foo] == :baz and args[:bar] == :xyzzy end.returns @result @handler.do_search("my_handler", "my_result", {:foo => :baz, :bar => :xyzzy}, @request, @response) end it "should use the default status when a model search call succeeds" do - @model_class.stubs(:search).returns(@result) + @indirection.stubs(:search).returns(@result) @handler.do_search("my_handler", "my_result", {}, @request, @response) end @@ -275,7 +277,7 @@ describe Puppet::Network::HTTP::Handler do it "should return a list of serialized objects when a model search call succeeds" do @handler.expects(:accept_header).with(@request).returns "one,two" - @model_class.stubs(:search).returns(@result) + @indirection.stubs(:search).returns(@result) @model_class.expects(:render_multiple).with(@oneformat, @result).returns "my rendered instances" @@ -285,7 +287,7 @@ describe Puppet::Network::HTTP::Handler do it "should return [] when searching returns an empty array" do @handler.expects(:accept_header).with(@request).returns "one,two" - @model_class.stubs(:search).returns([]) + @indirection.stubs(:search).returns([]) @model_class.expects(:render_multiple).with(@oneformat, []).returns "[]" @@ -296,7 +298,7 @@ describe Puppet::Network::HTTP::Handler do it "should return a 404 when searching returns nil" do @model_class.stubs(:name).returns "my name" @handler.expects(:set_response).with { |response, body, status| status == 404 } - @model_class.stubs(:search).returns(nil) + @indirection.stubs(:search).returns(nil) @handler.do_search("my_handler", "my_result", {}, @request, @response) end end @@ -306,7 +308,7 @@ describe Puppet::Network::HTTP::Handler do Puppet::Indirector::Indirection.expects(:instance).with(:my_handler).returns( stub "indirection", :model => @model_class ) @result = stub 'result', :render => "the result" - @model_class.stubs(:destroy).returns @result + @indirection.stubs(:destroy).returns @result end it "should use the indirection request to find the model" do @@ -314,14 +316,14 @@ describe Puppet::Network::HTTP::Handler do end it "should use the escaped request key to destroy the instance in the model" do - @model_class.expects(:destroy).with do |key, args| + @indirection.expects(:destroy).with do |key, args| key == "foo bar" end @handler.do_destroy("my_handler", "foo bar", {}, @request, @response) end it "should use a common method for determining the request parameters" do - @model_class.expects(:destroy).with do |key, args| + @indirection.expects(:destroy).with do |key, args| args[:foo] == :baz and args[:bar] == :xyzzy end @handler.do_destroy("my_handler", "my_result", {:foo => :baz, :bar => :xyzzy}, @request, @response) @@ -334,7 +336,7 @@ describe Puppet::Network::HTTP::Handler do it "should return a yaml-encoded result when a model destroy call succeeds" do @result = stub 'result', :to_yaml => "the result" - @model_class.expects(:destroy).returns(@result) + @indirection.expects(:destroy).returns(@result) @handler.expects(:set_response).with { |response, body, status| body == "the result" } -- cgit From 3063000155ddc475d1703d10cfc13770f687c3b2 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 29 Nov 2010 14:52:26 -0800 Subject: Maint: Swap the order of arguments to Indirection#save The first argument was often nil, and the second was mandatory. --- lib/puppet/indirector.rb | 2 +- lib/puppet/indirector/indirection.rb | 2 +- lib/puppet/node/facts.rb | 2 +- spec/integration/configurer_spec.rb | 2 +- spec/unit/indirector/indirection_spec.rb | 3 --- spec/unit/indirector_spec.rb | 2 +- spec/unit/ssl/certificate_request_spec.rb | 4 ++-- 7 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/puppet/indirector.rb b/lib/puppet/indirector.rb index b0cabab8a..d3455c014 100644 --- a/lib/puppet/indirector.rb +++ b/lib/puppet/indirector.rb @@ -36,7 +36,7 @@ module Puppet::Indirector module InstanceMethods def save(key = nil) - self.class.indirection.save key, self + self.class.indirection.save self, key end end end diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb index 9095e48f8..eb0aa8aee 100644 --- a/lib/puppet/indirector/indirection.rb +++ b/lib/puppet/indirector/indirection.rb @@ -247,7 +247,7 @@ class Puppet::Indirector::Indirection # Save the instance in the appropriate terminus. This method is # normally an instance method on the indirected class. - def save(key, instance = nil) + def save(instance, key = nil) request = request(:save, key, instance) terminus = prepare(request) diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb index 612dc3239..fd99adc3b 100755 --- a/lib/puppet/node/facts.rb +++ b/lib/puppet/node/facts.rb @@ -15,7 +15,7 @@ class Puppet::Node::Facts # We want to expire any cached nodes if the facts are saved. module NodeExpirer - def save(key, instance) + def save(instance, key) Puppet::Node.indirection.expire(instance.name) super end diff --git a/spec/integration/configurer_spec.rb b/spec/integration/configurer_spec.rb index cb7d3d779..71b9652e8 100755 --- a/spec/integration/configurer_spec.rb +++ b/spec/integration/configurer_spec.rb @@ -34,7 +34,7 @@ describe Puppet::Configurer do it "should send a transaction report with valid data" do @configurer.stubs(:save_last_run_summary) - Puppet::Transaction::Report.indirection.expects(:save).with do |x, report| + Puppet::Transaction::Report.indirection.expects(:save).with do |report, x| report.time.class == Time and report.logs.length > 0 end diff --git a/spec/unit/indirector/indirection_spec.rb b/spec/unit/indirector/indirection_spec.rb index b0e0f019c..f49d94f8e 100755 --- a/spec/unit/indirector/indirection_spec.rb +++ b/spec/unit/indirector/indirection_spec.rb @@ -386,9 +386,6 @@ describe Puppet::Indirector::Indirection do describe "and storing a model instance" do before { @method = :save } - it_should_behave_like "Indirection Delegator" - it_should_behave_like "Delegation Authorizer" - it "should return the result of the save" do @terminus.stubs(:save).returns "foo" @indirection.save(@instance).should == "foo" diff --git a/spec/unit/indirector_spec.rb b/spec/unit/indirector_spec.rb index 5aae5d00e..119a52eec 100755 --- a/spec/unit/indirector_spec.rb +++ b/spec/unit/indirector_spec.rb @@ -92,7 +92,7 @@ describe Puppet::Indirector, "when redirecting a model" do end it "should pass the instance and an optional key to the indirection's :save method" do - @indirection.expects(:save).with("key", @instance) + @indirection.expects(:save).with(@instance, "key") @instance.save "key" end diff --git a/spec/unit/ssl/certificate_request_spec.rb b/spec/unit/ssl/certificate_request_spec.rb index 437fc0556..f37f9bae4 100755 --- a/spec/unit/ssl/certificate_request_spec.rb +++ b/spec/unit/ssl/certificate_request_spec.rb @@ -200,7 +200,7 @@ describe Puppet::SSL::CertificateRequest do Puppet::SSL::CertificateAuthority.expects(:instance).returns ca csr = Puppet::SSL::CertificateRequest.new("me") - Puppet::SSL::CertificateRequest.indirection.expects(:save).with(nil, csr) + Puppet::SSL::CertificateRequest.indirection.expects(:save).with(csr, nil) csr.save end @@ -211,7 +211,7 @@ describe Puppet::SSL::CertificateRequest do Puppet::SSL::CertificateAuthority.expects(:instance).returns nil csr = Puppet::SSL::CertificateRequest.new("me") - Puppet::SSL::CertificateRequest.indirection.expects(:save).with(nil, csr) + Puppet::SSL::CertificateRequest.indirection.expects(:save).with(csr, nil) csr.save end -- cgit From beb85d65e4cced7691163add392f53ec58cb1a3d Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Mon, 29 Nov 2010 16:32:41 -0800 Subject: Maint: Moved auto-signing logic into an indirector extension Autosigning was previously accomplished by overriding CertificateRequest#save. This meant that it wouldn't work if certificate requests were saved via a direct call to Indirection#save. Changed it to use the indirector :extend mechanism, which works no matter how the save is invoked. --- lib/puppet/ssl/certificate_request.rb | 24 ++++++++++++++---------- spec/unit/ssl/certificate_request_spec.rb | 8 ++++++-- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/lib/puppet/ssl/certificate_request.rb b/lib/puppet/ssl/certificate_request.rb index 2f6cae3f5..8c83339a1 100644 --- a/lib/puppet/ssl/certificate_request.rb +++ b/lib/puppet/ssl/certificate_request.rb @@ -5,7 +5,20 @@ class Puppet::SSL::CertificateRequest < Puppet::SSL::Base wraps OpenSSL::X509::Request extend Puppet::Indirector - indirects :certificate_request, :terminus_class => :file + + # If auto-signing is on, sign any certificate requests as they are saved. + module AutoSigner + def save(instance, key = nil) + super + + # Try to autosign the CSR. + if ca = Puppet::SSL::CertificateAuthority.instance + ca.autosign + end + end + end + + indirects :certificate_request, :terminus_class => :file, :extend => AutoSigner # Convert a string into an instance. def self.from_s(string) @@ -46,13 +59,4 @@ class Puppet::SSL::CertificateRequest < Puppet::SSL::Base Puppet.info "Certificate Request fingerprint (md5): #{fingerprint}" @content end - - def save(args = {}) - super() - - # Try to autosign the CSR. - if ca = Puppet::SSL::CertificateAuthority.instance - ca.autosign - end - end end diff --git a/spec/unit/ssl/certificate_request_spec.rb b/spec/unit/ssl/certificate_request_spec.rb index f37f9bae4..25b77b332 100755 --- a/spec/unit/ssl/certificate_request_spec.rb +++ b/spec/unit/ssl/certificate_request_spec.rb @@ -200,7 +200,9 @@ describe Puppet::SSL::CertificateRequest do Puppet::SSL::CertificateAuthority.expects(:instance).returns ca csr = Puppet::SSL::CertificateRequest.new("me") - Puppet::SSL::CertificateRequest.indirection.expects(:save).with(csr, nil) + terminus = mock 'terminus' + Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus) + terminus.expects(:save).with { |request| puts request.key.inspect; request.instance == csr && request.key == "me" } csr.save end @@ -211,7 +213,9 @@ describe Puppet::SSL::CertificateRequest do Puppet::SSL::CertificateAuthority.expects(:instance).returns nil csr = Puppet::SSL::CertificateRequest.new("me") - Puppet::SSL::CertificateRequest.indirection.expects(:save).with(csr, nil) + terminus = mock 'terminus' + Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus) + terminus.expects(:save).with { |request| puts request.key.inspect; request.instance == csr && request.key == "me" } csr.save end -- cgit From 7de6af87109062a4c0b038f2f2d93191e6a93e4f Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Tue, 30 Nov 2010 11:59:45 -0800 Subject: Maint: Add a default value for key in Facts::NodeExpirer#save Changed to match the signature of the method being overridden. This will allow code to call Facts.indirection.save() without a key. --- lib/puppet/node/facts.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb index fd99adc3b..451813f7d 100755 --- a/lib/puppet/node/facts.rb +++ b/lib/puppet/node/facts.rb @@ -15,7 +15,7 @@ class Puppet::Node::Facts # We want to expire any cached nodes if the facts are saved. module NodeExpirer - def save(instance, key) + def save(instance, key = nil) Puppet::Node.indirection.expire(instance.name) super end -- cgit From 779fea867a9e23ad48cd877a88756cc5792e9e0c Mon Sep 17 00:00:00 2001 From: Nigel Kersten Date: Mon, 15 Nov 2010 12:36:34 -0800 Subject: (#5304) Use internal_name rather than real_name for maillist provider We've switched to using list_lists --bare which shows the internal_name rather than "real_name", which is the authoritative identifier. Doing this also means we have less output to scrub, so the code is simpler. Signed-off-by: Nigel Kersten --- lib/puppet/provider/maillist/mailman.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/puppet/provider/maillist/mailman.rb b/lib/puppet/provider/maillist/mailman.rb index 4fdc20a69..633642af7 100755 --- a/lib/puppet/provider/maillist/mailman.rb +++ b/lib/puppet/provider/maillist/mailman.rb @@ -2,11 +2,11 @@ require 'puppet/provider/parsedfile' Puppet::Type.type(:maillist).provide(:mailman) do if [ "CentOS", "RedHat", "Fedora" ].any? { |os| Facter.value(:operatingsystem) == os } - commands :list_lists => "/usr/lib/mailman/bin/list_lists", :rmlist => "/usr/lib/mailman/bin/rmlist", :newlist => "/usr/lib/mailman/bin/newlist" + commands :list_lists => "/usr/lib/mailman/bin/list_lists --bare", :rmlist => "/usr/lib/mailman/bin/rmlist", :newlist => "/usr/lib/mailman/bin/newlist" commands :mailman => "/usr/lib/mailman/mail/mailman" else # This probably won't work for non-Debian installs, but this path is sure not to be in the PATH. - commands :list_lists => "list_lists", :rmlist => "rmlist", :newlist => "newlist" + commands :list_lists => "list_lists --bare", :rmlist => "rmlist", :newlist => "newlist" commands :mailman => "/var/lib/mailman/mail/mailman" end @@ -14,10 +14,9 @@ Puppet::Type.type(:maillist).provide(:mailman) do # Return a list of existing mailman instances. def self.instances - list_lists.split("\n").reject { |line| line.include?("matching mailing lists") }.collect do |line| - name, description = line.sub(/^\s+/, '').sub(/\s+$/, '').split(/\s+-\s+/) - description = :absent if description.include?("no description available") - new(:ensure => :present, :name => name, :description => description) + list_lists.split("\n").collect do |line| + name = line.strip + new(:ensure => :present, :name => name) end end -- cgit From f77764de3ace7cc880a77466618a5affe1b61a8e Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Tue, 30 Nov 2010 12:06:33 -0800 Subject: Maint: Modified tests of indirector.save to call the indirection directly. This change replaces calls to .save with calls to .indirection.save(). This makes the use of the indirector explicit rather than implicit so that it will be easier to search for all indirector call sites using grep. This is an intermediate refactor on the way towards allowing indirector calls to be explicitly routed to multiple termini. This patch affects tests only; the next patch will make the corresponding change to the code. --- spec/integration/node/facts_spec.rb | 2 +- spec/integration/node_spec.rb | 8 ++++---- spec/integration/ssl/certificate_request_spec.rb | 6 +++--- spec/integration/transaction/report_spec.rb | 2 +- spec/unit/application/kick_spec.rb | 2 +- spec/unit/application/queue_spec.rb | 4 ++-- spec/unit/configurer_spec.rb | 6 +++--- spec/unit/file_bucket/dipper_spec.rb | 21 +++++++++------------ spec/unit/file_bucket/file_spec.rb | 10 +++++----- spec/unit/indirector/catalog/compiler_spec.rb | 4 ++-- spec/unit/indirector_spec.rb | 23 ----------------------- spec/unit/network/http/handler_spec.rb | 3 ++- spec/unit/node/facts_spec.rb | 2 +- spec/unit/ssl/certificate_authority_spec.rb | 21 +++++++++++---------- spec/unit/ssl/certificate_request_spec.rb | 11 ++--------- spec/unit/ssl/certificate_revocation_list_spec.rb | 4 ++-- spec/unit/ssl/host_spec.rb | 21 +++++++++++++-------- spec/unit/transaction/report_spec.rb | 2 +- test/network/handler/master.rb | 14 +++++++++----- 19 files changed, 72 insertions(+), 94 deletions(-) diff --git a/spec/integration/node/facts_spec.rb b/spec/integration/node/facts_spec.rb index 047d9d461..a555b2044 100755 --- a/spec/integration/node/facts_spec.rb +++ b/spec/integration/node/facts_spec.rb @@ -19,7 +19,7 @@ describe Puppet::Node::Facts do Puppet::Node.indirection.expects(:expire).with("me") facts = Puppet::Node::Facts.new("me") - facts.save + Puppet::Node::Facts.indirection.save(facts) end it "should be able to delegate to the :yaml terminus" do diff --git a/spec/integration/node_spec.rb b/spec/integration/node_spec.rb index 0d46259dd..911a423a0 100755 --- a/spec/integration/node_spec.rb +++ b/spec/integration/node_spec.rb @@ -68,19 +68,19 @@ describe Puppet::Node do end it "should be able to find nodes that were previously saved" do - @node.save + Puppet::Node.indirection.save(@node) Puppet::Node.indirection.find(@name).should equal(@node) end it "should replace existing saved nodes when a new node with the same name is saved" do - @node.save + Puppet::Node.indirection.save(@node) two = Puppet::Node.new(@name) - two.save + Puppet::Node.indirection.save(two) Puppet::Node.indirection.find(@name).should equal(two) end it "should be able to remove previously saved nodes" do - @node.save + Puppet::Node.indirection.save(@node) Puppet::Node.indirection.destroy(@node.name) Puppet::Node.indirection.find(@name).should be_nil end diff --git a/spec/integration/ssl/certificate_request_spec.rb b/spec/integration/ssl/certificate_request_spec.rb index e04360548..d92346bb1 100755 --- a/spec/integration/ssl/certificate_request_spec.rb +++ b/spec/integration/ssl/certificate_request_spec.rb @@ -43,19 +43,19 @@ describe Puppet::SSL::CertificateRequest do end it "should be able to save CSRs" do - @csr.save + Puppet::SSL::CertificateRequest.indirection.save(@csr) end it "should be able to find saved certificate requests via the Indirector" do @csr.generate(@key) - @csr.save + Puppet::SSL::CertificateRequest.indirection.save(@csr) Puppet::SSL::CertificateRequest.indirection.find("luke.madstop.com").should be_instance_of(Puppet::SSL::CertificateRequest) end it "should save the completely CSR when saving" do @csr.generate(@key) - @csr.save + Puppet::SSL::CertificateRequest.indirection.save(@csr) Puppet::SSL::CertificateRequest.indirection.find("luke.madstop.com").content.to_s.should == @csr.content.to_s end diff --git a/spec/integration/transaction/report_spec.rb b/spec/integration/transaction/report_spec.rb index eed7acaa9..2afd037c7 100755 --- a/spec/integration/transaction/report_spec.rb +++ b/spec/integration/transaction/report_spec.rb @@ -23,7 +23,7 @@ describe Puppet::Transaction::Report do terminus.expects(:process).with(report) - report.save + Puppet::Transaction::Report.indirection.save(report) end end end diff --git a/spec/unit/application/kick_spec.rb b/spec/unit/application/kick_spec.rb index 3a7106338..5ccf81bd0 100755 --- a/spec/unit/application/kick_spec.rb +++ b/spec/unit/application/kick_spec.rb @@ -279,7 +279,7 @@ describe Puppet::Application::Kick do end it "should call run on a Puppet::Run for the given host" do - @agent_run.expects(:save).with('https://host:8139/production/run/host').returns(@agent_run) + Puppet::Run.indirection.expects(:save).with(@agent_run, 'https://host:8139/production/run/host').returns(@agent_run) @kick.run_for_host('host') end diff --git a/spec/unit/application/queue_spec.rb b/spec/unit/application/queue_spec.rb index 18fd8cea2..619f94e45 100755 --- a/spec/unit/application/queue_spec.rb +++ b/spec/unit/application/queue_spec.rb @@ -171,8 +171,8 @@ describe Puppet::Application::Queue do end it "should log and save each catalog passed by the queue" do - catalog = mock 'catalog', :name => 'eh' - catalog.expects(:save) + catalog = Puppet::Resource::Catalog.new('eh') + Puppet::Resource::Catalog.indirection.expects(:save).with(catalog, nil) Puppet::Resource::Catalog::Queue.expects(:subscribe).yields(catalog) Puppet.expects(:notice).times(2) diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index bb3a73994..0f65d1d5f 100755 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -236,7 +236,7 @@ describe Puppet::Configurer, "when sending a report" do @configurer = Puppet::Configurer.new @configurer.stubs(:save_last_run_summary) - @report = stub 'report' + @report = Puppet::Transaction::Report.new @trans = stub 'transaction' end @@ -272,7 +272,7 @@ describe Puppet::Configurer, "when sending a report" do it "should save the report if reporting is enabled" do Puppet.settings[:report] = true - @report.expects(:save) + Puppet::Transaction::Report.indirection.expects(:save).with(@report, nil) @configurer.send_report(@report) end @@ -300,7 +300,7 @@ describe Puppet::Configurer, "when sending a report" do it "should log but not fail if saving the report fails" do Puppet.settings[:report] = true - @report.expects(:save).raises "whatever" + Puppet::Transaction::Report.indirection.expects(:save).with(@report, nil).raises "whatever" Puppet.expects(:err) lambda { @configurer.send_report(@report) }.should_not raise_error diff --git a/spec/unit/file_bucket/dipper_spec.rb b/spec/unit/file_bucket/dipper_spec.rb index 4897dc1f8..46d314d1f 100755 --- a/spec/unit/file_bucket/dipper_spec.rb +++ b/spec/unit/file_bucket/dipper_spec.rb @@ -16,10 +16,9 @@ describe Puppet::FileBucket::Dipper do @dipper = Puppet::FileBucket::Dipper.new(:Path => "/my/bucket") - filemock = stub "bucketfile" - Puppet::FileBucket::File.stubs(:new).returns(filemock) - filemock.expects(:name).returns "name" - filemock.expects(:save).raises ArgumentError + Puppet::FileBucket::File.any_instance.stubs(:validate_checksum!) + file = Puppet::FileBucket::File.new(nil) + Puppet::FileBucket::File.indirection.expects(:save).raises ArgumentError lambda { @dipper.backup("/my/file") }.should raise_error(Puppet::Error) end @@ -32,10 +31,9 @@ describe Puppet::FileBucket::Dipper do File.stubs(:exist?).returns true File.stubs(:read).with("/my/file").returns "my contents" - bucketfile = stub "bucketfile" - bucketfile.stubs(:name).returns('md5/DIGEST123') - bucketfile.stubs(:checksum_data).returns("DIGEST123") - bucketfile.expects(:save).with('md5/DIGEST123') + Puppet::FileBucket::File.any_instance.stubs(:validate_checksum!) + bucketfile = Puppet::FileBucket::File.new(nil, :checksum_type => "md5", :checksum => "{md5}DIGEST123") + Puppet::FileBucket::File.indirection.expects(:save).with(bucketfile, 'md5/DIGEST123') Puppet::FileBucket::File.stubs(:new).with( @@ -79,10 +77,9 @@ describe Puppet::FileBucket::Dipper do File.stubs(:exist?).returns true File.stubs(:read).with("/my/file").returns "my contents" - bucketfile = stub "bucketfile" - bucketfile.stubs(:name).returns('md5/DIGEST123') - bucketfile.stubs(:checksum_data).returns("DIGEST123") - bucketfile.expects(:save).with('https://puppetmaster:31337/production/file_bucket_file/md5/DIGEST123') + Puppet::FileBucket::File.any_instance.stubs(:validate_checksum!) + bucketfile = Puppet::FileBucket::File.new(nil, :checksum_type => "md5", :checksum => "{md5}DIGEST123") + Puppet::FileBucket::File.indirection.expects(:save).with(bucketfile, 'https://puppetmaster:31337/production/file_bucket_file/md5/DIGEST123') Puppet::FileBucket::File.stubs(:new).with( diff --git a/spec/unit/file_bucket/file_spec.rb b/spec/unit/file_bucket/file_spec.rb index 42ed94253..b9849b0fc 100644 --- a/spec/unit/file_bucket/file_spec.rb +++ b/spec/unit/file_bucket/file_spec.rb @@ -95,7 +95,7 @@ describe Puppet::FileBucket::File do end it "should have a :save instance method" do - Puppet::FileBucket::File.new("mysum").should respond_to(:save) + Puppet::FileBucket::File.indirection.should respond_to(:save) end end @@ -108,7 +108,7 @@ describe Puppet::FileBucket::File do mockfile.expects(:print).with(@contents) ::File.expects(:open).with("#{@dir}/contents", ::File::WRONLY|::File::CREAT, 0440).yields(mockfile) - Puppet::FileBucket::File.new(@contents).save + Puppet::FileBucket::File.indirection.save(Puppet::FileBucket::File.new(@contents)) end it "should make any directories necessary for storage" do @@ -119,7 +119,7 @@ describe Puppet::FileBucket::File do ::File.expects(:open).with("#{@dir}/contents", ::File::WRONLY|::File::CREAT, 0440) ::File.expects(:exist?).with("#{@dir}/contents").returns false - Puppet::FileBucket::File.new(@contents).save + Puppet::FileBucket::File.indirection.save(Puppet::FileBucket::File.new(@contents)) end it "should append the path to the paths file" do @@ -133,7 +133,7 @@ describe Puppet::FileBucket::File do mockfile.expects(:puts).with('/path/on/the/remote/box') ::File.expects(:exist?).with("#{@dir}/paths").returns false ::File.expects(:open).with("#{@dir}/paths", ::File::WRONLY|::File::CREAT|::File::APPEND).yields mockfile - Puppet::FileBucket::File.new(@contents, :path => remote_path).save + Puppet::FileBucket::File.indirection.save(Puppet::FileBucket::File.new(@contents, :path => remote_path)) end end @@ -179,7 +179,7 @@ describe Puppet::FileBucket::File do ::File.expects(:open).with("#{@dir}/contents", ::File::WRONLY|::File::CREAT, 0440) bucketfile = Puppet::FileBucket::File.new(@contents) - bucketfile.save + Puppet::FileBucket::File.indirection.save(bucketfile) end diff --git a/spec/unit/indirector/catalog/compiler_spec.rb b/spec/unit/indirector/catalog/compiler_spec.rb index 264af2635..c58fbbd50 100755 --- a/spec/unit/indirector/catalog/compiler_spec.rb +++ b/spec/unit/indirector/catalog/compiler_spec.rb @@ -158,7 +158,7 @@ describe Puppet::Resource::Catalog::Compiler do @request = stub 'request', :options => {} @facts = Puppet::Node::Facts.new('hostname', "fact" => "value", "architecture" => "i386") - @facts.stubs(:save).returns(nil) + Puppet::Node::Facts.indirection.stubs(:save).returns(nil) end it "should do nothing if no facts are provided" do @@ -194,7 +194,7 @@ describe Puppet::Resource::Catalog::Compiler do @request.options[:facts] = "bar" Puppet::Node::Facts.expects(:convert_from).returns @facts - @facts.expects(:save) + Puppet::Node::Facts.indirection.expects(:save).with(@facts, nil) @compiler.extract_facts_from_request(@request) end diff --git a/spec/unit/indirector_spec.rb b/spec/unit/indirector_spec.rb index 119a52eec..7c193a9aa 100755 --- a/spec/unit/indirector_spec.rb +++ b/spec/unit/indirector_spec.rb @@ -80,29 +80,6 @@ describe Puppet::Indirector, "when redirecting a model" do @thingie.ancestors.should be_include(Puppet::Indirector::Envelope) end - # This is an instance method, so it behaves a bit differently. - describe "when saving instances via the model" do - before do - @instance = @thingie.new("me") - end - - it "should delegate to the indirection" do - @indirection.expects(:save) - @instance.save - end - - it "should pass the instance and an optional key to the indirection's :save method" do - @indirection.expects(:save).with(@instance, "key") - @instance.save "key" - end - - it "should return the results of the delegation as its result" do - request = mock 'request' - @indirection.expects(:save).returns "yay" - @instance.save.should == "yay" - end - end - after do @indirection.delete end diff --git a/spec/unit/network/http/handler_spec.rb b/spec/unit/network/http/handler_spec.rb index 9dddc9962..8f9388aaf 100755 --- a/spec/unit/network/http/handler_spec.rb +++ b/spec/unit/network/http/handler_spec.rb @@ -352,8 +352,9 @@ describe Puppet::Network::HTTP::Handler do @result = stub 'result', :render => "the result" - @model_instance = stub('indirected model instance', :save => true) + @model_instance = stub('indirected model instance') @model_class.stubs(:convert_from).returns(@model_instance) + @model_instance.stubs(:save) @format = stub 'format', :suitable? => true, :name => "format", :mime => "text/format" Puppet::Network::FormatHandler.stubs(:format).returns @format diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb index 7873b415d..de2cd554f 100755 --- a/spec/unit/node/facts_spec.rb +++ b/spec/unit/node/facts_spec.rb @@ -79,7 +79,7 @@ describe Puppet::Node::Facts, "when indirecting" do it "should redirect to the specified fact store for storage" do Puppet::Node::Facts.stubs(:indirection).returns(@indirection) @indirection.expects(:save) - @facts.save + Puppet::Node::Facts.indirection.save(@facts) end describe "when the Puppet application is 'master'" do diff --git a/spec/unit/ssl/certificate_authority_spec.rb b/spec/unit/ssl/certificate_authority_spec.rb index 2219aa99d..a350c0fe3 100755 --- a/spec/unit/ssl/certificate_authority_spec.rb +++ b/spec/unit/ssl/certificate_authority_spec.rb @@ -143,13 +143,13 @@ describe Puppet::SSL::CertificateAuthority do end it "should create, generate, and save a new CRL instance of no CRL can be found" do - crl = mock 'crl' + crl = Puppet::SSL::CertificateRevocationList.new("fakename") Puppet::SSL::CertificateRevocationList.indirection.expects(:find).returns nil Puppet::SSL::CertificateRevocationList.expects(:new).returns crl crl.expects(:generate).with(@ca.host.certificate.content, @ca.host.key.content) - crl.expects(:save) + Puppet::SSL::CertificateRevocationList.indirection.expects(:save).with(crl, nil) @ca.crl.should equal(crl) end @@ -235,12 +235,13 @@ describe Puppet::SSL::CertificateAuthority do @name = "myhost" @real_cert = stub 'realcert', :sign => nil - @cert = stub 'certificate', :content => @real_cert + @cert = Puppet::SSL::Certificate.new(@name) + @cert.content = @real_cert Puppet::SSL::Certificate.stubs(:new).returns @cert @cert.stubs(:content=) - @cert.stubs(:save) + Puppet::SSL::Certificate.indirection.stubs(:save) # Stub out the factory @factory = stub 'factory', :result => "my real cert" @@ -329,7 +330,7 @@ describe Puppet::SSL::CertificateAuthority do end it "should save the resulting certificate" do - @cert.expects(:save) + Puppet::SSL::Certificate.indirection.expects(:save).with(@cert, nil) @ca.sign(@name, :ca, @request) end @@ -341,7 +342,7 @@ describe Puppet::SSL::CertificateAuthority do @ca.stubs(:next_serial).returns @serial Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request - @cert.stubs :save + Puppet::SSL::CertificateRequest.indirection.stubs :save end it "should use a certificate type of :server" do @@ -390,7 +391,7 @@ describe Puppet::SSL::CertificateAuthority do end it "should save the resulting certificate" do - @cert.expects(:save) + Puppet::SSL::Certificate.indirection.stubs(:save).with(@cert) @ca.sign(@name) end @@ -406,7 +407,7 @@ describe Puppet::SSL::CertificateAuthority do @ca.stubs(:next_serial).returns @serial Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request - @cert.stubs :save + Puppet::SSL::Certificate.indirection.stubs :save Puppet::SSL::Certificate.expects(:new).with(@name).returns @cert @ca.sign(@name) @@ -415,7 +416,7 @@ describe Puppet::SSL::CertificateAuthority do it "should return the certificate instance" do @ca.stubs(:next_serial).returns @serial Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request - @cert.stubs :save + Puppet::SSL::Certificate.indirection.stubs :save @ca.sign(@name).should equal(@cert) end @@ -424,7 +425,7 @@ describe Puppet::SSL::CertificateAuthority do @inventory.expects(:add).with(@cert) Puppet::SSL::CertificateRequest.indirection.stubs(:find).with(@name).returns @request - @cert.stubs :save + Puppet::SSL::Certificate.indirection.stubs :save @ca.sign(@name) end diff --git a/spec/unit/ssl/certificate_request_spec.rb b/spec/unit/ssl/certificate_request_spec.rb index 25b77b332..fb4b5a134 100755 --- a/spec/unit/ssl/certificate_request_spec.rb +++ b/spec/unit/ssl/certificate_request_spec.rb @@ -187,13 +187,6 @@ describe Puppet::SSL::CertificateRequest do end describe "when a CSR is saved" do - it "should allow arguments" do - csr = Puppet::SSL::CertificateRequest.new("me") - csr.class.indirection.stubs(:save) - - lambda { csr.save :ipaddress => "foo" }.should_not raise_error - end - describe "and a CA is available" do it "should save the CSR and trigger autosigning" do ca = mock 'ca', :autosign @@ -204,7 +197,7 @@ describe Puppet::SSL::CertificateRequest do Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus) terminus.expects(:save).with { |request| puts request.key.inspect; request.instance == csr && request.key == "me" } - csr.save + Puppet::SSL::CertificateRequest.indirection.save(csr) end end @@ -217,7 +210,7 @@ describe Puppet::SSL::CertificateRequest do Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus) terminus.expects(:save).with { |request| puts request.key.inspect; request.instance == csr && request.key == "me" } - csr.save + Puppet::SSL::CertificateRequest.indirection.save(csr) end end end diff --git a/spec/unit/ssl/certificate_revocation_list_spec.rb b/spec/unit/ssl/certificate_revocation_list_spec.rb index f9993d52e..3bf12fa0a 100755 --- a/spec/unit/ssl/certificate_revocation_list_spec.rb +++ b/spec/unit/ssl/certificate_revocation_list_spec.rb @@ -119,7 +119,7 @@ describe Puppet::SSL::CertificateRevocationList do @crl.generate(@cert, @key) @crl.content.stubs(:sign) - @crl.stubs :save + Puppet::SSL::CertificateRevocationList.indirection.stubs :save @key = mock 'key' end @@ -161,7 +161,7 @@ describe Puppet::SSL::CertificateRevocationList do end it "should save the CRL" do - @crl.expects :save + Puppet::SSL::CertificateRevocationList.indirection.expects(:save).with(@crl, nil) @crl.revoke(1, @key) end end diff --git a/spec/unit/ssl/host_spec.rb b/spec/unit/ssl/host_spec.rb index 3b7ed18e1..05239431c 100755 --- a/spec/unit/ssl/host_spec.rb +++ b/spec/unit/ssl/host_spec.rb @@ -301,7 +301,8 @@ describe Puppet::SSL::Host do describe "when managing its private key" do before do @realkey = "mykey" - @key = stub 'key', :content => @realkey + @key = Puppet::SSL::Key.new("mykey") + @key.content = @realkey end it "should return nil if the key is not set and cannot be found" do @@ -318,7 +319,7 @@ describe Puppet::SSL::Host do Puppet::SSL::Key.expects(:new).with("myname").returns(@key) @key.expects(:generate) - @key.expects(:save) + Puppet::SSL::Key.indirection.expects(:save) @host.generate_key.should be_true @host.key.should equal(@key) @@ -328,7 +329,7 @@ describe Puppet::SSL::Host do Puppet::SSL::Key.expects(:new).with("myname").returns(@key) @key.stubs(:generate) - @key.expects(:save).raises "eh" + Puppet::SSL::Key.indirection.expects(:save).raises "eh" lambda { @host.generate_key }.should raise_error @host.key.should be_nil @@ -344,7 +345,8 @@ describe Puppet::SSL::Host do describe "when managing its certificate request" do before do @realrequest = "real request" - @request = stub 'request', :content => @realrequest + @request = Puppet::SSL::CertificateRequest.new("myname") + @request.content = @realrequest end it "should return nil if the key is not set and cannot be found" do @@ -367,7 +369,7 @@ describe Puppet::SSL::Host do @host.expects(:generate_key).returns(key) @request.stubs(:generate) - @request.stubs(:save) + Puppet::SSL::CertificateRequest.indirection.stubs(:save) @host.generate_certificate_request end @@ -378,7 +380,7 @@ describe Puppet::SSL::Host do key = stub 'key', :public_key => mock("public_key"), :content => "mycontent" @host.stubs(:key).returns(key) @request.expects(:generate).with("mycontent") - @request.expects(:save) + Puppet::SSL::CertificateRequest.indirection.expects(:save).with(@request, nil) @host.generate_certificate_request.should be_true @host.certificate_request.should equal(@request) @@ -397,11 +399,14 @@ describe Puppet::SSL::Host do key = stub 'key', :public_key => mock("public_key"), :content => "mycontent" @host.stubs(:key).returns(key) @request.stubs(:generate) - @request.expects(:save).raises "eh" + @request.stubs(:name).returns("myname") + terminus = stub 'terminus' + Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus) + terminus.expects(:save).with { |req| req.instance == @request && req.key == "myname" }.raises "eh" lambda { @host.generate_certificate_request }.should raise_error - @host.certificate_request.should be_nil + @host.instance_eval { @certificate_request }.should be_nil end end diff --git a/spec/unit/transaction/report_spec.rb b/spec/unit/transaction/report_spec.rb index 4dd104c74..1f1fdb080 100755 --- a/spec/unit/transaction/report_spec.rb +++ b/spec/unit/transaction/report_spec.rb @@ -59,7 +59,7 @@ describe Puppet::Transaction::Report do Puppet::Transaction::Report.stubs(:indirection).returns(@indirection) report = Puppet::Transaction::Report.new @indirection.expects(:save) - report.save + Puppet::Transaction::Report.indirection.save(report) end it "should default to the 'processor' terminus" do diff --git a/test/network/handler/master.rb b/test/network/handler/master.rb index 018f6904b..56d1991d5 100755 --- a/test/network/handler/master.rb +++ b/test/network/handler/master.rb @@ -32,15 +32,17 @@ class TestMaster < Test::Unit::TestCase def test_hostname_is_used_if_client_is_missing @master.expects(:decode_facts).returns("hostname" => "yay") - Puppet::Node::Facts.expects(:new).with { |name, facts| name == "yay" }.returns(stub('facts', :save => nil)) + facts = Puppet::Node::Facts.new("the_facts") + Puppet::Node::Facts.indirection.stubs(:save).with(facts, nil) + Puppet::Node::Facts.expects(:new).with { |name, facts| name == "yay" }.returns(facts) @master.getconfig("facts") end def test_facts_are_saved - facts = mock('facts') + facts = Puppet::Node::Facts.new("the_facts") Puppet::Node::Facts.expects(:new).returns(facts) - facts.expects(:save) + Puppet::Node::Facts.indirection.expects(:save).with(facts, nil) @master.stubs(:decode_facts) @@ -48,7 +50,8 @@ class TestMaster < Test::Unit::TestCase end def test_catalog_is_used_for_compiling - facts = stub('facts', :save => nil) + facts = Puppet::Node::Facts.new("the_facts") + Puppet::Node::Facts.indirection.stubs(:save).with(facts, nil) Puppet::Node::Facts.stubs(:new).returns(facts) @master.stubs(:decode_facts) @@ -61,8 +64,9 @@ end class TestMasterFormats < Test::Unit::TestCase def setup - @facts = stub('facts', :save => nil) + @facts = Puppet::Node::Facts.new("the_facts") Puppet::Node::Facts.stubs(:new).returns(@facts) + Puppet::Node::Facts.indirection.stubs(:save) @master = Puppet::Network::Handler.master.new(:Code => "") @master.stubs(:decode_facts) -- cgit From 0747b58bfef9c6bb5f1f9ac1eb6a7b3955dac2af Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Tue, 30 Nov 2010 12:06:52 -0800 Subject: Maint: Modified uses of indirector.save to call the indirection directly. This change replaces calls to .save with calls to .indirection.save(). This makes the use of the indirector explicit rather than implicit so that it will be easier to search for all indirector call sites using grep. This is an intermediate refactor on the way towards allowing indirector calls to be explicitly routed to multiple termini. This patch affects production code. --- lib/puppet/application/kick.rb | 2 +- lib/puppet/application/queue.rb | 4 ++-- lib/puppet/application/resource.rb | 2 +- lib/puppet/configurer.rb | 2 +- lib/puppet/file_bucket/dipper.rb | 2 +- lib/puppet/indirector.rb | 7 ------- lib/puppet/indirector/catalog/compiler.rb | 2 +- lib/puppet/network/handler/filebucket.rb | 2 +- lib/puppet/network/handler/master.rb | 2 +- lib/puppet/network/http/handler.rb | 2 +- lib/puppet/ssl/certificate_authority.rb | 4 ++-- lib/puppet/ssl/certificate_revocation_list.rb | 2 +- lib/puppet/ssl/host.rb | 4 ++-- lib/puppet/transaction.rb | 2 +- spec/unit/application/queue_spec.rb | 2 +- spec/unit/application/resource_spec.rb | 4 ++-- spec/unit/configurer_spec.rb | 4 ++-- spec/unit/indirector/catalog/compiler_spec.rb | 2 +- spec/unit/network/http/handler_spec.rb | 6 +++--- spec/unit/ssl/certificate_authority_spec.rb | 4 ++-- spec/unit/ssl/host_spec.rb | 2 +- test/network/handler/master.rb | 6 +++--- 22 files changed, 31 insertions(+), 38 deletions(-) diff --git a/lib/puppet/application/kick.rb b/lib/puppet/application/kick.rb index c6c6fd782..12dad653a 100644 --- a/lib/puppet/application/kick.rb +++ b/lib/puppet/application/kick.rb @@ -120,7 +120,7 @@ class Puppet::Application::Kick < Puppet::Application :background => ! options[:foreground], :ignoreschedules => options[:ignoreschedules] } - run = Puppet::Run.new( run_options ).save( url ) + run = Puppet::Run.indirection.save(Puppet::Run.new( run_options ), url) puts "Getting status" result = run.status puts "status is #{result}" diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb index c7e0ce8cc..b9e8ca4ca 100644 --- a/lib/puppet/application/queue.rb +++ b/lib/puppet/application/queue.rb @@ -41,12 +41,12 @@ class Puppet::Application::Queue < Puppet::Application require 'puppet/indirector/catalog/queue' # provides Puppet::Indirector::Queue.subscribe 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, passing it to save 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 begin - catalog.save + Puppet::Resource::Catalog.indirection.save(catalog) rescue => detail puts detail.backtrace if Puppet[:trace] Puppet.err "Could not save queued catalog for #{catalog.name}: #{detail}" diff --git a/lib/puppet/application/resource.rb b/lib/puppet/application/resource.rb index 3a7fdcc37..c7c1c28be 100644 --- a/lib/puppet/application/resource.rb +++ b/lib/puppet/application/resource.rb @@ -78,7 +78,7 @@ class Puppet::Application::Resource < Puppet::Application if params.empty? [ Puppet::Resource.indirection.find( key ) ] else - [ Puppet::Resource.new( type, name, :parameters => params ).save( key ) ] + [ Puppet::Resource.indirection.save(Puppet::Resource.new( type, name, :parameters => params ), key) ] end else Puppet::Resource.indirection.search( key, {} ) diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index 77a9065df..50aaa0d1f 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -176,7 +176,7 @@ class Puppet::Configurer puts report.summary if Puppet[:summarize] save_last_run_summary(report) if Puppet[:report] - report.save + Puppet::Transaction::Report.indirection.save(report) end rescue => detail puts detail.backtrace if Puppet[:trace] diff --git a/lib/puppet/file_bucket/dipper.rb b/lib/puppet/file_bucket/dipper.rb index 8d6938930..367d6bfbd 100644 --- a/lib/puppet/file_bucket/dipper.rb +++ b/lib/puppet/file_bucket/dipper.rb @@ -36,7 +36,7 @@ class Puppet::FileBucket::Dipper file_bucket_file = Puppet::FileBucket::File.new(contents, :bucket_path => @local_path, :path => absolutize_path(file) ) dest_path = "#{@rest_path}#{file_bucket_file.name}" - file_bucket_file.save(dest_path) + Puppet::FileBucket::File.indirection.save(file_bucket_file, dest_path) return file_bucket_file.checksum_data rescue => detail puts detail.backtrace if Puppet[:trace] diff --git a/lib/puppet/indirector.rb b/lib/puppet/indirector.rb index d3455c014..9effc5cdd 100644 --- a/lib/puppet/indirector.rb +++ b/lib/puppet/indirector.rb @@ -21,7 +21,6 @@ module Puppet::Indirector raise(ArgumentError, "Already handling indirection for #{@indirection.name}; cannot also handle #{indirection}") if @indirection # populate this class with the various new methods extend ClassMethods - include InstanceMethods include Puppet::Indirector::Envelope extend Puppet::Network::FormatHandler @@ -33,10 +32,4 @@ module Puppet::Indirector module ClassMethods attr_reader :indirection end - - module InstanceMethods - def save(key = nil) - self.class.indirection.save self, key - end - end end diff --git a/lib/puppet/indirector/catalog/compiler.rb b/lib/puppet/indirector/catalog/compiler.rb index b80143a4d..f4c40812d 100644 --- a/lib/puppet/indirector/catalog/compiler.rb +++ b/lib/puppet/indirector/catalog/compiler.rb @@ -23,7 +23,7 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code facts = Puppet::Node::Facts.convert_from(format, text_facts) end facts.add_timestamp - facts.save + Puppet::Node::Facts.indirection.save(facts) end # Compile a node's catalog. diff --git a/lib/puppet/network/handler/filebucket.rb b/lib/puppet/network/handler/filebucket.rb index ee10dbddb..55028ee64 100755 --- a/lib/puppet/network/handler/filebucket.rb +++ b/lib/puppet/network/handler/filebucket.rb @@ -28,7 +28,7 @@ class Puppet::Network::Handler # :nodoc: def addfile(contents, path, client = nil, clientip = nil) contents = Base64.decode64(contents) if client bucket = Puppet::FileBucket::File.new(contents) - bucket.save + Puppet::FileBucket::File.indirection.save(bucket) end # Return the contents associated with a given md5 sum. diff --git a/lib/puppet/network/handler/master.rb b/lib/puppet/network/handler/master.rb index 5b9dd332a..62aab539e 100644 --- a/lib/puppet/network/handler/master.rb +++ b/lib/puppet/network/handler/master.rb @@ -47,7 +47,7 @@ class Puppet::Network::Handler client ||= facts["hostname"] # Pass the facts to the fact handler - Puppet::Node::Facts.new(client, facts).save unless local? + Puppet::Node::Facts.indirection.save(Puppet::Node::Facts.new(client, facts)) unless local? catalog = Puppet::Resource::Catalog.indirection.find(client) diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb index fbd7d195f..916f02c8d 100644 --- a/lib/puppet/network/http/handler.rb +++ b/lib/puppet/network/http/handler.rb @@ -146,7 +146,7 @@ module Puppet::Network::HTTP::Handler format = request_format(request) obj = model(indirection_name).convert_from(format, data) - result = obj.save(key) + result = model(indirection_name).indirection.save(obj, key) return_yaml_response(response, result) end diff --git a/lib/puppet/ssl/certificate_authority.rb b/lib/puppet/ssl/certificate_authority.rb index 5725be4d5..d65067c70 100644 --- a/lib/puppet/ssl/certificate_authority.rb +++ b/lib/puppet/ssl/certificate_authority.rb @@ -96,7 +96,7 @@ class Puppet::SSL::CertificateAuthority unless @crl = Puppet::SSL::CertificateRevocationList.indirection.find(Puppet::SSL::CA_NAME) @crl = Puppet::SSL::CertificateRevocationList.new(Puppet::SSL::CA_NAME) @crl.generate(host.certificate.content, host.key.content) - @crl.save + Puppet::SSL::CertificateRevocationList.indirection.save(@crl) end end @crl @@ -248,7 +248,7 @@ class Puppet::SSL::CertificateAuthority # Save the now-signed cert. This should get routed correctly depending # on the certificate type. - cert.save + Puppet::SSL::Certificate.indirection.save(cert) # And remove the CSR if this wasn't self signed. Puppet::SSL::CertificateRequest.indirection.destroy(csr.name) unless self_signing_csr diff --git a/lib/puppet/ssl/certificate_revocation_list.rb b/lib/puppet/ssl/certificate_revocation_list.rb index 44e0a9e22..293f4b8c0 100644 --- a/lib/puppet/ssl/certificate_revocation_list.rb +++ b/lib/puppet/ssl/certificate_revocation_list.rb @@ -79,6 +79,6 @@ class Puppet::SSL::CertificateRevocationList < Puppet::SSL::Base @content.sign(cakey, OpenSSL::Digest::SHA1.new) - save + Puppet::SSL::CertificateRevocationList.indirection.save(self) end end diff --git a/lib/puppet/ssl/host.rb b/lib/puppet/ssl/host.rb index 6539b057e..7f71ced99 100644 --- a/lib/puppet/ssl/host.rb +++ b/lib/puppet/ssl/host.rb @@ -126,7 +126,7 @@ class Puppet::SSL::Host @key = Key.new(name) @key.generate begin - @key.save + Key.indirection.save(@key) rescue @key = nil raise @@ -144,7 +144,7 @@ class Puppet::SSL::Host @certificate_request = CertificateRequest.new(name) @certificate_request.generate(key.content) begin - @certificate_request.save + CertificateRequest.indirection.save(@certificate_request) rescue @certificate_request = nil raise diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index dcd9aad0a..4c0ea9ac5 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -298,7 +298,7 @@ class Puppet::Transaction if Puppet[:report] begin - report.save + Puppet::Transaction::Report.indirection.save(report) rescue => detail Puppet.err "Reporting failed: #{detail}" end diff --git a/spec/unit/application/queue_spec.rb b/spec/unit/application/queue_spec.rb index 619f94e45..1c65b558c 100755 --- a/spec/unit/application/queue_spec.rb +++ b/spec/unit/application/queue_spec.rb @@ -172,7 +172,7 @@ describe Puppet::Application::Queue do it "should log and save each catalog passed by the queue" do catalog = Puppet::Resource::Catalog.new('eh') - Puppet::Resource::Catalog.indirection.expects(:save).with(catalog, nil) + Puppet::Resource::Catalog.indirection.expects(:save).with(catalog) Puppet::Resource::Catalog::Queue.expects(:subscribe).yields(catalog) Puppet.expects(:notice).times(2) diff --git a/spec/unit/application/resource_spec.rb b/spec/unit/application/resource_spec.rb index 6ab99945c..df479ac89 100755 --- a/spec/unit/application/resource_spec.rb +++ b/spec/unit/application/resource_spec.rb @@ -184,7 +184,7 @@ describe Puppet::Application::Resource do @resource.command_line.stubs(:args).returns(['type','name','param=temp']) res = stub "resource" - res.expects(:save).with('https://host:8139/production/resources/type/name').returns(res) + Puppet::Resource.indirection.expects(:save).with(res, 'https://host:8139/production/resources/type/name').returns(res) res.expects(:collect) res.expects(:to_manifest) Puppet::Resource.expects(:new).with('type', 'name', :parameters => {'param' => 'temp'}).returns(res) @@ -220,7 +220,7 @@ describe Puppet::Application::Resource do @resource.command_line.stubs(:args).returns(['type','name','param=temp']) res = stub "resource" - res.expects(:save).with('type/name').returns(res) + Puppet::Resource.indirection.expects(:save).with(res, 'type/name').returns(res) res.expects(:collect) res.expects(:to_manifest) Puppet::Resource.expects(:new).with('type', 'name', :parameters => {'param' => 'temp'}).returns(res) diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index 0f65d1d5f..fc718fa58 100755 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -272,7 +272,7 @@ describe Puppet::Configurer, "when sending a report" do it "should save the report if reporting is enabled" do Puppet.settings[:report] = true - Puppet::Transaction::Report.indirection.expects(:save).with(@report, nil) + Puppet::Transaction::Report.indirection.expects(:save).with(@report) @configurer.send_report(@report) end @@ -300,7 +300,7 @@ describe Puppet::Configurer, "when sending a report" do it "should log but not fail if saving the report fails" do Puppet.settings[:report] = true - Puppet::Transaction::Report.indirection.expects(:save).with(@report, nil).raises "whatever" + Puppet::Transaction::Report.indirection.expects(:save).with(@report).raises "whatever" Puppet.expects(:err) lambda { @configurer.send_report(@report) }.should_not raise_error diff --git a/spec/unit/indirector/catalog/compiler_spec.rb b/spec/unit/indirector/catalog/compiler_spec.rb index c58fbbd50..c8c53aecc 100755 --- a/spec/unit/indirector/catalog/compiler_spec.rb +++ b/spec/unit/indirector/catalog/compiler_spec.rb @@ -194,7 +194,7 @@ describe Puppet::Resource::Catalog::Compiler do @request.options[:facts] = "bar" Puppet::Node::Facts.expects(:convert_from).returns @facts - Puppet::Node::Facts.indirection.expects(:save).with(@facts, nil) + Puppet::Node::Facts.indirection.expects(:save).with(@facts) @compiler.extract_facts_from_request(@request) end diff --git a/spec/unit/network/http/handler_spec.rb b/spec/unit/network/http/handler_spec.rb index 8f9388aaf..e14b5739d 100755 --- a/spec/unit/network/http/handler_spec.rb +++ b/spec/unit/network/http/handler_spec.rb @@ -354,7 +354,7 @@ describe Puppet::Network::HTTP::Handler do @model_instance = stub('indirected model instance') @model_class.stubs(:convert_from).returns(@model_instance) - @model_instance.stubs(:save) + @indirection.stubs(:save) @format = stub 'format', :suitable? => true, :name => "format", :mime => "text/format" Puppet::Network::FormatHandler.stubs(:format).returns @format @@ -380,7 +380,7 @@ describe Puppet::Network::HTTP::Handler do end it "should use a common method for determining the request parameters" do - @model_instance.expects(:save).with('key').once + @indirection.expects(:save).with(@model_instance, 'key').once @handler.do_save("my_handler", "key", {}, @request, @response) end @@ -390,7 +390,7 @@ describe Puppet::Network::HTTP::Handler do end it "should return the yaml-serialized result when a model save call succeeds" do - @model_instance.stubs(:save).returns(@model_instance) + @indirection.stubs(:save).returns(@model_instance) @model_instance.expects(:to_yaml).returns('foo') @handler.do_save("my_handler", "my_result", {}, @request, @response) end diff --git a/spec/unit/ssl/certificate_authority_spec.rb b/spec/unit/ssl/certificate_authority_spec.rb index a350c0fe3..7198e33ad 100755 --- a/spec/unit/ssl/certificate_authority_spec.rb +++ b/spec/unit/ssl/certificate_authority_spec.rb @@ -149,7 +149,7 @@ describe Puppet::SSL::CertificateAuthority do Puppet::SSL::CertificateRevocationList.expects(:new).returns crl crl.expects(:generate).with(@ca.host.certificate.content, @ca.host.key.content) - Puppet::SSL::CertificateRevocationList.indirection.expects(:save).with(crl, nil) + Puppet::SSL::CertificateRevocationList.indirection.expects(:save).with(crl) @ca.crl.should equal(crl) end @@ -330,7 +330,7 @@ describe Puppet::SSL::CertificateAuthority do end it "should save the resulting certificate" do - Puppet::SSL::Certificate.indirection.expects(:save).with(@cert, nil) + Puppet::SSL::Certificate.indirection.expects(:save).with(@cert) @ca.sign(@name, :ca, @request) end diff --git a/spec/unit/ssl/host_spec.rb b/spec/unit/ssl/host_spec.rb index 05239431c..77911091e 100755 --- a/spec/unit/ssl/host_spec.rb +++ b/spec/unit/ssl/host_spec.rb @@ -380,7 +380,7 @@ describe Puppet::SSL::Host do key = stub 'key', :public_key => mock("public_key"), :content => "mycontent" @host.stubs(:key).returns(key) @request.expects(:generate).with("mycontent") - Puppet::SSL::CertificateRequest.indirection.expects(:save).with(@request, nil) + Puppet::SSL::CertificateRequest.indirection.expects(:save).with(@request) @host.generate_certificate_request.should be_true @host.certificate_request.should equal(@request) diff --git a/test/network/handler/master.rb b/test/network/handler/master.rb index 56d1991d5..f4bad7037 100755 --- a/test/network/handler/master.rb +++ b/test/network/handler/master.rb @@ -33,7 +33,7 @@ class TestMaster < Test::Unit::TestCase def test_hostname_is_used_if_client_is_missing @master.expects(:decode_facts).returns("hostname" => "yay") facts = Puppet::Node::Facts.new("the_facts") - Puppet::Node::Facts.indirection.stubs(:save).with(facts, nil) + Puppet::Node::Facts.indirection.stubs(:save).with(facts) Puppet::Node::Facts.expects(:new).with { |name, facts| name == "yay" }.returns(facts) @master.getconfig("facts") @@ -42,7 +42,7 @@ class TestMaster < Test::Unit::TestCase def test_facts_are_saved facts = Puppet::Node::Facts.new("the_facts") Puppet::Node::Facts.expects(:new).returns(facts) - Puppet::Node::Facts.indirection.expects(:save).with(facts, nil) + Puppet::Node::Facts.indirection.expects(:save).with(facts) @master.stubs(:decode_facts) @@ -51,7 +51,7 @@ class TestMaster < Test::Unit::TestCase def test_catalog_is_used_for_compiling facts = Puppet::Node::Facts.new("the_facts") - Puppet::Node::Facts.indirection.stubs(:save).with(facts, nil) + Puppet::Node::Facts.indirection.stubs(:save).with(facts) Puppet::Node::Facts.stubs(:new).returns(facts) @master.stubs(:decode_facts) -- cgit From 0ab5e0f779d7261c4a9faf890cef8df52726a82a Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Sun, 21 Nov 2010 20:52:49 +0100 Subject: (#2495) Better value validation for sshkey As mentioned in the ticket it is not obvious that aliases do not belong in the resourcename but have to be specified with the property "host_aliases". On the puppet-user list I saw someone using this as a resource @@sshkey {"$fqdn,$hostname,$ipaddress": type => rsa, key => $sshrsakey, } Puppet will now write a correct entry to the know_hosts file, but when it rereads the file, the field $fqdn,$hostname,$ipaddress is split into name ($fqdn) and host_aliases ([$hostname,$ipaddress]). Since we dont find the resource the user specified, puppet will put the same key in the file over and over again. This patch adds a simple validation on resourcename. --- lib/puppet/type/sshkey.rb | 7 ++++- spec/unit/type/sshkey_spec.rb | 71 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 spec/unit/type/sshkey_spec.rb diff --git a/lib/puppet/type/sshkey.rb b/lib/puppet/type/sshkey.rb index b7a1b8a8d..59a1a12f8 100755 --- a/lib/puppet/type/sshkey.rb +++ b/lib/puppet/type/sshkey.rb @@ -41,7 +41,7 @@ module Puppet raise Puppet::Error, "Aliases cannot include whitespace" end if value =~ /,/ - raise Puppet::Error, "Aliases cannot include whitespace" + raise Puppet::Error, "Aliases must be provided as an array, not a comma-separated list" end end end @@ -50,6 +50,11 @@ module Puppet desc "The host name that the key is associated with." isnamevar + + validate do |value| + raise Puppet::Error, "Resourcename cannot include whitespaces" if value =~ /\s/ + raise Puppet::Error, "No comma in resourcename allowed. If you want to specify aliases use the host_aliases property" if value.include?(',') + end end newproperty(:target) do diff --git a/spec/unit/type/sshkey_spec.rb b/spec/unit/type/sshkey_spec.rb new file mode 100644 index 000000000..966ca7099 --- /dev/null +++ b/spec/unit/type/sshkey_spec.rb @@ -0,0 +1,71 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../spec_helper' + +sshkey = Puppet::Type.type(:sshkey) + +describe sshkey do + before do + @class = sshkey + end + + it "should have :name its namevar" do + @class.key_attributes.should == [:name] + end + + describe "when validating attributes" do + [:name, :provider].each do |param| + it "should have a #{param} parameter" do + @class.attrtype(param).should == :param + end + end + + [:host_aliases, :ensure, :key, :type].each do |property| + it "should have a #{property} property" do + @class.attrtype(property).should == :property + end + end + end + + describe "when validating values" do + + it "should support ssh-dss as a type value" do + proc { @class.new(:name => "foo", :type => "ssh-dss") }.should_not raise_error + end + + it "should support ssh-rsa as a type value" do + proc { @class.new(:name => "whev", :type => "ssh-rsa") }.should_not raise_error + end + + it "should alias :dsa to ssh-dss as a value for type" do + key = @class.new(:name => "whev", :type => :dsa) + key.should(:type).should == :'ssh-dss' + end + + it "should alias :rsa to ssh-rsa as a value for type" do + key = @class.new(:name => "whev", :type => :rsa) + key.should(:type).should == :'ssh-rsa' + end + + it "should not support values other than ssh-dss, ssh-rsa, dsa, rsa for type" do + proc { @class.new(:name => "whev", :type => :'ssh-dsa') }.should raise_error(Puppet::Error) + end + + it "should accept one host_alias" do + proc { @class.new(:name => "foo", :host_aliases => 'foo.bar.tld') }.should_not raise_error + end + + it "should accept multiple host_aliases as an array" do + proc { @class.new(:name => "foo", :host_aliases => ['foo.bar.tld','10.0.9.9']) }.should_not raise_error + end + + it "should not accept spaces in any host_alias" do + proc { @class.new(:name => "foo", :host_aliases => ['foo.bar.tld','foo bar']) }.should raise_error(Puppet::Error) + end + + it "should not accept aliases in the resourcename" do + proc { @class.new(:name => 'host,host.domain,ip') }.should raise_error(Puppet::Error) + end + + end +end -- cgit From eee1a9cdaa5cab6222c8e6ab087d319f976fa4e3 Mon Sep 17 00:00:00 2001 From: Nigel Kersten Date: Tue, 30 Nov 2010 14:19:04 -0800 Subject: (#5424) Ship auth.conf as part of installing from source Add --configdir which defaults to /etc/puppet Add --no-configs to suppress config file installation. We're only shipping auth.conf at this stage, but in the future we may start shipping other config files. --- install.rb | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/install.rb b/install.rb index f7541c854..7627a8d11 100755 --- a/install.rb +++ b/install.rb @@ -79,6 +79,7 @@ def glob(list) end # Set these values to what you want installed. +configs = glob(%w{conf/auth.conf}) sbins = glob(%w{sbin/*}) bins = glob(%w{bin/*}) rdoc = glob(%w{bin/* sbin/* lib/**/*.rb README README-library CHANGELOG TODO Install}).reject { |e| e=~ /\.(bat|cmd)$/ } @@ -87,6 +88,14 @@ man = glob(%w{man/man[0-9]/*}) libs = glob(%w{lib/**/*.rb lib/**/*.py lib/puppet/util/command_line/*}) tests = glob(%w{test/**/*.rb}) +def do_configs(configs, target, strip = 'conf/') + Dir.mkdir(target) unless File.directory? target + configs.each do |cf| + ocf = File.join(InstallOptions.config_dir, cf.gsub(/#{strip}/, '')) + File.install(cf, ocf, 0644, true) + end +end + def do_bins(bins, target, strip = 's?bin/') Dir.mkdir(target) unless File.directory? target bins.each do |bf| @@ -157,6 +166,8 @@ end def prepare_installation $operatingsystem = Facter["operatingsystem"].value + InstallOptions.configs = true + # Only try to do docs if we're sure they have rdoc if $haverdoc InstallOptions.rdoc = true @@ -193,9 +204,15 @@ def prepare_installation opts.on('--[no-]tests', 'Prevents the execution of unit tests.', 'Default on.') do |ontest| InstallOptions.tests = ontest end + opts.on('--[no-]configs', 'Prevents the installation of config files', 'Default off.') do |ontest| + InstallOptions.configs = ontest + end opts.on('--destdir[=OPTIONAL]', 'Installation prefix for all targets', 'Default essentially /') do |destdir| InstallOptions.destdir = destdir end + opts.on('--configdir[=OPTIONAL]', 'Installation directory for config files', 'Default /etc/puppet') do |configdir| + InstallOptions.configdir = configdir + end opts.on('--bindir[=OPTIONAL]', 'Installation directory for binaries', 'overrides Config::CONFIG["bindir"]') do |bindir| InstallOptions.bindir = bindir end @@ -209,15 +226,17 @@ def prepare_installation InstallOptions.mandir = mandir end opts.on('--quick', 'Performs a quick installation. Only the', 'installation is done.') do |quick| - InstallOptions.rdoc = false - InstallOptions.ri = false - InstallOptions.tests = false + InstallOptions.rdoc = false + InstallOptions.ri = false + InstallOptions.tests = false + InstallOptions.configs = true end opts.on('--full', 'Performs a full installation. All', 'optional installation steps are run.') do |full| - InstallOptions.rdoc = true - InstallOptions.man = true - InstallOptions.ri = true - InstallOptions.tests = true + InstallOptions.rdoc = true + InstallOptions.man = true + InstallOptions.ri = true + InstallOptions.tests = true + InstallOptions.configs = true end opts.separator("") opts.on_tail('--help', "Shows this help text.") do @@ -243,6 +262,12 @@ def prepare_installation Config::CONFIG['sbindir'] = "/usr/sbin" end + if not InstallOptions.configdir.nil? + configdir = InstallOptions.configdir + else + configdir = "/etc/puppet" + end + if not InstallOptions.bindir.nil? bindir = InstallOptions.bindir else @@ -277,22 +302,26 @@ def prepare_installation # To be deprecated once people move over to using --destdir option if (destdir = ENV['DESTDIR']) + configdir = "#{destdir}#{configdir}" bindir = "#{destdir}#{bindir}" sbindir = "#{destdir}#{sbindir}" mandir = "#{destdir}#{mandir}" sitelibdir = "#{destdir}#{sitelibdir}" + FileUtils.makedirs(configdir) if InstallOptions.configs FileUtils.makedirs(bindir) FileUtils.makedirs(sbindir) FileUtils.makedirs(mandir) FileUtils.makedirs(sitelibdir) # This is the new way forward elsif (destdir = InstallOptions.destdir) + configdir = "#{destdir}#{configdir}" bindir = "#{destdir}#{bindir}" sbindir = "#{destdir}#{sbindir}" mandir = "#{destdir}#{mandir}" sitelibdir = "#{destdir}#{sitelibdir}" + FileUtils.makedirs(configdir) if InstallOptions.configs FileUtils.makedirs(bindir) FileUtils.makedirs(sbindir) FileUtils.makedirs(mandir) @@ -303,6 +332,7 @@ def prepare_installation InstallOptions.tmp_dirs = tmpdirs.compact InstallOptions.site_dir = sitelibdir + InstallOptions.config_dir = configdir InstallOptions.bin_dir = bindir InstallOptions.sbin_dir = sbindir InstallOptions.lib_dir = libdir @@ -459,6 +489,7 @@ prepare_installation #build_rdoc(rdoc) if InstallOptions.rdoc #build_ri(ri) if InstallOptions.ri #build_man(bins, sbins) if InstallOptions.man +do_configs(configs, InstallOptions.config_dir) if InstallOptions.configs do_bins(sbins, InstallOptions.sbin_dir) do_bins(bins, InstallOptions.bin_dir) do_libs(libs) -- cgit From 19f38794ecb5ce55b7850e77bdab919bb33c7ce3 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Wed, 24 Nov 2010 15:32:32 -0800 Subject: Disable remote ralsh by default Changed the default auth.conf so that accesses to "/resource" are no longer allowed. This means that to use "puppet resource -H" you will need to configure the target machine to enable access to the "/resource" URLs. --- lib/puppet/network/rest_authconfig.rb | 1 - spec/unit/network/rest_authconfig_spec.rb | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/puppet/network/rest_authconfig.rb b/lib/puppet/network/rest_authconfig.rb index 82d5a9de2..7abe06956 100644 --- a/lib/puppet/network/rest_authconfig.rb +++ b/lib/puppet/network/rest_authconfig.rb @@ -17,7 +17,6 @@ module Puppet { :acl => "/certificate/", :method => :find, :authenticated => false }, { :acl => "/certificate_request", :method => [:find, :save], :authenticated => false }, { :acl => "/status", :method => [:find], :authenticated => true }, - { :acl => "/resource", :method => [:find, :save, :search], :authenticated => true }, ] def self.main diff --git a/spec/unit/network/rest_authconfig_spec.rb b/spec/unit/network/rest_authconfig_spec.rb index 351f3f040..06436e723 100755 --- a/spec/unit/network/rest_authconfig_spec.rb +++ b/spec/unit/network/rest_authconfig_spec.rb @@ -17,7 +17,6 @@ describe Puppet::Network::RestAuthConfig do { :acl => "/certificate/", :method => :find, :authenticated => false }, { :acl => "/certificate_request", :method => [:find, :save], :authenticated => false }, { :acl => "/status", :method => [:find], :authenticated => true }, - { :acl => "/resource", :method => [:find, :save, :search], :authenticated => true }, ] before :each do -- cgit From 76890a534640e077083785ba1321e76b7c4745ca Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Thu, 2 Dec 2010 06:53:17 +1100 Subject: Revert "(#5304) Use internal_name rather than real_name for maillist provider" This reverts commit 779fea867a9e23ad48cd877a88756cc5792e9e0c. --- lib/puppet/provider/maillist/mailman.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/puppet/provider/maillist/mailman.rb b/lib/puppet/provider/maillist/mailman.rb index 633642af7..4fdc20a69 100755 --- a/lib/puppet/provider/maillist/mailman.rb +++ b/lib/puppet/provider/maillist/mailman.rb @@ -2,11 +2,11 @@ require 'puppet/provider/parsedfile' Puppet::Type.type(:maillist).provide(:mailman) do if [ "CentOS", "RedHat", "Fedora" ].any? { |os| Facter.value(:operatingsystem) == os } - commands :list_lists => "/usr/lib/mailman/bin/list_lists --bare", :rmlist => "/usr/lib/mailman/bin/rmlist", :newlist => "/usr/lib/mailman/bin/newlist" + commands :list_lists => "/usr/lib/mailman/bin/list_lists", :rmlist => "/usr/lib/mailman/bin/rmlist", :newlist => "/usr/lib/mailman/bin/newlist" commands :mailman => "/usr/lib/mailman/mail/mailman" else # This probably won't work for non-Debian installs, but this path is sure not to be in the PATH. - commands :list_lists => "list_lists --bare", :rmlist => "rmlist", :newlist => "newlist" + commands :list_lists => "list_lists", :rmlist => "rmlist", :newlist => "newlist" commands :mailman => "/var/lib/mailman/mail/mailman" end @@ -14,9 +14,10 @@ Puppet::Type.type(:maillist).provide(:mailman) do # Return a list of existing mailman instances. def self.instances - list_lists.split("\n").collect do |line| - name = line.strip - new(:ensure => :present, :name => name) + list_lists.split("\n").reject { |line| line.include?("matching mailing lists") }.collect do |line| + name, description = line.sub(/^\s+/, '').sub(/\s+$/, '').split(/\s+-\s+/) + description = :absent if description.include?("no description available") + new(:ensure => :present, :name => name, :description => description) end end -- cgit From 3f9f37984d1ac5f3ddcc83bf2b1facdb6df6dacd Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Thu, 2 Dec 2010 06:55:11 +1100 Subject: Updated CHANGELOG and version for 2.6.4 --- CHANGELOG | 9 +++++++++ lib/puppet.rb | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 78483351c..c3135031b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,14 @@ +2.6.4 +===== +76890a5 Revert "(#5304) Use internal_name rather than real_name for maillist provider" +19f3879 Disable remote ralsh by default +eee1a9c (#5424) Ship auth.conf as part of installing from source +779fea8 (#5304) Use internal_name rather than real_name for maillist provider +83f878e Renamed Reductive to Puppet + 2.6.3 ===== +53bb805 Incremented CHANGELOG for 2.6.3 184733c [#5322] (#5322) Remove spec file that adds little value and causes failures 178c2a6 Fix test failures that fixing #4726 exposed. 74b6c09 (#4726) Fix RRD legacy support diff --git a/lib/puppet.rb b/lib/puppet.rb index 78fb5138b..a58d3c801 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -24,7 +24,7 @@ require 'puppet/util/run_mode' # it's also a place to find top-level commands like 'debug' module Puppet - PUPPETVERSION = '2.6.3' + PUPPETVERSION = '2.6.4' def Puppet.version PUPPETVERSION -- cgit From af6e08c0a59db951502d0cf8c0ca24f5001e92f1 Mon Sep 17 00:00:00 2001 From: Nigel Kersten Date: Mon, 15 Nov 2010 12:36:34 -0800 Subject: (#5304) Use internal_name rather than real_name for maillist provider We've switched to using list_lists --bare which shows the internal_name rather than "real_name", which is the authoritative identifier. Doing this also means we have less output to scrub, so the code is simpler. Modified by Markus as-per discussion with Nigel. Signed-off-by: Nigel Kersten --- lib/puppet/provider/maillist/mailman.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/puppet/provider/maillist/mailman.rb b/lib/puppet/provider/maillist/mailman.rb index 4fdc20a69..e070a25dd 100755 --- a/lib/puppet/provider/maillist/mailman.rb +++ b/lib/puppet/provider/maillist/mailman.rb @@ -14,11 +14,9 @@ Puppet::Type.type(:maillist).provide(:mailman) do # Return a list of existing mailman instances. def self.instances - list_lists.split("\n").reject { |line| line.include?("matching mailing lists") }.collect do |line| - name, description = line.sub(/^\s+/, '').sub(/\s+$/, '').split(/\s+-\s+/) - description = :absent if description.include?("no description available") - new(:ensure => :present, :name => name, :description => description) - end + list_lists('--bare'). + split("\n"). + collect { |line| new(:ensure => :present, :name => line.strip) } end # Prefetch our list list, yo. -- cgit From b27e9b4bd79c30c7910a02122069695044f05477 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Wed, 1 Dec 2010 17:16:03 -0800 Subject: [#5081] Revert "Fix #4349 - Parsing with ignoreimport=true was always loading site.pp" The fix for #4349 caused --parse-only not to detect syntax errors when --ignore-import was used by adding a return statement that bypassed the initial import: commit 760e418d254a8d2198d2c6eb466d783a5930ef47 def perform_initial_import + return if Puppet.settings[:ignoreimport] The problem that #4349 fixed was more generally fixed in commit 99c1019e1d3402ec8e476dc859d5aaef82ec4f69 for ticket #4798 so the return statement is no longer needed, so reverting the commit for #4349 does not reintroduce the problem of an import loop error when running puppet doc. Paired-with: Jesse Wolfe --- lib/puppet/resource/type_collection.rb | 1 - spec/unit/resource/type_collection_spec.rb | 8 -------- 2 files changed, 9 deletions(-) diff --git a/lib/puppet/resource/type_collection.rb b/lib/puppet/resource/type_collection.rb index 63d110395..6a03458b3 100644 --- a/lib/puppet/resource/type_collection.rb +++ b/lib/puppet/resource/type_collection.rb @@ -153,7 +153,6 @@ class Puppet::Resource::TypeCollection end def perform_initial_import - return if Puppet.settings[:ignoreimport] parser = Puppet::Parser::Parser.new(environment) if code = Puppet.settings.uninterpolated_value(:code, environment.to_s) and code != "" parser.string = code diff --git a/spec/unit/resource/type_collection_spec.rb b/spec/unit/resource/type_collection_spec.rb index 577aea42b..ff4c22234 100644 --- a/spec/unit/resource/type_collection_spec.rb +++ b/spec/unit/resource/type_collection_spec.rb @@ -426,14 +426,6 @@ describe Puppet::Resource::TypeCollection do @parser.expects(:parse).raises ArgumentError lambda { @code.perform_initial_import }.should raise_error(Puppet::Error) end - - it "should not do anything if the ignore_import settings is set" do - Puppet.settings[:ignoreimport] = true - @parser.expects(:string=).never - @parser.expects(:file=).never - @parser.expects(:parse).never - @code.perform_initial_import - end end describe "when determining the configuration version" do -- cgit From 094a5c85fc9b4b1bd00f14193abdf23839905dc7 Mon Sep 17 00:00:00 2001 From: Steve Nielson Date: Mon, 22 Nov 2010 14:58:31 -0500 Subject: (#5211) Added patch and tests for checking the size of the arrary which is returned --- lib/puppet/provider/augeas/augeas.rb | 7 ++++++- spec/unit/provider/augeas/augeas_spec.rb | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb index 7dbd06240..461968245 100644 --- a/lib/puppet/provider/augeas/augeas.rb +++ b/lib/puppet/provider/augeas/augeas.rb @@ -213,7 +213,12 @@ Puppet::Type.type(:augeas).provide(:augeas) do fail("Invalid command: #{cmd_array.join(" ")}") if clause_array.length != 2 comparator = clause_array.shift arg = clause_array.shift - return_value = (result.size.send(comparator, arg)) + case comparator + when "!=" + return_value = !(result.size.send(:==, arg)) + else + return_value = (result.size.send(comparator, arg)) + end when "include" arg = clause_array.shift return_value = result.include?(arg) diff --git a/spec/unit/provider/augeas/augeas_spec.rb b/spec/unit/provider/augeas/augeas_spec.rb index 07b632083..0cedbdbc3 100644 --- a/spec/unit/provider/augeas/augeas_spec.rb +++ b/spec/unit/provider/augeas/augeas_spec.rb @@ -316,6 +316,30 @@ describe provider_class do provider.stubs(:get_augeas_version).returns("0.3.5") provider.need_to_run?.should == false end + + #Ticket 5211 testing + it "should return true when a size != the provided value" do + resource = stub("resource") + resource.stubs(:[]).returns(false).then.returns("match path size != 17").then.returns("") + provider = provider_class.new(resource) + augeas_stub = stub("augeas", :match => ["set", "of", "values"]) + augeas_stub.stubs("close") + provider.aug= augeas_stub + provider.stubs(:get_augeas_version).returns("0.3.5") + provider.need_to_run?.should == true + end + + #Ticket 5211 testing + it "should return false when a size doeas equal the provided value" do + resource = stub("resource") + resource.stubs(:[]).returns(false).then.returns("match path size != 3").then.returns("") + provider = provider_class.new(resource) + augeas_stub = stub("augeas", :match => ["set", "of", "values"]) + augeas_stub.stubs("close") + provider.aug= augeas_stub + provider.stubs(:get_augeas_version).returns("0.3.5") + provider.need_to_run?.should == false + end end describe "augeas execution integration" do -- cgit From b67f4c68503ca3abf0a55857da452e46fa75abd5 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Thu, 2 Dec 2010 11:07:03 -0800 Subject: maint: Restore a default value that can cause order dependent test failures If you ran two tests in the following order: spec spec/integration/network/server/webrick_spec.rb spec/unit/ssl/certificate_request_spec.rb You got the following test failure: Cannot save me; parent directory /dev/null/ssl/certificate_requests does not exist Paired-with: Paul Berry --- spec/integration/network/server/webrick_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/integration/network/server/webrick_spec.rb b/spec/integration/network/server/webrick_spec.rb index 37a6bd5c5..963e27940 100755 --- a/spec/integration/network/server/webrick_spec.rb +++ b/spec/integration/network/server/webrick_spec.rb @@ -32,6 +32,7 @@ describe Puppet::Network::Server do system("rm -rf #{@dir}") + Puppet::SSL::Host.ca_location = :none Puppet::Util::Cacher.expire end -- cgit From c908fdb520e0fc203d49e0c14c4c7cbc193ab262 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Mon, 22 Nov 2010 15:17:51 -0800 Subject: (#5261) Fix #5261 Don't escape Unicode characters in PSON This patch removes the escaping of valid UTF-8 sequences as "\uXXXX". This code was unreliable, as it relied on Iconv's ability to convert those codepoints between UTF-8 and UTF-16, but some versions of Iconv barf on some valid codepoints. Invalid UTF-8 sequences are still passed through unchanged. We believe that this is fine; if you are concerned about complience with the JSON standard, what we are doing is equivalent to: * interpreting binary files as Latin-1 encoded character sequences * JSON-encoding those characters according to RFC 4627 * outputting the JSON as Latin-1 This allows all raw binary files to be transmitted losslessly. Paired-With: Paul Berry --- lib/puppet/external/pson/pure/generator.rb | 23 +---------------------- spec/unit/util/pson_spec.rb | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/lib/puppet/external/pson/pure/generator.rb b/lib/puppet/external/pson/pure/generator.rb index 4180be57d..89a0c62e0 100644 --- a/lib/puppet/external/pson/pure/generator.rb +++ b/lib/puppet/external/pson/pure/generator.rb @@ -44,34 +44,13 @@ module PSON string << '' # XXX workaround: avoid buffer sharing string.force_encoding(Encoding::ASCII_8BIT) string.gsub!(/["\\\x0-\x1f]/) { MAP[$MATCH] } - string.gsub!(/( - (?: - [\xc2-\xdf][\x80-\xbf] | - [\xe0-\xef][\x80-\xbf]{2} | - [\xf0-\xf4][\x80-\xbf]{3} - )+ | - [\x80-\xc1\xf5-\xff] # invalid - )/nx) { |c| - c.size == 1 and raise GeneratorError, "invalid utf8 byte: '#{c}'" - s = PSON::UTF8toUTF16.iconv(c).unpack('H*')[0] - s.gsub!(/.{4}/n, '\\\\u\&') - } - string.force_encoding(Encoding::UTF_8) string rescue Iconv::Failure => e raise GeneratorError, "Caught #{e.class}: #{e}" end else def utf8_to_pson(string) # :nodoc: - string. - gsub(/["\\\x0-\x1f]/n) { MAP[$MATCH] }. - gsub(/((?: - [\xc2-\xdf][\x80-\xbf] | - [\xe0-\xef][\x80-\xbf]{2} | - [\xf0-\xf4][\x80-\xbf]{3} - )+)/nx) { |c| - PSON::UTF8toUTF16.iconv(c).unpack('H*')[0].gsub(/.{4}/n, '\\\\u\&') - } + string.gsub(/["\\\x0-\x1f]/n) { MAP[$MATCH] } end end module_function :utf8_to_pson diff --git a/spec/unit/util/pson_spec.rb b/spec/unit/util/pson_spec.rb index d02d28517..474ddafa4 100755 --- a/spec/unit/util/pson_spec.rb +++ b/spec/unit/util/pson_spec.rb @@ -35,4 +35,19 @@ describe Puppet::Util::Pson do bin_string = (1..20000).collect { |i| ((17*i+13*i*i) % 255).chr }.join PSON.parse(%Q{{ "type": "foo", "data": #{bin_string.to_pson} }})["data"].should == bin_string end + + it "should be able to handle UTF8 that isn't a real unicode character" do + s = ["\355\274\267"] + PSON.parse( [s].to_pson ).should == [s] + end + + it "should be able to handle UTF8 for \\xFF" do + s = ["\xc3\xbf"] + PSON.parse( [s].to_pson ).should == [s] + end + + it "should be able to handle invalid UTF8 bytes" do + s = ["\xc3\xc3"] + PSON.parse( [s].to_pson ).should == [s] + end end -- cgit From e005cc79facf74d66a45ae93eadfe3e5737024e4 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Thu, 2 Dec 2010 11:25:17 -0800 Subject: maint: Remove bogus mongrel test Why test that mongrel responds to daemonize? EVERYTHING responds to daemonize thanks to activesupport. Paired-with: Paul Berry --- test/network/server/mongrel_test.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/network/server/mongrel_test.rb b/test/network/server/mongrel_test.rb index 7bb2df150..d675b42f7 100755 --- a/test/network/server/mongrel_test.rb +++ b/test/network/server/mongrel_test.rb @@ -95,11 +95,5 @@ class TestMongrelServer < PuppetTest::TestCase assert_equal(ip, info.ip, "Did not copy over ip correctly") assert_equal(Resolv.getname(ip), info.name, "Did not look up hostname correctly") end - - def test_daemonize - mongrel = mkserver - - assert(mongrel.respond_to?(:daemonize), "Mongrel server does not respond to daemonize") - end end -- cgit From 1131ad73078c3e3022b23ee8ab756b44c7de27c9 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Thu, 2 Dec 2010 10:49:13 -0800 Subject: (#4943) Add puppet inspect application "puppet inspect" will load the locally stored YAML catalog and record the current state of the audited properties in the catalog. It uses settings specified in the [agent] configuration section, and will send its inspect report to the specified server. Paired-With: Jesse Wolfe --- lib/puppet/application/inspect.rb | 80 +++++++++++++++++++++++++++++++++++ lib/puppet/transaction/report.rb | 5 ++- spec/unit/application/inspect_spec.rb | 79 ++++++++++++++++++++++++++++++++++ spec/unit/transaction/report_spec.rb | 8 ++++ 4 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 lib/puppet/application/inspect.rb create mode 100644 spec/unit/application/inspect_spec.rb diff --git a/lib/puppet/application/inspect.rb b/lib/puppet/application/inspect.rb new file mode 100644 index 000000000..c28fef326 --- /dev/null +++ b/lib/puppet/application/inspect.rb @@ -0,0 +1,80 @@ +require 'puppet/application' + +class Puppet::Application::Inspect < Puppet::Application + + should_parse_config + run_mode :agent + + option("--debug","-d") + option("--verbose","-v") + + option("--logdest LOGDEST", "-l") do |arg| + begin + Puppet::Util::Log.newdestination(arg) + options[:logset] = true + rescue => detail + $stderr.puts detail.to_s + end + end + + def setup + exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs? + + raise "Inspect requires reporting to be enabled. Set report=true in puppet.conf to enable reporting." unless Puppet[:report] + + @report = Puppet::Transaction::Report.new("inspect") + + Puppet::Util::Log.newdestination(@report) + Puppet::Util::Log.newdestination(:console) unless options[:logset] + + trap(:INT) do + $stderr.puts "Exiting" + exit(1) + end + + if options[:debug] + Puppet::Util::Log.level = :debug + elsif options[:verbose] + Puppet::Util::Log.level = :info + end + + Puppet::Transaction::Report.terminus_class = :rest + Puppet::Resource::Catalog.terminus_class = :yaml + end + + def run_command + retrieval_starttime = Time.now + + unless catalog = Puppet::Resource::Catalog.find(Puppet[:certname]) + raise "Could not find catalog for #{Puppet[:certname]}" + end + + retrieval_time = Time.now - retrieval_starttime + @report.add_times("config_retrieval", retrieval_time) + + starttime = Time.now + + catalog.to_ral.resources.each do |ral_resource| + audited_attributes = ral_resource[:audit] + next unless audited_attributes + + audited_resource = ral_resource.to_resource + + status = Puppet::Resource::Status.new(ral_resource) + audited_attributes.each do |name| + event = ral_resource.event(:previous_value => audited_resource[name], :property => name, :status => "audit", :message => "inspected value is #{audited_resource[name].inspect}") + status.add_event(event) + end + @report.add_resource_status(status) + end + + @report.add_metric(:time, {"config_retrieval" => retrieval_time, "inspect" => Time.now - starttime}) + + begin + @report.save + rescue => detail + puts detail.backtrace if Puppet[:trace] + Puppet.err "Could not send report: #{detail}" + end + end +end diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb index e6d1e0528..75c08fc7a 100644 --- a/lib/puppet/transaction/report.rb +++ b/lib/puppet/transaction/report.rb @@ -10,7 +10,7 @@ class Puppet::Transaction::Report indirects :report, :terminus_class => :processor - attr_reader :resource_statuses, :logs, :metrics, :host, :time + attr_reader :resource_statuses, :logs, :metrics, :host, :time, :kind # This is necessary since Marshall doesn't know how to # dump hash with default proc (see below @records) @@ -49,13 +49,14 @@ class Puppet::Transaction::Report calculate_event_metrics end - def initialize + def initialize(kind = "apply") @metrics = {} @logs = [] @resource_statuses = {} @external_times ||= {} @host = Puppet[:certname] @time = Time.now + @kind = kind end def name diff --git a/spec/unit/application/inspect_spec.rb b/spec/unit/application/inspect_spec.rb new file mode 100644 index 000000000..a3cc74d86 --- /dev/null +++ b/spec/unit/application/inspect_spec.rb @@ -0,0 +1,79 @@ +#!/usr/bin/env ruby + +require File.dirname(__FILE__) + '/../../spec_helper' + +require 'puppet/application/inspect' +require 'puppet/resource/catalog' +require 'puppet/indirector/catalog/yaml' +require 'puppet/indirector/report/rest' + +describe Puppet::Application::Inspect do + before :each do + @inspect = Puppet::Application[:inspect] + end + + describe "during setup" do + it "should print its configuration if asked" do + Puppet[:configprint] = "all" + + Puppet.settings.expects(:print_configs).returns(true) + lambda { @inspect.setup }.should raise_error(SystemExit) + end + + it "should fail if reporting is turned off" do + Puppet[:report] = false + lambda { @inspect.setup }.should raise_error(/report=true/) + end + end + + describe "when executing" do + before :each do + Puppet[:report] = true + Puppet::Util::Log.stubs(:newdestination) + Puppet::Transaction::Report::Rest.any_instance.stubs(:save) + @inspect.setup + end + + it "should retrieve the local catalog" do + Puppet::Resource::Catalog::Yaml.any_instance.expects(:find).with {|request| request.key == Puppet[:certname] }.returns(Puppet::Resource::Catalog.new) + + @inspect.run_command + end + + it "should save the report to REST" do + Puppet::Resource::Catalog::Yaml.any_instance.stubs(:find).returns(Puppet::Resource::Catalog.new) + Puppet::Transaction::Report::Rest.any_instance.expects(:save).with {|request| request.instance.host == Puppet[:certname] } + + @inspect.run_command + end + + it "should audit the specified properties" do + catalog = Puppet::Resource::Catalog.new + file = Tempfile.new("foo") + file.puts("file contents") + file.flush + resource = Puppet::Resource.new(:file, file.path, :parameters => {:audit => "all"}) + catalog.add_resource(resource) + Puppet::Resource::Catalog::Yaml.any_instance.stubs(:find).returns(catalog) + + events = nil + + Puppet::Transaction::Report::Rest.any_instance.expects(:save).with do |request| + events = request.instance.resource_statuses.values.first.events + end + + @inspect.run_command + + properties = events.inject({}) do |property_values, event| + property_values.merge(event.property => event.previous_value) + end + properties["ensure"].should == :file + properties["content"].should == "{md5}#{Digest::MD5.hexdigest("file contents\n")}" + end + end + + after :all do + Puppet::Resource::Catalog.indirection.reset_terminus_class + Puppet::Transaction::Report.indirection.terminus_class = :processor + end +end diff --git a/spec/unit/transaction/report_spec.rb b/spec/unit/transaction/report_spec.rb index 7e0b0554b..77f82159b 100755 --- a/spec/unit/transaction/report_spec.rb +++ b/spec/unit/transaction/report_spec.rb @@ -24,6 +24,14 @@ describe Puppet::Transaction::Report do Puppet::Transaction::Report.new.time.should == "mytime" end + it "should have a default 'kind' of 'apply'" do + Puppet::Transaction::Report.new.kind.should == "apply" + end + + it "should take a 'kind' as an argument" do + Puppet::Transaction::Report.new("inspect").kind.should == "inspect" + end + describe "when accepting logs" do before do @report = Puppet::Transaction::Report.new -- cgit From b9f3847cd2c7efb954f428224d8d721f9edafd64 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Mon, 6 Dec 2010 11:57:54 -0800 Subject: maint: Fix more order dependent test failures In commit b67f4c68503ca3abf0a55857da452e46fa75abd5 I fixed one place that was causing order dependent test failures in spec/unit/ssl/certificate_request_spec.rb, but missed another case that was causing a similar failure. To find all the order dependent failures with that file I ran the following bash script from the spec directory: for TEST in `find . -name "*.rb" -type f`; do spec $TEST unit/ssl/certificate_request_spec.rb > /dev/null 2>&1 if [[ $? != 0 ]]; then echo $TEST fi done Paired-with: Jesse Wolfe --- spec/unit/application/master_spec.rb | 1 + spec/unit/ssl/certificate_request_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/unit/application/master_spec.rb b/spec/unit/application/master_spec.rb index 86e38efcb..e97bcb5dc 100644 --- a/spec/unit/application/master_spec.rb +++ b/spec/unit/application/master_spec.rb @@ -20,6 +20,7 @@ describe Puppet::Application::Master do Puppet::Node::Facts.indirection.stubs(:cache_class=) Puppet::Transaction::Report.indirection.stubs(:terminus_class=) Puppet::Resource::Catalog.indirection.stubs(:terminus_class=) + Puppet::SSL::Host.stubs(:ca_location=) end it "should operate in master run_mode" do diff --git a/spec/unit/ssl/certificate_request_spec.rb b/spec/unit/ssl/certificate_request_spec.rb index fb4b5a134..3a2130765 100755 --- a/spec/unit/ssl/certificate_request_spec.rb +++ b/spec/unit/ssl/certificate_request_spec.rb @@ -195,7 +195,7 @@ describe Puppet::SSL::CertificateRequest do csr = Puppet::SSL::CertificateRequest.new("me") terminus = mock 'terminus' Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus) - terminus.expects(:save).with { |request| puts request.key.inspect; request.instance == csr && request.key == "me" } + terminus.expects(:save).with { |request| request.instance == csr && request.key == "me" } Puppet::SSL::CertificateRequest.indirection.save(csr) end @@ -208,7 +208,7 @@ describe Puppet::SSL::CertificateRequest do csr = Puppet::SSL::CertificateRequest.new("me") terminus = mock 'terminus' Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus) - terminus.expects(:save).with { |request| puts request.key.inspect; request.instance == csr && request.key == "me" } + terminus.expects(:save).with { |request| request.instance == csr && request.key == "me" } Puppet::SSL::CertificateRequest.indirection.save(csr) end -- cgit From 626d7564467bdc0e9d2d385e9aa10c539d9ed175 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Mon, 6 Dec 2010 12:01:18 -0800 Subject: maint: Use expand_path when requiring spec_helper or puppettest Doing a require to a relative path can cause files to be required more than once when they're required from different relative paths. If you expand the path fully, this won't happen. Ruby 1.9 also requires that you use expand_path when doing these requires. Paired-with: Jesse Wolfe --- spec/integration/application/apply_spec.rb | 2 +- spec/integration/application/doc_spec.rb | 2 +- spec/integration/configurer_spec.rb | 2 +- spec/integration/defaults_spec.rb | 2 +- spec/integration/file_serving/content_spec.rb | 2 +- spec/integration/file_serving/fileset_spec.rb | 2 +- spec/integration/file_serving/metadata_spec.rb | 2 +- spec/integration/file_serving/terminus_helper_spec.rb | 2 +- spec/integration/indirector/direct_file_server_spec.rb | 2 +- spec/integration/indirector/file_content/file_server_spec.rb | 2 +- spec/integration/indirector/file_metadata/file_server_spec.rb | 2 +- spec/integration/indirector/node/ldap_spec.rb | 2 +- spec/integration/network/client_spec.rb | 2 +- spec/integration/network/formats_spec.rb | 2 +- spec/integration/network/handler_spec.rb | 2 +- spec/integration/network/server/mongrel_spec.rb | 2 +- spec/integration/network/server/webrick_spec.rb | 2 +- spec/integration/node/environment_spec.rb | 2 +- spec/integration/node/facts_spec.rb | 2 +- spec/integration/node_spec.rb | 2 +- spec/integration/parser/collector_spec.rb | 2 +- spec/integration/parser/compiler_spec.rb | 2 +- spec/integration/parser/functions/require_spec.rb | 2 +- spec/integration/parser/functions_spec.rb | 2 +- spec/integration/parser/parser_spec.rb | 2 +- spec/integration/parser/ruby_manifest_spec.rb | 2 +- spec/integration/provider/mailalias/aliases_spec.rb | 2 +- spec/integration/reports_spec.rb | 2 +- spec/integration/resource/catalog_spec.rb | 2 +- spec/integration/resource/type_collection_spec.rb | 2 +- spec/integration/ssl/certificate_authority_spec.rb | 2 +- spec/integration/ssl/certificate_request_spec.rb | 2 +- spec/integration/ssl/certificate_revocation_list_spec.rb | 2 +- spec/integration/ssl/host_spec.rb | 2 +- spec/integration/transaction/report_spec.rb | 2 +- spec/integration/transaction_spec.rb | 2 +- spec/integration/type/file_spec.rb | 2 +- spec/integration/type/package_spec.rb | 2 +- spec/integration/type/tidy_spec.rb | 2 +- spec/integration/type_spec.rb | 2 +- spec/integration/util/settings_spec.rb | 2 +- spec/spec_specs/runnable_spec.rb | 2 +- spec/unit/agent/locker_spec.rb | 2 +- spec/unit/agent_spec.rb | 2 +- spec/unit/application/agent_spec.rb | 2 +- spec/unit/application/apply_spec.rb | 2 +- spec/unit/application/cert_spec.rb | 2 +- spec/unit/application/describe_spec.rb | 2 +- spec/unit/application/doc_spec.rb | 2 +- spec/unit/application/filebucket_spec.rb | 2 +- spec/unit/application/kick_spec.rb | 2 +- spec/unit/application/master_spec.rb | 2 +- spec/unit/application/queue_spec.rb | 2 +- spec/unit/application/resource_spec.rb | 2 +- spec/unit/application_spec.rb | 2 +- spec/unit/configurer/downloader_spec.rb | 2 +- spec/unit/configurer/fact_handler_spec.rb | 2 +- spec/unit/configurer/plugin_handler_spec.rb | 2 +- spec/unit/configurer_spec.rb | 2 +- spec/unit/daemon_spec.rb | 2 +- spec/unit/dsl/resource_api_spec.rb | 2 +- spec/unit/dsl/resource_type_api_spec.rb | 2 +- spec/unit/file_bucket/dipper_spec.rb | 2 +- spec/unit/file_collection/lookup_spec.rb | 2 +- spec/unit/file_collection_spec.rb | 2 +- spec/unit/file_serving/base_spec.rb | 2 +- spec/unit/file_serving/configuration/parser_spec.rb | 2 +- spec/unit/file_serving/configuration_spec.rb | 2 +- spec/unit/file_serving/content_spec.rb | 2 +- spec/unit/file_serving/fileset_spec.rb | 2 +- spec/unit/file_serving/indirection_hooks_spec.rb | 2 +- spec/unit/file_serving/metadata_spec.rb | 2 +- spec/unit/file_serving/mount/file_spec.rb | 2 +- spec/unit/file_serving/mount/modules_spec.rb | 2 +- spec/unit/file_serving/mount/plugins_spec.rb | 2 +- spec/unit/file_serving/mount_spec.rb | 2 +- spec/unit/file_serving/terminus_helper_spec.rb | 2 +- spec/unit/indirector/active_record_spec.rb | 2 +- spec/unit/indirector/catalog/active_record_spec.rb | 2 +- spec/unit/indirector/catalog/compiler_spec.rb | 2 +- spec/unit/indirector/catalog/queue_spec.rb | 2 +- spec/unit/indirector/catalog/rest_spec.rb | 2 +- spec/unit/indirector/catalog/yaml_spec.rb | 2 +- spec/unit/indirector/certificate/ca_spec.rb | 2 +- spec/unit/indirector/certificate/file_spec.rb | 2 +- spec/unit/indirector/certificate/rest_spec.rb | 2 +- spec/unit/indirector/certificate_request/ca_spec.rb | 2 +- spec/unit/indirector/certificate_request/file_spec.rb | 2 +- spec/unit/indirector/certificate_request/rest_spec.rb | 2 +- spec/unit/indirector/certificate_revocation_list/ca_spec.rb | 2 +- spec/unit/indirector/certificate_revocation_list/file_spec.rb | 2 +- spec/unit/indirector/certificate_revocation_list/rest_spec.rb | 2 +- spec/unit/indirector/code_spec.rb | 2 +- spec/unit/indirector/direct_file_server_spec.rb | 2 +- spec/unit/indirector/envelope_spec.rb | 2 +- spec/unit/indirector/exec_spec.rb | 2 +- spec/unit/indirector/facts/active_record_spec.rb | 2 +- spec/unit/indirector/facts/couch_spec.rb | 2 +- spec/unit/indirector/facts/facter_spec.rb | 2 +- spec/unit/indirector/facts/rest_spec.rb | 2 +- spec/unit/indirector/facts/yaml_spec.rb | 2 +- spec/unit/indirector/file_content/file_server_spec.rb | 2 +- spec/unit/indirector/file_content/file_spec.rb | 2 +- spec/unit/indirector/file_content/rest_spec.rb | 2 +- spec/unit/indirector/file_metadata/file_server_spec.rb | 2 +- spec/unit/indirector/file_metadata/file_spec.rb | 2 +- spec/unit/indirector/file_metadata/rest_spec.rb | 2 +- spec/unit/indirector/file_server_spec.rb | 2 +- spec/unit/indirector/file_spec.rb | 2 +- spec/unit/indirector/indirection_spec.rb | 2 +- spec/unit/indirector/inventory/yaml_spec.rb | 2 +- spec/unit/indirector/key/ca_spec.rb | 2 +- spec/unit/indirector/key/file_spec.rb | 2 +- spec/unit/indirector/ldap_spec.rb | 2 +- spec/unit/indirector/memory_spec.rb | 2 +- spec/unit/indirector/node/active_record_spec.rb | 2 +- spec/unit/indirector/node/exec_spec.rb | 2 +- spec/unit/indirector/node/ldap_spec.rb | 2 +- spec/unit/indirector/node/memory_spec.rb | 2 +- spec/unit/indirector/node/plain_spec.rb | 2 +- spec/unit/indirector/node/rest_spec.rb | 2 +- spec/unit/indirector/node/yaml_spec.rb | 2 +- spec/unit/indirector/plain_spec.rb | 2 +- spec/unit/indirector/queue_spec.rb | 2 +- spec/unit/indirector/report/processor_spec.rb | 2 +- spec/unit/indirector/report/rest_spec.rb | 2 +- spec/unit/indirector/report/yaml_spec.rb | 2 +- spec/unit/indirector/request_spec.rb | 2 +- spec/unit/indirector/resource/ral_spec.rb | 2 +- spec/unit/indirector/resource_type/parser_spec.rb | 2 +- spec/unit/indirector/resource_type/rest_spec.rb | 2 +- spec/unit/indirector/rest_spec.rb | 2 +- spec/unit/indirector/run/local_spec.rb | 2 +- spec/unit/indirector/run/rest_spec.rb | 2 +- spec/unit/indirector/ssl_file_spec.rb | 2 +- spec/unit/indirector/terminus_spec.rb | 2 +- spec/unit/indirector/yaml_spec.rb | 2 +- spec/unit/indirector_spec.rb | 2 +- spec/unit/module_spec.rb | 2 +- spec/unit/network/authconfig_spec.rb | 2 +- spec/unit/network/authstore_spec.rb | 2 +- spec/unit/network/client_spec.rb | 2 +- spec/unit/network/format_handler_spec.rb | 2 +- spec/unit/network/format_spec.rb | 2 +- spec/unit/network/formats_spec.rb | 2 +- spec/unit/network/handler/fileserver_spec.rb | 2 +- spec/unit/network/http/compression_spec.rb | 2 +- spec/unit/network/http/handler_spec.rb | 2 +- spec/unit/network/http/mongrel/rest_spec.rb | 2 +- spec/unit/network/http/mongrel_spec.rb | 2 +- spec/unit/network/http/rack/rest_spec.rb | 2 +- spec/unit/network/http/rack/xmlrpc_spec.rb | 2 +- spec/unit/network/http/rack_spec.rb | 2 +- spec/unit/network/http/webrick/rest_spec.rb | 2 +- spec/unit/network/http/webrick_spec.rb | 2 +- spec/unit/network/http_pool_spec.rb | 2 +- spec/unit/network/http_spec.rb | 2 +- spec/unit/network/rest_authconfig_spec.rb | 2 +- spec/unit/network/rights_spec.rb | 2 +- spec/unit/network/server_spec.rb | 2 +- spec/unit/node/environment_spec.rb | 2 +- spec/unit/node/facts_spec.rb | 2 +- spec/unit/node_spec.rb | 2 +- spec/unit/other/selinux_spec.rb | 2 +- spec/unit/other/transbucket_spec.rb | 2 +- spec/unit/other/transobject_spec.rb | 2 +- spec/unit/parameter/value_collection_spec.rb | 2 +- spec/unit/parameter/value_spec.rb | 2 +- spec/unit/parameter_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 | 2 +- spec/unit/parser/ast/collection_spec.rb | 2 +- spec/unit/parser/ast/collexpr_spec.rb | 2 +- spec/unit/parser/ast/comparison_operator_spec.rb | 2 +- spec/unit/parser/ast/definition_spec.rb | 2 +- spec/unit/parser/ast/function_spec.rb | 2 +- spec/unit/parser/ast/hostclass_spec.rb | 2 +- spec/unit/parser/ast/ifstatement_spec.rb | 2 +- spec/unit/parser/ast/in_operator_spec.rb | 2 +- spec/unit/parser/ast/leaf_spec.rb | 2 +- spec/unit/parser/ast/match_operator_spec.rb | 2 +- spec/unit/parser/ast/minus_spec.rb | 2 +- spec/unit/parser/ast/node_spec.rb | 2 +- spec/unit/parser/ast/nop_spec.rb | 2 +- spec/unit/parser/ast/not_spec.rb | 2 +- spec/unit/parser/ast/relationship_spec.rb | 2 +- spec/unit/parser/ast/resource_defaults_spec.rb | 2 +- spec/unit/parser/ast/resource_override_spec.rb | 2 +- spec/unit/parser/ast/resource_reference_spec.rb | 2 +- spec/unit/parser/ast/resource_spec.rb | 2 +- spec/unit/parser/ast/selector_spec.rb | 2 +- spec/unit/parser/ast/vardef_spec.rb | 2 +- spec/unit/parser/ast_spec.rb | 2 +- spec/unit/parser/collector_spec.rb | 2 +- spec/unit/parser/compiler_spec.rb | 2 +- spec/unit/parser/files_spec.rb | 2 +- spec/unit/parser/functions/defined_spec.rb | 2 +- spec/unit/parser/functions/extlookup_spec.rb | 2 +- spec/unit/parser/functions/fqdn_rand_spec.rb | 2 +- spec/unit/parser/functions/generate_spec.rb | 2 +- spec/unit/parser/functions/include_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 | 2 +- spec/unit/parser/parser_spec.rb | 2 +- spec/unit/parser/relationship_spec.rb | 2 +- spec/unit/parser/resource_spec.rb | 2 +- spec/unit/parser/scope_spec.rb | 2 +- spec/unit/parser/templatewrapper_spec.rb | 2 +- spec/unit/parser/type_loader_spec.rb | 2 +- spec/unit/property_spec.rb | 2 +- spec/unit/provider/augeas/augeas_spec.rb | 2 +- spec/unit/provider/confine/exists_spec.rb | 2 +- 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_collection_spec.rb | 2 +- spec/unit/provider/confine_spec.rb | 2 +- spec/unit/provider/confiner_spec.rb | 2 +- spec/unit/provider/group/groupadd_spec.rb | 2 +- spec/unit/provider/group/ldap_spec.rb | 2 +- spec/unit/provider/host/parsed_spec.rb | 2 +- spec/unit/provider/ldap_spec.rb | 2 +- spec/unit/provider/macauthorization_spec.rb | 2 +- spec/unit/provider/mcx/mcxcontent_spec.rb | 2 +- spec/unit/provider/mount/parsed_spec.rb | 2 +- spec/unit/provider/mount_spec.rb | 2 +- spec/unit/provider/naginator_spec.rb | 2 +- spec/unit/provider/package/aix_spec.rb | 2 +- spec/unit/provider/package/gem_spec.rb | 2 +- spec/unit/provider/package/hpux_spec.rb | 2 +- spec/unit/provider/package/nim_spec.rb | 2 +- spec/unit/provider/package/yum_spec.rb | 2 +- spec/unit/provider/package/zypper_spec.rb | 2 +- spec/unit/provider/parsedfile_spec.rb | 2 +- spec/unit/provider/service/daemontools_spec.rb | 2 +- spec/unit/provider/service/debian_spec.rb | 2 +- spec/unit/provider/service/freebsd_spec.rb | 2 +- spec/unit/provider/service/init_spec.rb | 2 +- spec/unit/provider/service/launchd_spec.rb | 2 +- spec/unit/provider/service/redhat_spec.rb | 2 +- spec/unit/provider/service/runit_spec.rb | 2 +- spec/unit/provider/service/src_spec.rb | 2 +- spec/unit/provider/service/upstart.rb | 2 +- spec/unit/provider/ssh_authorized_key/parsed_spec.rb | 2 +- spec/unit/provider/sshkey/parsed_spec.rb | 2 +- spec/unit/provider/user/hpux_spec.rb | 2 +- spec/unit/provider/user/ldap_spec.rb | 2 +- spec/unit/provider/user/user_role_add_spec.rb | 2 +- spec/unit/provider/user/useradd_spec.rb | 2 +- spec/unit/provider/zfs/solaris_spec.rb | 2 +- spec/unit/provider/zone/solaris_spec.rb | 2 +- spec/unit/provider/zpool/solaris_spec.rb | 2 +- spec/unit/provider_spec.rb | 2 +- spec/unit/puppet_spec.rb | 2 +- spec/unit/rails/host_spec.rb | 2 +- spec/unit/rails/param_value_spec.rb | 2 +- spec/unit/rails/resource_spec.rb | 2 +- spec/unit/rails_spec.rb | 2 +- spec/unit/relationship_spec.rb | 2 +- spec/unit/reports_spec.rb | 2 +- spec/unit/resource/catalog_spec.rb | 2 +- spec/unit/resource/status_spec.rb | 2 +- spec/unit/resource/type_collection_helper_spec.rb | 2 +- spec/unit/resource/type_collection_spec.rb | 2 +- spec/unit/resource/type_spec.rb | 2 +- spec/unit/resource_spec.rb | 2 +- spec/unit/run_spec.rb | 2 +- spec/unit/simple_graph_spec.rb | 2 +- spec/unit/ssl/base_spec.rb | 2 +- spec/unit/ssl/certificate_authority/interface_spec.rb | 2 +- spec/unit/ssl/certificate_authority_spec.rb | 2 +- spec/unit/ssl/certificate_factory_spec.rb | 2 +- spec/unit/ssl/certificate_request_spec.rb | 2 +- spec/unit/ssl/certificate_revocation_list_spec.rb | 2 +- spec/unit/ssl/certificate_spec.rb | 2 +- spec/unit/ssl/host_spec.rb | 2 +- spec/unit/ssl/inventory_spec.rb | 2 +- spec/unit/ssl/key_spec.rb | 2 +- spec/unit/sslcertificates/ca_spec.rb | 2 +- spec/unit/status_spec.rb | 2 +- spec/unit/transaction/change_spec.rb | 2 +- spec/unit/transaction/event_manager_spec.rb | 2 +- spec/unit/transaction/event_spec.rb | 2 +- spec/unit/transaction/report_spec.rb | 2 +- spec/unit/transaction/resource_harness_spec.rb | 2 +- spec/unit/transaction_spec.rb | 2 +- spec/unit/type/augeas_spec.rb | 2 +- spec/unit/type/component_spec.rb | 2 +- spec/unit/type/computer_spec.rb | 2 +- spec/unit/type/exec_spec.rb | 2 +- spec/unit/type/file_spec.rb | 2 +- spec/unit/type/filebucket_spec.rb | 2 +- spec/unit/type/group_spec.rb | 2 +- spec/unit/type/host_spec.rb | 2 +- spec/unit/type/macauthorization_spec.rb | 2 +- spec/unit/type/mcx_spec.rb | 2 +- spec/unit/type/mount_spec.rb | 2 +- spec/unit/type/nagios_spec.rb | 2 +- spec/unit/type/noop_metaparam_spec.rb | 2 +- spec/unit/type/package_spec.rb | 2 +- spec/unit/type/resources_spec.rb | 2 +- spec/unit/type/schedule_spec.rb | 2 +- spec/unit/type/service_spec.rb | 2 +- spec/unit/type/ssh_authorized_key_spec.rb | 2 +- spec/unit/type/sshkey_spec.rb | 2 +- spec/unit/type/stage_spec.rb | 2 +- spec/unit/type/tidy_spec.rb | 2 +- spec/unit/type/user_spec.rb | 2 +- spec/unit/type/whit_spec.rb | 2 +- spec/unit/type_spec.rb | 2 +- spec/unit/util/autoload/file_cache_spec.rb | 2 +- spec/unit/util/backups_spec.rb | 2 +- spec/unit/util/cache_accumulator_spec.rb | 2 +- spec/unit/util/cacher_spec.rb | 2 +- spec/unit/util/checksums_spec.rb | 2 +- spec/unit/util/constant_inflector_spec.rb | 2 +- spec/unit/util/ldap/connection_spec.rb | 2 +- spec/unit/util/ldap/generator_spec.rb | 2 +- spec/unit/util/ldap/manager_spec.rb | 2 +- spec/unit/util/loadedfile_spec.rb | 2 +- spec/unit/util/log/destinations_spec.rb | 2 +- spec/unit/util/nagios_maker_spec.rb | 2 +- spec/unit/util/package_spec.rb | 2 +- spec/unit/util/queue/stomp_spec.rb | 2 +- spec/unit/util/queue_spec.rb | 2 +- spec/unit/util/reference_serializer_spec.rb | 2 +- spec/unit/util/resource_template_spec.rb | 2 +- spec/unit/util/run_mode_spec.rb | 2 +- spec/unit/util/selinux_spec.rb | 2 +- spec/unit/util/settings/file_setting_spec.rb | 2 +- spec/unit/util/settings_spec.rb | 2 +- spec/unit/util/storage_spec.rb | 2 +- spec/unit/util/tagging_spec.rb | 2 +- spec/unit/util/warnings_spec.rb | 2 +- test/certmgr/certmgr.rb | 2 +- test/certmgr/inventory.rb | 2 +- test/certmgr/support.rb | 2 +- test/language/ast.rb | 2 +- test/language/ast/variable.rb | 2 +- test/language/functions.rb | 2 +- test/language/parser.rb | 2 +- test/language/scope.rb | 2 +- test/language/snippets.rb | 2 +- test/language/transportable.rb | 2 +- test/network/authconfig.rb | 2 +- test/network/authorization.rb | 2 +- test/network/authstore.rb | 2 +- test/network/client/ca.rb | 2 +- test/network/client/dipper.rb | 2 +- test/network/client_request.rb | 2 +- test/network/handler/ca.rb | 2 +- test/network/handler/fileserver.rb | 2 +- test/network/handler/master.rb | 2 +- test/network/handler/report.rb | 2 +- test/network/handler/runner.rb | 2 +- test/network/rights.rb | 2 +- test/network/server/mongrel_test.rb | 2 +- test/network/server/webrick.rb | 2 +- test/network/xmlrpc/client.rb | 2 +- test/network/xmlrpc/processor.rb | 2 +- test/network/xmlrpc/server.rb | 2 +- test/network/xmlrpc/webrick_servlet.rb | 2 +- test/other/provider.rb | 2 +- test/other/puppet.rb | 2 +- test/other/relationships.rb | 2 +- test/other/report.rb | 2 +- test/other/transactions.rb | 2 +- test/puppet/defaults.rb | 2 +- test/puppet/errortest.rb | 2 +- test/puppet/tc_suidmanager.rb | 2 +- test/rails/rails.rb | 2 +- test/rails/railsparameter.rb | 2 +- test/ral/manager/attributes.rb | 2 +- test/ral/manager/instances.rb | 2 +- test/ral/manager/manager.rb | 2 +- test/ral/manager/provider.rb | 2 +- test/ral/manager/type.rb | 2 +- test/ral/providers/cron/crontab.rb | 2 +- test/ral/providers/group.rb | 2 +- test/ral/providers/host/parsed.rb | 2 +- test/ral/providers/mailalias/aliases.rb | 2 +- test/ral/providers/nameservice.rb | 2 +- test/ral/providers/package.rb | 2 +- test/ral/providers/package/aptitude.rb | 2 +- test/ral/providers/package/aptrpm.rb | 2 +- test/ral/providers/parsedfile.rb | 2 +- test/ral/providers/port/parsed.rb | 2 +- test/ral/providers/provider.rb | 2 +- test/ral/providers/service/base.rb | 2 +- test/ral/providers/sshkey/parsed.rb | 2 +- test/ral/providers/user.rb | 2 +- test/ral/providers/user/useradd.rb | 2 +- test/ral/type/cron.rb | 2 +- test/ral/type/exec.rb | 2 +- test/ral/type/file.rb | 2 +- test/ral/type/file/target.rb | 2 +- test/ral/type/fileignoresource.rb | 2 +- test/ral/type/filesources.rb | 2 +- test/ral/type/host.rb | 2 +- test/ral/type/mailalias.rb | 2 +- test/ral/type/port.rb | 2 +- test/ral/type/resources.rb | 2 +- test/ral/type/service.rb | 2 +- test/ral/type/sshkey.rb | 2 +- test/ral/type/user.rb | 2 +- test/ral/type/yumrepo.rb | 2 +- test/ral/type/zone.rb | 2 +- test/util/classgen.rb | 2 +- test/util/execution.rb | 2 +- test/util/fileparsing.rb | 2 +- test/util/inifile.rb | 2 +- test/util/instance_loader.rb | 2 +- test/util/log.rb | 2 +- test/util/metrics.rb | 2 +- test/util/package.rb | 2 +- test/util/pidlock.rb | 2 +- test/util/settings.rb | 2 +- test/util/storage.rb | 2 +- test/util/subclass_loader.rb | 2 +- test/util/utiltest.rb | 2 +- 434 files changed, 434 insertions(+), 434 deletions(-) diff --git a/spec/integration/application/apply_spec.rb b/spec/integration/application/apply_spec.rb index 840917eff..382449e75 100755 --- a/spec/integration/application/apply_spec.rb +++ b/spec/integration/application/apply_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet_spec/files' diff --git a/spec/integration/application/doc_spec.rb b/spec/integration/application/doc_spec.rb index eaf5442a0..f0b9d7db0 100644 --- a/spec/integration/application/doc_spec.rb +++ b/spec/integration/application/doc_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet_spec/files' describe Puppet::Application::Doc do diff --git a/spec/integration/configurer_spec.rb b/spec/integration/configurer_spec.rb index 71b9652e8..a0a4d732d 100755 --- a/spec/integration/configurer_spec.rb +++ b/spec/integration/configurer_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/configurer' diff --git a/spec/integration/defaults_spec.rb b/spec/integration/defaults_spec.rb index 051f3e528..ee0a43d07 100755 --- a/spec/integration/defaults_spec.rb +++ b/spec/integration/defaults_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/defaults' require 'puppet/rails' diff --git a/spec/integration/file_serving/content_spec.rb b/spec/integration/file_serving/content_spec.rb index 1443b9592..207720d56 100755 --- a/spec/integration/file_serving/content_spec.rb +++ b/spec/integration/file_serving/content_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_serving/content' require 'shared_behaviours/file_serving' diff --git a/spec/integration/file_serving/fileset_spec.rb b/spec/integration/file_serving/fileset_spec.rb index e5afe8f70..f607aa203 100755 --- a/spec/integration/file_serving/fileset_spec.rb +++ b/spec/integration/file_serving/fileset_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_serving/fileset' diff --git a/spec/integration/file_serving/metadata_spec.rb b/spec/integration/file_serving/metadata_spec.rb index 1e67309e5..627369ff8 100755 --- a/spec/integration/file_serving/metadata_spec.rb +++ b/spec/integration/file_serving/metadata_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_serving/metadata' require 'shared_behaviours/file_serving' diff --git a/spec/integration/file_serving/terminus_helper_spec.rb b/spec/integration/file_serving/terminus_helper_spec.rb index 5fd47c954..615b24c87 100755 --- a/spec/integration/file_serving/terminus_helper_spec.rb +++ b/spec/integration/file_serving/terminus_helper_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_serving/terminus_helper' diff --git a/spec/integration/indirector/direct_file_server_spec.rb b/spec/integration/indirector/direct_file_server_spec.rb index 24a55a34f..627733b09 100755 --- a/spec/integration/indirector/direct_file_server_spec.rb +++ b/spec/integration/indirector/direct_file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-19. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/file_content/file' diff --git a/spec/integration/indirector/file_content/file_server_spec.rb b/spec/integration/indirector/file_content/file_server_spec.rb index 2992c40f2..9268ef067 100755 --- a/spec/integration/indirector/file_content/file_server_spec.rb +++ b/spec/integration/indirector/file_content/file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/file_content/file_server' require 'shared_behaviours/file_server_terminus' diff --git a/spec/integration/indirector/file_metadata/file_server_spec.rb b/spec/integration/indirector/file_metadata/file_server_spec.rb index d60012192..069e7af08 100755 --- a/spec/integration/indirector/file_metadata/file_server_spec.rb +++ b/spec/integration/indirector/file_metadata/file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/file_metadata/file_server' require 'shared_behaviours/file_server_terminus' diff --git a/spec/integration/indirector/node/ldap_spec.rb b/spec/integration/indirector/node/ldap_spec.rb index b13f3c033..3da6d0e73 100755 --- a/spec/integration/indirector/node/ldap_spec.rb +++ b/spec/integration/indirector/node/ldap_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/node/ldap' diff --git a/spec/integration/network/client_spec.rb b/spec/integration/network/client_spec.rb index 4bf3ad82b..07a491b1b 100755 --- a/spec/integration/network/client_spec.rb +++ b/spec/integration/network/client_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/client' diff --git a/spec/integration/network/formats_spec.rb b/spec/integration/network/formats_spec.rb index e6cf28abb..44d16790a 100755 --- a/spec/integration/network/formats_spec.rb +++ b/spec/integration/network/formats_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/formats' diff --git a/spec/integration/network/handler_spec.rb b/spec/integration/network/handler_spec.rb index 021f1cedb..a3095c125 100755 --- a/spec/integration/network/handler_spec.rb +++ b/spec/integration/network/handler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/client' diff --git a/spec/integration/network/server/mongrel_spec.rb b/spec/integration/network/server/mongrel_spec.rb index cc90773e6..45e1f8172 100755 --- a/spec/integration/network/server/mongrel_spec.rb +++ b/spec/integration/network/server/mongrel_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/network/server' require 'socket' diff --git a/spec/integration/network/server/webrick_spec.rb b/spec/integration/network/server/webrick_spec.rb index 963e27940..0e1bb4580 100755 --- a/spec/integration/network/server/webrick_spec.rb +++ b/spec/integration/network/server/webrick_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/network/server' require 'puppet/ssl/certificate_authority' require 'socket' diff --git a/spec/integration/node/environment_spec.rb b/spec/integration/node/environment_spec.rb index 8c5153749..abf0108fa 100755 --- a/spec/integration/node/environment_spec.rb +++ b/spec/integration/node/environment_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet_spec/files' diff --git a/spec/integration/node/facts_spec.rb b/spec/integration/node/facts_spec.rb index a555b2044..ee956a6b1 100755 --- a/spec/integration/node/facts_spec.rb +++ b/spec/integration/node/facts_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-4-8. # Copyright (c) 2008. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Node::Facts do describe "when using the indirector" do diff --git a/spec/integration/node_spec.rb b/spec/integration/node_spec.rb index 911a423a0..4c8a2c2b1 100755 --- a/spec/integration/node_spec.rb +++ b/spec/integration/node_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-9-23. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/node' diff --git a/spec/integration/parser/collector_spec.rb b/spec/integration/parser/collector_spec.rb index b1cfc51c7..c72e605cf 100755 --- a/spec/integration/parser/collector_spec.rb +++ b/spec/integration/parser/collector_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/parser/collector' diff --git a/spec/integration/parser/compiler_spec.rb b/spec/integration/parser/compiler_spec.rb index f731692b3..097e8b03a 100755 --- a/spec/integration/parser/compiler_spec.rb +++ b/spec/integration/parser/compiler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Parser::Compiler do before :each do diff --git a/spec/integration/parser/functions/require_spec.rb b/spec/integration/parser/functions/require_spec.rb index 8b3beefe9..737efcce8 100755 --- a/spec/integration/parser/functions/require_spec.rb +++ b/spec/integration/parser/functions/require_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "The require function" do before :each do diff --git a/spec/integration/parser/functions_spec.rb b/spec/integration/parser/functions_spec.rb index cbfb4ac88..504d1fe5e 100644 --- a/spec/integration/parser/functions_spec.rb +++ b/spec/integration/parser/functions_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Parser::Functions do before :each do diff --git a/spec/integration/parser/parser_spec.rb b/spec/integration/parser/parser_spec.rb index 0d9aa51e1..ec084b441 100755 --- a/spec/integration/parser/parser_spec.rb +++ b/spec/integration/parser/parser_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Parser::Parser do module ParseMatcher diff --git a/spec/integration/parser/ruby_manifest_spec.rb b/spec/integration/parser/ruby_manifest_spec.rb index de6f4628c..110898206 100644 --- a/spec/integration/parser/ruby_manifest_spec.rb +++ b/spec/integration/parser/ruby_manifest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'tempfile' require 'puppet_spec/files' diff --git a/spec/integration/provider/mailalias/aliases_spec.rb b/spec/integration/provider/mailalias/aliases_spec.rb index 0511205f2..685cbd29d 100755 --- a/spec/integration/provider/mailalias/aliases_spec.rb +++ b/spec/integration/provider/mailalias/aliases_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppettest/support/utils' require 'puppettest/fileparsing' diff --git a/spec/integration/reports_spec.rb b/spec/integration/reports_spec.rb index 40e5284e1..a721d75d8 100755 --- a/spec/integration/reports_spec.rb +++ b/spec/integration/reports_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-12. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/reports' diff --git a/spec/integration/resource/catalog_spec.rb b/spec/integration/resource/catalog_spec.rb index 206fe909c..a3e40249a 100755 --- a/spec/integration/resource/catalog_spec.rb +++ b/spec/integration/resource/catalog_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-4-8. # Copyright (c) 2008. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Resource::Catalog do describe "when pson is available" do diff --git a/spec/integration/resource/type_collection_spec.rb b/spec/integration/resource/type_collection_spec.rb index 318dd4dd7..f6ba9c7af 100755 --- a/spec/integration/resource/type_collection_spec.rb +++ b/spec/integration/resource/type_collection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet_spec/files' require 'puppet/resource/type_collection' diff --git a/spec/integration/ssl/certificate_authority_spec.rb b/spec/integration/ssl/certificate_authority_spec.rb index 622f7ed01..17b56ea98 100755 --- a/spec/integration/ssl/certificate_authority_spec.rb +++ b/spec/integration/ssl/certificate_authority_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-4-17. # Copyright (c) 2008. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/ssl/certificate_authority' require 'tempfile' diff --git a/spec/integration/ssl/certificate_request_spec.rb b/spec/integration/ssl/certificate_request_spec.rb index d92346bb1..f1040055b 100755 --- a/spec/integration/ssl/certificate_request_spec.rb +++ b/spec/integration/ssl/certificate_request_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-4-17. # Copyright (c) 2008. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/ssl/certificate_request' require 'tempfile' diff --git a/spec/integration/ssl/certificate_revocation_list_spec.rb b/spec/integration/ssl/certificate_revocation_list_spec.rb index 44eee363d..ddf7952f3 100755 --- a/spec/integration/ssl/certificate_revocation_list_spec.rb +++ b/spec/integration/ssl/certificate_revocation_list_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-5-5. # Copyright (c) 2008. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/ssl/certificate_revocation_list' require 'tempfile' diff --git a/spec/integration/ssl/host_spec.rb b/spec/integration/ssl/host_spec.rb index c488eb229..84160b019 100755 --- a/spec/integration/ssl/host_spec.rb +++ b/spec/integration/ssl/host_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-4-17. # Copyright (c) 2008. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/ssl/host' require 'tempfile' diff --git a/spec/integration/transaction/report_spec.rb b/spec/integration/transaction/report_spec.rb index 2afd037c7..09b029267 100755 --- a/spec/integration/transaction/report_spec.rb +++ b/spec/integration/transaction/report_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-4-8. # Copyright (c) 2008. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Transaction::Report do describe "when using the indirector" do diff --git a/spec/integration/transaction_spec.rb b/spec/integration/transaction_spec.rb index d5478d7a7..b5080b5c6 100755 --- a/spec/integration/transaction_spec.rb +++ b/spec/integration/transaction_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet_spec/files' require 'puppet/transaction' diff --git a/spec/integration/type/file_spec.rb b/spec/integration/type/file_spec.rb index 4b91e5ef9..c2702ee7a 100755 --- a/spec/integration/type/file_spec.rb +++ b/spec/integration/type/file_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet_spec/files' diff --git a/spec/integration/type/package_spec.rb b/spec/integration/type/package_spec.rb index c89c18ba1..8e852f261 100755 --- a/spec/integration/type/package_spec.rb +++ b/spec/integration/type/package_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Type.type(:package), "when choosing a default package provider" do before do diff --git a/spec/integration/type/tidy_spec.rb b/spec/integration/type/tidy_spec.rb index 429ba4c57..084ebac6d 100755 --- a/spec/integration/type/tidy_spec.rb +++ b/spec/integration/type/tidy_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet_spec/files' require 'puppet/file_bucket/dipper' diff --git a/spec/integration/type_spec.rb b/spec/integration/type_spec.rb index 957dfe344..62f8fb7d2 100755 --- a/spec/integration/type_spec.rb +++ b/spec/integration/type_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/type' diff --git a/spec/integration/util/settings_spec.rb b/spec/integration/util/settings_spec.rb index 27acd90ee..d3b5ec594 100755 --- a/spec/integration/util/settings_spec.rb +++ b/spec/integration/util/settings_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet_spec/files' diff --git a/spec/spec_specs/runnable_spec.rb b/spec/spec_specs/runnable_spec.rb index da4faca4e..346dfd12d 100644 --- a/spec/spec_specs/runnable_spec.rb +++ b/spec/spec_specs/runnable_spec.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe PuppetTest::RunnableTest do before do diff --git a/spec/unit/agent/locker_spec.rb b/spec/unit/agent/locker_spec.rb index ad54c765a..e7c8929c7 100755 --- a/spec/unit/agent/locker_spec.rb +++ b/spec/unit/agent/locker_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/agent' require 'puppet/agent/locker' diff --git a/spec/unit/agent_spec.rb b/spec/unit/agent_spec.rb index 2b3ee8ca0..a3a54bf7d 100755 --- a/spec/unit/agent_spec.rb +++ b/spec/unit/agent_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-11-12. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/agent' class AgentTestClient diff --git a/spec/unit/application/agent_spec.rb b/spec/unit/application/agent_spec.rb index 151d85a58..cee6a0d1a 100755 --- a/spec/unit/application/agent_spec.rb +++ b/spec/unit/application/agent_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/agent' require 'puppet/application/agent' diff --git a/spec/unit/application/apply_spec.rb b/spec/unit/application/apply_spec.rb index 52b84e6f2..e2b6ff5ab 100755 --- a/spec/unit/application/apply_spec.rb +++ b/spec/unit/application/apply_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/application/apply' require 'puppet/file_bucket/dipper' diff --git a/spec/unit/application/cert_spec.rb b/spec/unit/application/cert_spec.rb index 4663fc938..c7f463ea2 100755 --- a/spec/unit/application/cert_spec.rb +++ b/spec/unit/application/cert_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/application/cert' diff --git a/spec/unit/application/describe_spec.rb b/spec/unit/application/describe_spec.rb index 7c64ff86d..47b98a17b 100755 --- a/spec/unit/application/describe_spec.rb +++ b/spec/unit/application/describe_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/application/describe' diff --git a/spec/unit/application/doc_spec.rb b/spec/unit/application/doc_spec.rb index 55da5e39a..0fd2c2084 100755 --- a/spec/unit/application/doc_spec.rb +++ b/spec/unit/application/doc_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/application/doc' require 'puppet/util/reference' diff --git a/spec/unit/application/filebucket_spec.rb b/spec/unit/application/filebucket_spec.rb index e6272f179..8b811d7c5 100644 --- a/spec/unit/application/filebucket_spec.rb +++ b/spec/unit/application/filebucket_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/application/filebucket' require 'puppet/file_bucket/dipper' diff --git a/spec/unit/application/kick_spec.rb b/spec/unit/application/kick_spec.rb index 5ccf81bd0..227874171 100755 --- a/spec/unit/application/kick_spec.rb +++ b/spec/unit/application/kick_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/application/kick' diff --git a/spec/unit/application/master_spec.rb b/spec/unit/application/master_spec.rb index e97bcb5dc..cf8593108 100644 --- a/spec/unit/application/master_spec.rb +++ b/spec/unit/application/master_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/application/master' require 'puppet/daemon' diff --git a/spec/unit/application/queue_spec.rb b/spec/unit/application/queue_spec.rb index 1c65b558c..2ff9001af 100755 --- a/spec/unit/application/queue_spec.rb +++ b/spec/unit/application/queue_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/application/queue' require 'puppet/indirector/catalog/queue' diff --git a/spec/unit/application/resource_spec.rb b/spec/unit/application/resource_spec.rb index df479ac89..3e3f8296b 100755 --- a/spec/unit/application/resource_spec.rb +++ b/spec/unit/application/resource_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/application/resource' diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index be7cda340..6f1c03b2f 100755 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/application' require 'puppet' diff --git a/spec/unit/configurer/downloader_spec.rb b/spec/unit/configurer/downloader_spec.rb index c57f39fb5..b2485ccc8 100755 --- a/spec/unit/configurer/downloader_spec.rb +++ b/spec/unit/configurer/downloader_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/configurer/downloader' diff --git a/spec/unit/configurer/fact_handler_spec.rb b/spec/unit/configurer/fact_handler_spec.rb index 70918c039..71645225f 100755 --- a/spec/unit/configurer/fact_handler_spec.rb +++ b/spec/unit/configurer/fact_handler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/configurer' require 'puppet/configurer/fact_handler' diff --git a/spec/unit/configurer/plugin_handler_spec.rb b/spec/unit/configurer/plugin_handler_spec.rb index 25d2d47af..27d5a9f06 100755 --- a/spec/unit/configurer/plugin_handler_spec.rb +++ b/spec/unit/configurer/plugin_handler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/configurer' require 'puppet/configurer/plugin_handler' diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index fc718fa58..9f88ee526 100755 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-11-12. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/configurer' describe Puppet::Configurer do diff --git a/spec/unit/daemon_spec.rb b/spec/unit/daemon_spec.rb index e24db7881..282a2bcbf 100755 --- a/spec/unit/daemon_spec.rb +++ b/spec/unit/daemon_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/daemon' def without_warnings diff --git a/spec/unit/dsl/resource_api_spec.rb b/spec/unit/dsl/resource_api_spec.rb index b36a67f30..13aa6a437 100755 --- a/spec/unit/dsl/resource_api_spec.rb +++ b/spec/unit/dsl/resource_api_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/dsl/resource_api' diff --git a/spec/unit/dsl/resource_type_api_spec.rb b/spec/unit/dsl/resource_type_api_spec.rb index c9a5d272f..795ce2868 100755 --- a/spec/unit/dsl/resource_type_api_spec.rb +++ b/spec/unit/dsl/resource_type_api_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/dsl/resource_type_api' diff --git a/spec/unit/file_bucket/dipper_spec.rb b/spec/unit/file_bucket/dipper_spec.rb index 46d314d1f..0c3d00af8 100755 --- a/spec/unit/file_bucket/dipper_spec.rb +++ b/spec/unit/file_bucket/dipper_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_bucket/dipper' describe Puppet::FileBucket::Dipper do diff --git a/spec/unit/file_collection/lookup_spec.rb b/spec/unit/file_collection/lookup_spec.rb index 2454cc833..138949a96 100755 --- a/spec/unit/file_collection/lookup_spec.rb +++ b/spec/unit/file_collection/lookup_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_collection/lookup' class LookupTester diff --git a/spec/unit/file_collection_spec.rb b/spec/unit/file_collection_spec.rb index 08621ccac..09888f425 100755 --- a/spec/unit/file_collection_spec.rb +++ b/spec/unit/file_collection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/file_collection' diff --git a/spec/unit/file_serving/base_spec.rb b/spec/unit/file_serving/base_spec.rb index b939bcaa3..3449c8d0e 100755 --- a/spec/unit/file_serving/base_spec.rb +++ b/spec/unit/file_serving/base_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_serving/base' diff --git a/spec/unit/file_serving/configuration/parser_spec.rb b/spec/unit/file_serving/configuration/parser_spec.rb index 36e721885..46cdc1c45 100755 --- a/spec/unit/file_serving/configuration/parser_spec.rb +++ b/spec/unit/file_serving/configuration/parser_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/file_serving/configuration/parser' diff --git a/spec/unit/file_serving/configuration_spec.rb b/spec/unit/file_serving/configuration_spec.rb index 3e11caa08..3c6113165 100755 --- a/spec/unit/file_serving/configuration_spec.rb +++ b/spec/unit/file_serving/configuration_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_serving/configuration' diff --git a/spec/unit/file_serving/content_spec.rb b/spec/unit/file_serving/content_spec.rb index 92b747448..576cbde1f 100755 --- a/spec/unit/file_serving/content_spec.rb +++ b/spec/unit/file_serving/content_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_serving/content' diff --git a/spec/unit/file_serving/fileset_spec.rb b/spec/unit/file_serving/fileset_spec.rb index 9a90cff15..ba0a98eca 100755 --- a/spec/unit/file_serving/fileset_spec.rb +++ b/spec/unit/file_serving/fileset_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_serving/fileset' diff --git a/spec/unit/file_serving/indirection_hooks_spec.rb b/spec/unit/file_serving/indirection_hooks_spec.rb index 683efa7c1..1c7f55da8 100755 --- a/spec/unit/file_serving/indirection_hooks_spec.rb +++ b/spec/unit/file_serving/indirection_hooks_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_serving/indirection_hooks' diff --git a/spec/unit/file_serving/metadata_spec.rb b/spec/unit/file_serving/metadata_spec.rb index aa0dcd511..58db3a4da 100755 --- a/spec/unit/file_serving/metadata_spec.rb +++ b/spec/unit/file_serving/metadata_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_serving/metadata' diff --git a/spec/unit/file_serving/mount/file_spec.rb b/spec/unit/file_serving/mount/file_spec.rb index 56b4f54f1..792ce951c 100755 --- a/spec/unit/file_serving/mount/file_spec.rb +++ b/spec/unit/file_serving/mount/file_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/file_serving/mount/file' module FileServingMountTesting diff --git a/spec/unit/file_serving/mount/modules_spec.rb b/spec/unit/file_serving/mount/modules_spec.rb index 5450b85ad..1213f4fa5 100755 --- a/spec/unit/file_serving/mount/modules_spec.rb +++ b/spec/unit/file_serving/mount/modules_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/file_serving/mount/modules' describe Puppet::FileServing::Mount::Modules do diff --git a/spec/unit/file_serving/mount/plugins_spec.rb b/spec/unit/file_serving/mount/plugins_spec.rb index b48b52509..6aa9ae927 100755 --- a/spec/unit/file_serving/mount/plugins_spec.rb +++ b/spec/unit/file_serving/mount/plugins_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/file_serving/mount/plugins' describe Puppet::FileServing::Mount::Plugins do diff --git a/spec/unit/file_serving/mount_spec.rb b/spec/unit/file_serving/mount_spec.rb index 6eb0d4d9f..2bfe643f6 100755 --- a/spec/unit/file_serving/mount_spec.rb +++ b/spec/unit/file_serving/mount_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_serving/mount' describe Puppet::FileServing::Mount do diff --git a/spec/unit/file_serving/terminus_helper_spec.rb b/spec/unit/file_serving/terminus_helper_spec.rb index f46da1e1f..36cf0daf3 100755 --- a/spec/unit/file_serving/terminus_helper_spec.rb +++ b/spec/unit/file_serving/terminus_helper_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-22. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_serving/terminus_helper' diff --git a/spec/unit/indirector/active_record_spec.rb b/spec/unit/indirector/active_record_spec.rb index 40af146c8..4765cc5ea 100755 --- a/spec/unit/indirector/active_record_spec.rb +++ b/spec/unit/indirector/active_record_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/rails' require 'puppet/indirector/active_record' diff --git a/spec/unit/indirector/catalog/active_record_spec.rb b/spec/unit/indirector/catalog/active_record_spec.rb index 09e943376..e46f5462a 100755 --- a/spec/unit/indirector/catalog/active_record_spec.rb +++ b/spec/unit/indirector/catalog/active_record_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "Puppet::Resource::Catalog::ActiveRecord" do diff --git a/spec/unit/indirector/catalog/compiler_spec.rb b/spec/unit/indirector/catalog/compiler_spec.rb index c8c53aecc..a2ab0c6f4 100755 --- a/spec/unit/indirector/catalog/compiler_spec.rb +++ b/spec/unit/indirector/catalog/compiler_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-9-23. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/catalog/compiler' require 'puppet/rails' diff --git a/spec/unit/indirector/catalog/queue_spec.rb b/spec/unit/indirector/catalog/queue_spec.rb index 38d40c94a..866113631 100755 --- a/spec/unit/indirector/catalog/queue_spec.rb +++ b/spec/unit/indirector/catalog/queue_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/catalog/queue' diff --git a/spec/unit/indirector/catalog/rest_spec.rb b/spec/unit/indirector/catalog/rest_spec.rb index d61054e16..c887504a2 100755 --- a/spec/unit/indirector/catalog/rest_spec.rb +++ b/spec/unit/indirector/catalog/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/catalog/rest' diff --git a/spec/unit/indirector/catalog/yaml_spec.rb b/spec/unit/indirector/catalog/yaml_spec.rb index 5a30b8268..3bf5b4640 100755 --- a/spec/unit/indirector/catalog/yaml_spec.rb +++ b/spec/unit/indirector/catalog/yaml_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/resource/catalog' require 'puppet/indirector/catalog/yaml' diff --git a/spec/unit/indirector/certificate/ca_spec.rb b/spec/unit/indirector/certificate/ca_spec.rb index 6bf3e26ee..77384ddb8 100755 --- a/spec/unit/indirector/certificate/ca_spec.rb +++ b/spec/unit/indirector/certificate/ca_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/certificate/ca' diff --git a/spec/unit/indirector/certificate/file_spec.rb b/spec/unit/indirector/certificate/file_spec.rb index 6a8e7d8f4..45dd95cb5 100755 --- a/spec/unit/indirector/certificate/file_spec.rb +++ b/spec/unit/indirector/certificate/file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/certificate/file' diff --git a/spec/unit/indirector/certificate/rest_spec.rb b/spec/unit/indirector/certificate/rest_spec.rb index 77b2a67bd..8fd6bff9a 100755 --- a/spec/unit/indirector/certificate/rest_spec.rb +++ b/spec/unit/indirector/certificate/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/certificate/rest' diff --git a/spec/unit/indirector/certificate_request/ca_spec.rb b/spec/unit/indirector/certificate_request/ca_spec.rb index 1bcbc46df..8c25e40f7 100755 --- a/spec/unit/indirector/certificate_request/ca_spec.rb +++ b/spec/unit/indirector/certificate_request/ca_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/certificate_request/ca' diff --git a/spec/unit/indirector/certificate_request/file_spec.rb b/spec/unit/indirector/certificate_request/file_spec.rb index f18ba2ca8..465d55d3c 100755 --- a/spec/unit/indirector/certificate_request/file_spec.rb +++ b/spec/unit/indirector/certificate_request/file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/certificate_request/file' diff --git a/spec/unit/indirector/certificate_request/rest_spec.rb b/spec/unit/indirector/certificate_request/rest_spec.rb index 8b90b46a9..9a8b87439 100755 --- a/spec/unit/indirector/certificate_request/rest_spec.rb +++ b/spec/unit/indirector/certificate_request/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/certificate_request/rest' diff --git a/spec/unit/indirector/certificate_revocation_list/ca_spec.rb b/spec/unit/indirector/certificate_revocation_list/ca_spec.rb index 756185da9..d72a3bb10 100755 --- a/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +++ b/spec/unit/indirector/certificate_revocation_list/ca_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/certificate_revocation_list/ca' diff --git a/spec/unit/indirector/certificate_revocation_list/file_spec.rb b/spec/unit/indirector/certificate_revocation_list/file_spec.rb index 507942a6a..3284bee35 100755 --- a/spec/unit/indirector/certificate_revocation_list/file_spec.rb +++ b/spec/unit/indirector/certificate_revocation_list/file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/certificate_revocation_list/file' diff --git a/spec/unit/indirector/certificate_revocation_list/rest_spec.rb b/spec/unit/indirector/certificate_revocation_list/rest_spec.rb index 8cb32632e..e47a0848c 100755 --- a/spec/unit/indirector/certificate_revocation_list/rest_spec.rb +++ b/spec/unit/indirector/certificate_revocation_list/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/certificate_revocation_list/rest' diff --git a/spec/unit/indirector/code_spec.rb b/spec/unit/indirector/code_spec.rb index 916469a14..452d009f8 100755 --- a/spec/unit/indirector/code_spec.rb +++ b/spec/unit/indirector/code_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/code' describe Puppet::Indirector::Code do diff --git a/spec/unit/indirector/direct_file_server_spec.rb b/spec/unit/indirector/direct_file_server_spec.rb index 0111b5445..8eab4ad76 100755 --- a/spec/unit/indirector/direct_file_server_spec.rb +++ b/spec/unit/indirector/direct_file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-24. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/direct_file_server' diff --git a/spec/unit/indirector/envelope_spec.rb b/spec/unit/indirector/envelope_spec.rb index fb80824c9..2715a2671 100755 --- a/spec/unit/indirector/envelope_spec.rb +++ b/spec/unit/indirector/envelope_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/envelope' describe Puppet::Indirector::Envelope do diff --git a/spec/unit/indirector/exec_spec.rb b/spec/unit/indirector/exec_spec.rb index acad1ea93..c6726d4b9 100755 --- a/spec/unit/indirector/exec_spec.rb +++ b/spec/unit/indirector/exec_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/exec' diff --git a/spec/unit/indirector/facts/active_record_spec.rb b/spec/unit/indirector/facts/active_record_spec.rb index 0bdcfcb77..6e425e9a2 100755 --- a/spec/unit/indirector/facts/active_record_spec.rb +++ b/spec/unit/indirector/facts/active_record_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/rails' require 'puppet/node/facts' diff --git a/spec/unit/indirector/facts/couch_spec.rb b/spec/unit/indirector/facts/couch_spec.rb index c0dd54b8a..82a828785 100644 --- a/spec/unit/indirector/facts/couch_spec.rb +++ b/spec/unit/indirector/facts/couch_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/node/facts' diff --git a/spec/unit/indirector/facts/facter_spec.rb b/spec/unit/indirector/facts/facter_spec.rb index 169440915..3129f5ebf 100755 --- a/spec/unit/indirector/facts/facter_spec.rb +++ b/spec/unit/indirector/facts/facter_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-9-23. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/facts/facter' diff --git a/spec/unit/indirector/facts/rest_spec.rb b/spec/unit/indirector/facts/rest_spec.rb index 19a56921f..03bef4578 100755 --- a/spec/unit/indirector/facts/rest_spec.rb +++ b/spec/unit/indirector/facts/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/facts/rest' diff --git a/spec/unit/indirector/facts/yaml_spec.rb b/spec/unit/indirector/facts/yaml_spec.rb index 37a1bcae0..ae1e97812 100755 --- a/spec/unit/indirector/facts/yaml_spec.rb +++ b/spec/unit/indirector/facts/yaml_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/node/facts' require 'puppet/indirector/facts/yaml' diff --git a/spec/unit/indirector/file_content/file_server_spec.rb b/spec/unit/indirector/file_content/file_server_spec.rb index 326a8c863..5bd88132c 100755 --- a/spec/unit/indirector/file_content/file_server_spec.rb +++ b/spec/unit/indirector/file_content/file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/file_content/file_server' diff --git a/spec/unit/indirector/file_content/file_spec.rb b/spec/unit/indirector/file_content/file_spec.rb index 62c28632e..edead1c70 100755 --- a/spec/unit/indirector/file_content/file_spec.rb +++ b/spec/unit/indirector/file_content/file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/file_content/file' diff --git a/spec/unit/indirector/file_content/rest_spec.rb b/spec/unit/indirector/file_content/rest_spec.rb index 3b2f43f13..cf94d2ffd 100755 --- a/spec/unit/indirector/file_content/rest_spec.rb +++ b/spec/unit/indirector/file_content/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/file_content' diff --git a/spec/unit/indirector/file_metadata/file_server_spec.rb b/spec/unit/indirector/file_metadata/file_server_spec.rb index 98f89c57d..99eb83d7f 100755 --- a/spec/unit/indirector/file_metadata/file_server_spec.rb +++ b/spec/unit/indirector/file_metadata/file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/file_metadata/file_server' diff --git a/spec/unit/indirector/file_metadata/file_spec.rb b/spec/unit/indirector/file_metadata/file_spec.rb index 906b24b3e..74eff5b66 100755 --- a/spec/unit/indirector/file_metadata/file_spec.rb +++ b/spec/unit/indirector/file_metadata/file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-18. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/file_metadata/file' diff --git a/spec/unit/indirector/file_metadata/rest_spec.rb b/spec/unit/indirector/file_metadata/rest_spec.rb index f6e998300..132d90d4f 100755 --- a/spec/unit/indirector/file_metadata/rest_spec.rb +++ b/spec/unit/indirector/file_metadata/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/file_metadata' diff --git a/spec/unit/indirector/file_server_spec.rb b/spec/unit/indirector/file_server_spec.rb index 686f79a24..f3d325b4b 100755 --- a/spec/unit/indirector/file_server_spec.rb +++ b/spec/unit/indirector/file_server_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-10-19. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/file_server' require 'puppet/file_serving/configuration' diff --git a/spec/unit/indirector/file_spec.rb b/spec/unit/indirector/file_spec.rb index 86673f0e2..8fd197eac 100755 --- a/spec/unit/indirector/file_spec.rb +++ b/spec/unit/indirector/file_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/file' diff --git a/spec/unit/indirector/indirection_spec.rb b/spec/unit/indirector/indirection_spec.rb index f49d94f8e..77e55acac 100755 --- a/spec/unit/indirector/indirection_spec.rb +++ b/spec/unit/indirector/indirection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/indirection' diff --git a/spec/unit/indirector/inventory/yaml_spec.rb b/spec/unit/indirector/inventory/yaml_spec.rb index 9f0c54353..a4eb2ab7a 100644 --- a/spec/unit/indirector/inventory/yaml_spec.rb +++ b/spec/unit/indirector/inventory/yaml_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/node/inventory' require 'puppet/indirector/inventory/yaml' diff --git a/spec/unit/indirector/key/ca_spec.rb b/spec/unit/indirector/key/ca_spec.rb index 9ed5df67b..53bd380a6 100755 --- a/spec/unit/indirector/key/ca_spec.rb +++ b/spec/unit/indirector/key/ca_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/key/ca' diff --git a/spec/unit/indirector/key/file_spec.rb b/spec/unit/indirector/key/file_spec.rb index 5037c7f0e..715ceacda 100755 --- a/spec/unit/indirector/key/file_spec.rb +++ b/spec/unit/indirector/key/file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-7. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/key/file' diff --git a/spec/unit/indirector/ldap_spec.rb b/spec/unit/indirector/ldap_spec.rb index 31a3406e9..bafaa207b 100755 --- a/spec/unit/indirector/ldap_spec.rb +++ b/spec/unit/indirector/ldap_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/ldap' diff --git a/spec/unit/indirector/memory_spec.rb b/spec/unit/indirector/memory_spec.rb index 160b4f91d..f9010326f 100755 --- a/spec/unit/indirector/memory_spec.rb +++ b/spec/unit/indirector/memory_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/memory' require 'shared_behaviours/memory_terminus' diff --git a/spec/unit/indirector/node/active_record_spec.rb b/spec/unit/indirector/node/active_record_spec.rb index 3540ef738..6c272a9f8 100755 --- a/spec/unit/indirector/node/active_record_spec.rb +++ b/spec/unit/indirector/node/active_record_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/node' diff --git a/spec/unit/indirector/node/exec_spec.rb b/spec/unit/indirector/node/exec_spec.rb index d214a5ef6..e6d6ccb93 100755 --- a/spec/unit/indirector/node/exec_spec.rb +++ b/spec/unit/indirector/node/exec_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/node/exec' diff --git a/spec/unit/indirector/node/ldap_spec.rb b/spec/unit/indirector/node/ldap_spec.rb index 95ec12c80..5d4086a1a 100755 --- a/spec/unit/indirector/node/ldap_spec.rb +++ b/spec/unit/indirector/node/ldap_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/node/ldap' diff --git a/spec/unit/indirector/node/memory_spec.rb b/spec/unit/indirector/node/memory_spec.rb index 3f1fdb9f0..904ee1259 100755 --- a/spec/unit/indirector/node/memory_spec.rb +++ b/spec/unit/indirector/node/memory_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/node/memory' diff --git a/spec/unit/indirector/node/plain_spec.rb b/spec/unit/indirector/node/plain_spec.rb index 730086296..40d5211db 100755 --- a/spec/unit/indirector/node/plain_spec.rb +++ b/spec/unit/indirector/node/plain_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/node/plain' diff --git a/spec/unit/indirector/node/rest_spec.rb b/spec/unit/indirector/node/rest_spec.rb index 0b20752e5..cb3012efa 100755 --- a/spec/unit/indirector/node/rest_spec.rb +++ b/spec/unit/indirector/node/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/node/rest' diff --git a/spec/unit/indirector/node/yaml_spec.rb b/spec/unit/indirector/node/yaml_spec.rb index 8e19a1230..649bde06d 100755 --- a/spec/unit/indirector/node/yaml_spec.rb +++ b/spec/unit/indirector/node/yaml_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/node' require 'puppet/indirector/node/yaml' diff --git a/spec/unit/indirector/plain_spec.rb b/spec/unit/indirector/plain_spec.rb index 2fb9e4dd3..54c0233f8 100755 --- a/spec/unit/indirector/plain_spec.rb +++ b/spec/unit/indirector/plain_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/plain' describe Puppet::Indirector::Plain do diff --git a/spec/unit/indirector/queue_spec.rb b/spec/unit/indirector/queue_spec.rb index 83e9c771d..803ad5717 100755 --- a/spec/unit/indirector/queue_spec.rb +++ b/spec/unit/indirector/queue_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/queue' class Puppet::Indirector::Queue::TestClient diff --git a/spec/unit/indirector/report/processor_spec.rb b/spec/unit/indirector/report/processor_spec.rb index 5602a271f..adc2638fc 100755 --- a/spec/unit/indirector/report/processor_spec.rb +++ b/spec/unit/indirector/report/processor_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-9-23. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/report/processor' diff --git a/spec/unit/indirector/report/rest_spec.rb b/spec/unit/indirector/report/rest_spec.rb index d0d29f862..67a98e334 100755 --- a/spec/unit/indirector/report/rest_spec.rb +++ b/spec/unit/indirector/report/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/report/rest' diff --git a/spec/unit/indirector/report/yaml_spec.rb b/spec/unit/indirector/report/yaml_spec.rb index 610c9ae43..e75fafe5e 100644 --- a/spec/unit/indirector/report/yaml_spec.rb +++ b/spec/unit/indirector/report/yaml_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/transaction/report' require 'puppet/indirector/report/yaml' diff --git a/spec/unit/indirector/request_spec.rb b/spec/unit/indirector/request_spec.rb index 0b3c2c266..bef56b1e1 100755 --- a/spec/unit/indirector/request_spec.rb +++ b/spec/unit/indirector/request_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/request' describe Puppet::Indirector::Request do diff --git a/spec/unit/indirector/resource/ral_spec.rb b/spec/unit/indirector/resource/ral_spec.rb index a5baef367..43deaa8eb 100644 --- a/spec/unit/indirector/resource/ral_spec.rb +++ b/spec/unit/indirector/resource/ral_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "Puppet::Resource::Ral" do describe "find" do diff --git a/spec/unit/indirector/resource_type/parser_spec.rb b/spec/unit/indirector/resource_type/parser_spec.rb index 5c0d9e04c..739e58b35 100755 --- a/spec/unit/indirector/resource_type/parser_spec.rb +++ b/spec/unit/indirector/resource_type/parser_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/resource_type/parser' diff --git a/spec/unit/indirector/resource_type/rest_spec.rb b/spec/unit/indirector/resource_type/rest_spec.rb index 2486502bc..dceb109b2 100755 --- a/spec/unit/indirector/resource_type/rest_spec.rb +++ b/spec/unit/indirector/resource_type/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/resource_type/rest' diff --git a/spec/unit/indirector/rest_spec.rb b/spec/unit/indirector/rest_spec.rb index 3efbfce97..7298e01dc 100755 --- a/spec/unit/indirector/rest_spec.rb +++ b/spec/unit/indirector/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/rest' describe "a REST http call", :shared => true do diff --git a/spec/unit/indirector/run/local_spec.rb b/spec/unit/indirector/run/local_spec.rb index 2684096d5..cb012a0b0 100644 --- a/spec/unit/indirector/run/local_spec.rb +++ b/spec/unit/indirector/run/local_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/run/local' diff --git a/spec/unit/indirector/run/rest_spec.rb b/spec/unit/indirector/run/rest_spec.rb index 2b2415ab6..cf90caa5b 100755 --- a/spec/unit/indirector/run/rest_spec.rb +++ b/spec/unit/indirector/run/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/indirector/run/rest' diff --git a/spec/unit/indirector/ssl_file_spec.rb b/spec/unit/indirector/ssl_file_spec.rb index 83145cffc..e54b2e9e1 100755 --- a/spec/unit/indirector/ssl_file_spec.rb +++ b/spec/unit/indirector/ssl_file_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-10. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/ssl_file' diff --git a/spec/unit/indirector/terminus_spec.rb b/spec/unit/indirector/terminus_spec.rb index 826b9347a..bc255aa5b 100755 --- a/spec/unit/indirector/terminus_spec.rb +++ b/spec/unit/indirector/terminus_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/defaults' require 'puppet/indirector' require 'puppet/indirector/file' diff --git a/spec/unit/indirector/yaml_spec.rb b/spec/unit/indirector/yaml_spec.rb index 86c13c5a0..35017991b 100755 --- a/spec/unit/indirector/yaml_spec.rb +++ b/spec/unit/indirector/yaml_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/indirector/yaml' diff --git a/spec/unit/indirector_spec.rb b/spec/unit/indirector_spec.rb index 7c193a9aa..7bab426c0 100755 --- a/spec/unit/indirector_spec.rb +++ b/spec/unit/indirector_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/defaults' require 'puppet/indirector' diff --git a/spec/unit/module_spec.rb b/spec/unit/module_spec.rb index c3436dfdd..ad72d88a3 100755 --- a/spec/unit/module_spec.rb +++ b/spec/unit/module_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Puppet::Module do before do diff --git a/spec/unit/network/authconfig_spec.rb b/spec/unit/network/authconfig_spec.rb index e10458b1a..4367e25e6 100755 --- a/spec/unit/network/authconfig_spec.rb +++ b/spec/unit/network/authconfig_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/authconfig' diff --git a/spec/unit/network/authstore_spec.rb b/spec/unit/network/authstore_spec.rb index 094352c63..0b4dd21de 100644 --- a/spec/unit/network/authstore_spec.rb +++ b/spec/unit/network/authstore_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/authconfig' diff --git a/spec/unit/network/client_spec.rb b/spec/unit/network/client_spec.rb index f42bd78b9..820f10f12 100755 --- a/spec/unit/network/client_spec.rb +++ b/spec/unit/network/client_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-24. # Copyright (c) 2008. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/client' diff --git a/spec/unit/network/format_handler_spec.rb b/spec/unit/network/format_handler_spec.rb index 64cca8239..556fada80 100755 --- a/spec/unit/network/format_handler_spec.rb +++ b/spec/unit/network/format_handler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/format_handler' diff --git a/spec/unit/network/format_spec.rb b/spec/unit/network/format_spec.rb index bcb084156..658729e4c 100755 --- a/spec/unit/network/format_spec.rb +++ b/spec/unit/network/format_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/format' diff --git a/spec/unit/network/formats_spec.rb b/spec/unit/network/formats_spec.rb index 7c8e7b1f4..26d64188c 100755 --- a/spec/unit/network/formats_spec.rb +++ b/spec/unit/network/formats_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/formats' diff --git a/spec/unit/network/handler/fileserver_spec.rb b/spec/unit/network/handler/fileserver_spec.rb index b37d4f551..b1306c69e 100644 --- a/spec/unit/network/handler/fileserver_spec.rb +++ b/spec/unit/network/handler/fileserver_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/network/handler/fileserver' diff --git a/spec/unit/network/http/compression_spec.rb b/spec/unit/network/http/compression_spec.rb index b46941f46..96d2eaf46 100644 --- a/spec/unit/network/http/compression_spec.rb +++ b/spec/unit/network/http/compression_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "http compression" do diff --git a/spec/unit/network/http/handler_spec.rb b/spec/unit/network/http/handler_spec.rb index e14b5739d..ff60c78fc 100755 --- a/spec/unit/network/http/handler_spec.rb +++ b/spec/unit/network/http/handler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/network/http/handler' require 'puppet/network/rest_authorization' diff --git a/spec/unit/network/http/mongrel/rest_spec.rb b/spec/unit/network/http/mongrel/rest_spec.rb index 92a81a10b..42ba2d6c1 100755 --- a/spec/unit/network/http/mongrel/rest_spec.rb +++ b/spec/unit/network/http/mongrel/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../../spec_helper') require 'puppet/network/http' diff --git a/spec/unit/network/http/mongrel_spec.rb b/spec/unit/network/http/mongrel_spec.rb index ac3d72bae..573c75888 100755 --- a/spec/unit/network/http/mongrel_spec.rb +++ b/spec/unit/network/http/mongrel_spec.rb @@ -3,7 +3,7 @@ # Created by Rick Bradley on 2007-10-15. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/network/http' describe "Puppet::Network::HTTP::Mongrel", "after initializing" do diff --git a/spec/unit/network/http/rack/rest_spec.rb b/spec/unit/network/http/rack/rest_spec.rb index 96cf84c37..31cba5950 100755 --- a/spec/unit/network/http/rack/rest_spec.rb +++ b/spec/unit/network/http/rack/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../../spec_helper') require 'puppet/network/http/rack' if Puppet.features.rack? require 'puppet/network/http/rack/rest' diff --git a/spec/unit/network/http/rack/xmlrpc_spec.rb b/spec/unit/network/http/rack/xmlrpc_spec.rb index 870438f2c..cc398bf32 100755 --- a/spec/unit/network/http/rack/xmlrpc_spec.rb +++ b/spec/unit/network/http/rack/xmlrpc_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../../spec_helper') require 'puppet/network/handler' require 'puppet/network/http/rack' if Puppet.features.rack? require 'puppet/network/http/rack/xmlrpc' if Puppet.features.rack? diff --git a/spec/unit/network/http/rack_spec.rb b/spec/unit/network/http/rack_spec.rb index 8be9ccb50..66a845a72 100755 --- a/spec/unit/network/http/rack_spec.rb +++ b/spec/unit/network/http/rack_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/network/handler' require 'puppet/network/http/rack' if Puppet.features.rack? diff --git a/spec/unit/network/http/webrick/rest_spec.rb b/spec/unit/network/http/webrick/rest_spec.rb index b00c62dc4..b1491e32e 100755 --- a/spec/unit/network/http/webrick/rest_spec.rb +++ b/spec/unit/network/http/webrick/rest_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../../spec_helper') require 'puppet/network/http' require 'webrick' require 'puppet/network/http/webrick/rest' diff --git a/spec/unit/network/http/webrick_spec.rb b/spec/unit/network/http/webrick_spec.rb index 91a35435a..b27a941ea 100755 --- a/spec/unit/network/http/webrick_spec.rb +++ b/spec/unit/network/http/webrick_spec.rb @@ -3,7 +3,7 @@ # Created by Rick Bradley on 2007-10-15. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/network/handler' require 'puppet/network/http' require 'puppet/network/http/webrick' diff --git a/spec/unit/network/http_pool_spec.rb b/spec/unit/network/http_pool_spec.rb index 8fa7de8f9..2cd96cea4 100755 --- a/spec/unit/network/http_pool_spec.rb +++ b/spec/unit/network/http_pool_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-11-26. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/http_pool' describe Puppet::Network::HttpPool do diff --git a/spec/unit/network/http_spec.rb b/spec/unit/network/http_spec.rb index e1d0d2269..8422e2113 100755 --- a/spec/unit/network/http_spec.rb +++ b/spec/unit/network/http_spec.rb @@ -3,7 +3,7 @@ # Created by Rick Bradley on 2007-10-03. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/http' diff --git a/spec/unit/network/rest_authconfig_spec.rb b/spec/unit/network/rest_authconfig_spec.rb index 10dbb76f6..0479c4ea6 100755 --- a/spec/unit/network/rest_authconfig_spec.rb +++ b/spec/unit/network/rest_authconfig_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/rest_authconfig' diff --git a/spec/unit/network/rights_spec.rb b/spec/unit/network/rights_spec.rb index 969fc189e..fedaae230 100755 --- a/spec/unit/network/rights_spec.rb +++ b/spec/unit/network/rights_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/rights' diff --git a/spec/unit/network/server_spec.rb b/spec/unit/network/server_spec.rb index c2496dcca..2a63cd4ec 100755 --- a/spec/unit/network/server_spec.rb +++ b/spec/unit/network/server_spec.rb @@ -3,7 +3,7 @@ # Created by Rick Bradley on 2007-10-03. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/network/server' require 'puppet/network/handler' diff --git a/spec/unit/node/environment_spec.rb b/spec/unit/node/environment_spec.rb index be2980879..153be5f60 100755 --- a/spec/unit/node/environment_spec.rb +++ b/spec/unit/node/environment_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/node/environment' require 'puppet/util/execution' diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb index de2cd554f..797009ae4 100755 --- a/spec/unit/node/facts_spec.rb +++ b/spec/unit/node/facts_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/node/facts' diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index 725075cb3..ec1b65ee1 100755 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Puppet::Node do describe "when managing its environment" do diff --git a/spec/unit/other/selinux_spec.rb b/spec/unit/other/selinux_spec.rb index 4ec0bba5a..7f908885f 100644 --- a/spec/unit/other/selinux_spec.rb +++ b/spec/unit/other/selinux_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/type/selboolean' require 'puppet/type/selmodule' diff --git a/spec/unit/other/transbucket_spec.rb b/spec/unit/other/transbucket_spec.rb index a5c4b47a4..6bc257897 100755 --- a/spec/unit/other/transbucket_spec.rb +++ b/spec/unit/other/transbucket_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::TransBucket do before do diff --git a/spec/unit/other/transobject_spec.rb b/spec/unit/other/transobject_spec.rb index 352af48fd..c2652a386 100755 --- a/spec/unit/other/transobject_spec.rb +++ b/spec/unit/other/transobject_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/transportable' diff --git a/spec/unit/parameter/value_collection_spec.rb b/spec/unit/parameter/value_collection_spec.rb index cb82d1517..99e4302bc 100755 --- a/spec/unit/parameter/value_collection_spec.rb +++ b/spec/unit/parameter/value_collection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/parameter' diff --git a/spec/unit/parameter/value_spec.rb b/spec/unit/parameter/value_spec.rb index 10b24fb4d..cb44770b4 100755 --- a/spec/unit/parameter/value_spec.rb +++ b/spec/unit/parameter/value_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/parameter' diff --git a/spec/unit/parameter_spec.rb b/spec/unit/parameter_spec.rb index 966bbfb81..835957077 100755 --- a/spec/unit/parameter_spec.rb +++ b/spec/unit/parameter_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/parameter' diff --git a/spec/unit/parser/ast/arithmetic_operator_spec.rb b/spec/unit/parser/ast/arithmetic_operator_spec.rb index 093cf94f1..381c5c629 100755 --- a/spec/unit/parser/ast/arithmetic_operator_spec.rb +++ b/spec/unit/parser/ast/arithmetic_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::ArithmeticOperator do diff --git a/spec/unit/parser/ast/astarray_spec.rb b/spec/unit/parser/ast/astarray_spec.rb index 8794848b6..01082b3f0 100755 --- a/spec/unit/parser/ast/astarray_spec.rb +++ b/spec/unit/parser/ast/astarray_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::ASTArray do before :each do diff --git a/spec/unit/parser/ast/asthash_spec.rb b/spec/unit/parser/ast/asthash_spec.rb index c70553c56..83f604545 100644 --- a/spec/unit/parser/ast/asthash_spec.rb +++ b/spec/unit/parser/ast/asthash_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::ASTHash do before :each do diff --git a/spec/unit/parser/ast/boolean_operator_spec.rb b/spec/unit/parser/ast/boolean_operator_spec.rb index 10e987e31..529946694 100755 --- a/spec/unit/parser/ast/boolean_operator_spec.rb +++ b/spec/unit/parser/ast/boolean_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::BooleanOperator do diff --git a/spec/unit/parser/ast/casestatement_spec.rb b/spec/unit/parser/ast/casestatement_spec.rb index 4d79e54cb..a77c04c43 100755 --- a/spec/unit/parser/ast/casestatement_spec.rb +++ b/spec/unit/parser/ast/casestatement_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::CaseStatement do before :each do diff --git a/spec/unit/parser/ast/collection_spec.rb b/spec/unit/parser/ast/collection_spec.rb index 392a2c0f0..a495bca15 100755 --- a/spec/unit/parser/ast/collection_spec.rb +++ b/spec/unit/parser/ast/collection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::Collection do before :each do diff --git a/spec/unit/parser/ast/collexpr_spec.rb b/spec/unit/parser/ast/collexpr_spec.rb index 01276dfb3..04ce69cd3 100755 --- a/spec/unit/parser/ast/collexpr_spec.rb +++ b/spec/unit/parser/ast/collexpr_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::CollExpr do diff --git a/spec/unit/parser/ast/comparison_operator_spec.rb b/spec/unit/parser/ast/comparison_operator_spec.rb index 931f936df..03c9069cb 100755 --- a/spec/unit/parser/ast/comparison_operator_spec.rb +++ b/spec/unit/parser/ast/comparison_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::ComparisonOperator do before :each do diff --git a/spec/unit/parser/ast/definition_spec.rb b/spec/unit/parser/ast/definition_spec.rb index b7b2c851c..e7f55d258 100644 --- a/spec/unit/parser/ast/definition_spec.rb +++ b/spec/unit/parser/ast/definition_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::Definition do it "should make its context available through an accessor" do diff --git a/spec/unit/parser/ast/function_spec.rb b/spec/unit/parser/ast/function_spec.rb index 38e344157..cd4b0f94e 100644 --- a/spec/unit/parser/ast/function_spec.rb +++ b/spec/unit/parser/ast/function_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::Function do before :each do diff --git a/spec/unit/parser/ast/hostclass_spec.rb b/spec/unit/parser/ast/hostclass_spec.rb index b22eba98b..390490788 100644 --- a/spec/unit/parser/ast/hostclass_spec.rb +++ b/spec/unit/parser/ast/hostclass_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::Hostclass do def ast diff --git a/spec/unit/parser/ast/ifstatement_spec.rb b/spec/unit/parser/ast/ifstatement_spec.rb index 2a9e1e37b..6a2fed22c 100755 --- a/spec/unit/parser/ast/ifstatement_spec.rb +++ b/spec/unit/parser/ast/ifstatement_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::IfStatement do before :each do diff --git a/spec/unit/parser/ast/in_operator_spec.rb b/spec/unit/parser/ast/in_operator_spec.rb index aebe442ab..08c01582e 100644 --- a/spec/unit/parser/ast/in_operator_spec.rb +++ b/spec/unit/parser/ast/in_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/parser/ast/in_operator' diff --git a/spec/unit/parser/ast/leaf_spec.rb b/spec/unit/parser/ast/leaf_spec.rb index a19c24115..2119a27a8 100755 --- a/spec/unit/parser/ast/leaf_spec.rb +++ b/spec/unit/parser/ast/leaf_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::Leaf do before :each do diff --git a/spec/unit/parser/ast/match_operator_spec.rb b/spec/unit/parser/ast/match_operator_spec.rb index d6e998751..f2a68b676 100755 --- a/spec/unit/parser/ast/match_operator_spec.rb +++ b/spec/unit/parser/ast/match_operator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::MatchOperator do before :each do diff --git a/spec/unit/parser/ast/minus_spec.rb b/spec/unit/parser/ast/minus_spec.rb index 108c8812e..339087e80 100755 --- a/spec/unit/parser/ast/minus_spec.rb +++ b/spec/unit/parser/ast/minus_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::Minus do before :each do diff --git a/spec/unit/parser/ast/node_spec.rb b/spec/unit/parser/ast/node_spec.rb index 3e8017de0..c4e20ca67 100644 --- a/spec/unit/parser/ast/node_spec.rb +++ b/spec/unit/parser/ast/node_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::Node do describe "when instantiated" do diff --git a/spec/unit/parser/ast/nop_spec.rb b/spec/unit/parser/ast/nop_spec.rb index 3e493197a..3fa2fc0ee 100755 --- a/spec/unit/parser/ast/nop_spec.rb +++ b/spec/unit/parser/ast/nop_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::Nop do diff --git a/spec/unit/parser/ast/not_spec.rb b/spec/unit/parser/ast/not_spec.rb index 2ef6e0689..31a425132 100755 --- a/spec/unit/parser/ast/not_spec.rb +++ b/spec/unit/parser/ast/not_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::Not do before :each do diff --git a/spec/unit/parser/ast/relationship_spec.rb b/spec/unit/parser/ast/relationship_spec.rb index 2a0f658df..d8bc3a535 100644 --- a/spec/unit/parser/ast/relationship_spec.rb +++ b/spec/unit/parser/ast/relationship_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::Relationship do before do diff --git a/spec/unit/parser/ast/resource_defaults_spec.rb b/spec/unit/parser/ast/resource_defaults_spec.rb index 7843fd9a9..36eb8df5f 100755 --- a/spec/unit/parser/ast/resource_defaults_spec.rb +++ b/spec/unit/parser/ast/resource_defaults_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::ResourceDefaults do diff --git a/spec/unit/parser/ast/resource_override_spec.rb b/spec/unit/parser/ast/resource_override_spec.rb index 637ab41fc..7ca3a7e8c 100755 --- a/spec/unit/parser/ast/resource_override_spec.rb +++ b/spec/unit/parser/ast/resource_override_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::ResourceOverride do diff --git a/spec/unit/parser/ast/resource_reference_spec.rb b/spec/unit/parser/ast/resource_reference_spec.rb index 93419d963..492c25490 100755 --- a/spec/unit/parser/ast/resource_reference_spec.rb +++ b/spec/unit/parser/ast/resource_reference_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::ResourceReference do diff --git a/spec/unit/parser/ast/resource_spec.rb b/spec/unit/parser/ast/resource_spec.rb index 3f7fa229a..b00fee587 100755 --- a/spec/unit/parser/ast/resource_spec.rb +++ b/spec/unit/parser/ast/resource_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::Resource do ast = Puppet::Parser::AST diff --git a/spec/unit/parser/ast/selector_spec.rb b/spec/unit/parser/ast/selector_spec.rb index 42898475f..4c13aa7ba 100755 --- a/spec/unit/parser/ast/selector_spec.rb +++ b/spec/unit/parser/ast/selector_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::Selector do before :each do diff --git a/spec/unit/parser/ast/vardef_spec.rb b/spec/unit/parser/ast/vardef_spec.rb index a90010f5a..9c8b77905 100755 --- a/spec/unit/parser/ast/vardef_spec.rb +++ b/spec/unit/parser/ast/vardef_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe Puppet::Parser::AST::VarDef do before :each do diff --git a/spec/unit/parser/ast_spec.rb b/spec/unit/parser/ast_spec.rb index 29dce2b9c..cdfb51869 100644 --- a/spec/unit/parser/ast_spec.rb +++ b/spec/unit/parser/ast_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/parser/ast' diff --git a/spec/unit/parser/collector_spec.rb b/spec/unit/parser/collector_spec.rb index 908cda63a..ff81795c4 100755 --- a/spec/unit/parser/collector_spec.rb +++ b/spec/unit/parser/collector_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/rails' require 'puppet/parser/collector' diff --git a/spec/unit/parser/compiler_spec.rb b/spec/unit/parser/compiler_spec.rb index 95f3853e2..3a7c0b222 100755 --- a/spec/unit/parser/compiler_spec.rb +++ b/spec/unit/parser/compiler_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') class CompilerTestResource attr_accessor :builtin, :virtual, :evaluated, :type, :title diff --git a/spec/unit/parser/files_spec.rb b/spec/unit/parser/files_spec.rb index 3eb0db07e..525c83697 100644 --- a/spec/unit/parser/files_spec.rb +++ b/spec/unit/parser/files_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/parser/files' diff --git a/spec/unit/parser/functions/defined_spec.rb b/spec/unit/parser/functions/defined_spec.rb index cf3f66e17..0dd1dadb8 100755 --- a/spec/unit/parser/functions/defined_spec.rb +++ b/spec/unit/parser/functions/defined_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the 'defined' function" do diff --git a/spec/unit/parser/functions/extlookup_spec.rb b/spec/unit/parser/functions/extlookup_spec.rb index a3dcaa742..a476dc844 100755 --- a/spec/unit/parser/functions/extlookup_spec.rb +++ b/spec/unit/parser/functions/extlookup_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'tempfile' describe "the extlookup function" do diff --git a/spec/unit/parser/functions/fqdn_rand_spec.rb b/spec/unit/parser/functions/fqdn_rand_spec.rb index 81c12c6a7..151ebac9a 100644 --- a/spec/unit/parser/functions/fqdn_rand_spec.rb +++ b/spec/unit/parser/functions/fqdn_rand_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the fqdn_rand function" do diff --git a/spec/unit/parser/functions/generate_spec.rb b/spec/unit/parser/functions/generate_spec.rb index 27aabe261..12f454210 100755 --- a/spec/unit/parser/functions/generate_spec.rb +++ b/spec/unit/parser/functions/generate_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the generate function" do diff --git a/spec/unit/parser/functions/include_spec.rb b/spec/unit/parser/functions/include_spec.rb index 4f609b055..67227e7d9 100644 --- a/spec/unit/parser/functions/include_spec.rb +++ b/spec/unit/parser/functions/include_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the 'include' function" do diff --git a/spec/unit/parser/functions/inline_template_spec.rb b/spec/unit/parser/functions/inline_template_spec.rb index 62f389e5d..36d53778d 100755 --- a/spec/unit/parser/functions/inline_template_spec.rb +++ b/spec/unit/parser/functions/inline_template_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the inline_template function" do diff --git a/spec/unit/parser/functions/realize_spec.rb b/spec/unit/parser/functions/realize_spec.rb index 82f4fa251..899f69b01 100755 --- a/spec/unit/parser/functions/realize_spec.rb +++ b/spec/unit/parser/functions/realize_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the realize function" do diff --git a/spec/unit/parser/functions/regsubst_spec.rb b/spec/unit/parser/functions/regsubst_spec.rb index 47126dd7a..09aa92d28 100755 --- a/spec/unit/parser/functions/regsubst_spec.rb +++ b/spec/unit/parser/functions/regsubst_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the regsubst function" do diff --git a/spec/unit/parser/functions/require_spec.rb b/spec/unit/parser/functions/require_spec.rb index 49c4bbf74..4afbd5a63 100755 --- a/spec/unit/parser/functions/require_spec.rb +++ b/spec/unit/parser/functions/require_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the require function" do diff --git a/spec/unit/parser/functions/shellquote_spec.rb b/spec/unit/parser/functions/shellquote_spec.rb index 46b9f8d10..c8b0d650d 100755 --- a/spec/unit/parser/functions/shellquote_spec.rb +++ b/spec/unit/parser/functions/shellquote_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the shellquote function" do diff --git a/spec/unit/parser/functions/split_spec.rb b/spec/unit/parser/functions/split_spec.rb index a1c83bb0f..39710003b 100755 --- a/spec/unit/parser/functions/split_spec.rb +++ b/spec/unit/parser/functions/split_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the split function" do diff --git a/spec/unit/parser/functions/sprintf_spec.rb b/spec/unit/parser/functions/sprintf_spec.rb index 01545a879..4f29012b3 100755 --- a/spec/unit/parser/functions/sprintf_spec.rb +++ b/spec/unit/parser/functions/sprintf_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the sprintf function" do diff --git a/spec/unit/parser/functions/tag_spec.rb b/spec/unit/parser/functions/tag_spec.rb index dac134134..e9b5122c7 100755 --- a/spec/unit/parser/functions/tag_spec.rb +++ b/spec/unit/parser/functions/tag_spec.rb @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the 'tag' function" do diff --git a/spec/unit/parser/functions/template_spec.rb b/spec/unit/parser/functions/template_spec.rb index 096b0598e..9dd5cc947 100755 --- a/spec/unit/parser/functions/template_spec.rb +++ b/spec/unit/parser/functions/template_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the template function" do diff --git a/spec/unit/parser/functions/versioncmp_spec.rb b/spec/unit/parser/functions/versioncmp_spec.rb index 380c6307a..2bc7be801 100755 --- a/spec/unit/parser/functions/versioncmp_spec.rb +++ b/spec/unit/parser/functions/versioncmp_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') describe "the versioncmp function" do diff --git a/spec/unit/parser/functions_spec.rb b/spec/unit/parser/functions_spec.rb index 18aee4b65..51e52faee 100644 --- a/spec/unit/parser/functions_spec.rb +++ b/spec/unit/parser/functions_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Parser::Functions do diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb index d52add399..67d75823b 100755 --- a/spec/unit/parser/lexer_spec.rb +++ b/spec/unit/parser/lexer_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/parser/lexer' diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb index ab43194e9..f5df3041c 100755 --- a/spec/unit/parser/parser_spec.rb +++ b/spec/unit/parser/parser_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Parser do diff --git a/spec/unit/parser/relationship_spec.rb b/spec/unit/parser/relationship_spec.rb index 57f1a772b..883a38d11 100644 --- a/spec/unit/parser/relationship_spec.rb +++ b/spec/unit/parser/relationship_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/parser/relationship' diff --git a/spec/unit/parser/resource_spec.rb b/spec/unit/parser/resource_spec.rb index dae22fcaa..73c4412dd 100755 --- a/spec/unit/parser/resource_spec.rb +++ b/spec/unit/parser/resource_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') # LAK: FIXME This is just new tests for resources; I have # not moved all tests over yet. diff --git a/spec/unit/parser/scope_spec.rb b/spec/unit/parser/scope_spec.rb index 2e390a53b..32a87f1f4 100755 --- a/spec/unit/parser/scope_spec.rb +++ b/spec/unit/parser/scope_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Parser::Scope do before :each do diff --git a/spec/unit/parser/templatewrapper_spec.rb b/spec/unit/parser/templatewrapper_spec.rb index 68d90a1cc..aab169348 100755 --- a/spec/unit/parser/templatewrapper_spec.rb +++ b/spec/unit/parser/templatewrapper_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/parser/templatewrapper' describe Puppet::Parser::TemplateWrapper do diff --git a/spec/unit/parser/type_loader_spec.rb b/spec/unit/parser/type_loader_spec.rb index cfa68871d..bd41adfb6 100644 --- a/spec/unit/parser/type_loader_spec.rb +++ b/spec/unit/parser/type_loader_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/parser/type_loader' require 'puppet_spec/files' diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb index 56e643b1a..602d3c66b 100755 --- a/spec/unit/property_spec.rb +++ b/spec/unit/property_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/property' describe Puppet::Property do diff --git a/spec/unit/provider/augeas/augeas_spec.rb b/spec/unit/provider/augeas/augeas_spec.rb index 0cedbdbc3..9fcc85660 100644 --- a/spec/unit/provider/augeas/augeas_spec.rb +++ b/spec/unit/provider/augeas/augeas_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:augeas).provider(:augeas) diff --git a/spec/unit/provider/confine/exists_spec.rb b/spec/unit/provider/confine/exists_spec.rb index f039208b8..1dabafb19 100755 --- a/spec/unit/provider/confine/exists_spec.rb +++ b/spec/unit/provider/confine/exists_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/provider/confine/exists' diff --git a/spec/unit/provider/confine/false_spec.rb b/spec/unit/provider/confine/false_spec.rb index 999fc4714..8ea4bf740 100755 --- a/spec/unit/provider/confine/false_spec.rb +++ b/spec/unit/provider/confine/false_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/provider/confine/false' diff --git a/spec/unit/provider/confine/feature_spec.rb b/spec/unit/provider/confine/feature_spec.rb index e8368efac..534c8c14a 100755 --- a/spec/unit/provider/confine/feature_spec.rb +++ b/spec/unit/provider/confine/feature_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/provider/confine/feature' diff --git a/spec/unit/provider/confine/true_spec.rb b/spec/unit/provider/confine/true_spec.rb index 23041e6d5..b23373b87 100755 --- a/spec/unit/provider/confine/true_spec.rb +++ b/spec/unit/provider/confine/true_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/provider/confine/true' diff --git a/spec/unit/provider/confine/variable_spec.rb b/spec/unit/provider/confine/variable_spec.rb index eda2dd4c5..083573c3a 100755 --- a/spec/unit/provider/confine/variable_spec.rb +++ b/spec/unit/provider/confine/variable_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/provider/confine/variable' diff --git a/spec/unit/provider/confine_collection_spec.rb b/spec/unit/provider/confine_collection_spec.rb index e5f7f0300..fc68ef7f6 100755 --- a/spec/unit/provider/confine_collection_spec.rb +++ b/spec/unit/provider/confine_collection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/provider/confine_collection' diff --git a/spec/unit/provider/confine_spec.rb b/spec/unit/provider/confine_spec.rb index 1fa7f3d11..ce969eded 100755 --- a/spec/unit/provider/confine_spec.rb +++ b/spec/unit/provider/confine_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/provider/confine' diff --git a/spec/unit/provider/confiner_spec.rb b/spec/unit/provider/confiner_spec.rb index d513c7232..15e2e6129 100755 --- a/spec/unit/provider/confiner_spec.rb +++ b/spec/unit/provider/confiner_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/provider/confiner' diff --git a/spec/unit/provider/group/groupadd_spec.rb b/spec/unit/provider/group/groupadd_spec.rb index 33d9acd98..41431fb59 100755 --- a/spec/unit/provider/group/groupadd_spec.rb +++ b/spec/unit/provider/group/groupadd_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:group).provider(:groupadd) diff --git a/spec/unit/provider/group/ldap_spec.rb b/spec/unit/provider/group/ldap_spec.rb index b8c54be94..8454b9604 100755 --- a/spec/unit/provider/group/ldap_spec.rb +++ b/spec/unit/provider/group/ldap_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-10. # Copyright (c) 2006. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:group).provider(:ldap) diff --git a/spec/unit/provider/host/parsed_spec.rb b/spec/unit/provider/host/parsed_spec.rb index 239e3bd86..3e00a2190 100644 --- a/spec/unit/provider/host/parsed_spec.rb +++ b/spec/unit/provider/host/parsed_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet_spec/files' require 'puppettest/support/utils' diff --git a/spec/unit/provider/ldap_spec.rb b/spec/unit/provider/ldap_spec.rb index 588cafc1f..7ed289c62 100755 --- a/spec/unit/provider/ldap_spec.rb +++ b/spec/unit/provider/ldap_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-21. # Copyright (c) 2006. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/provider/ldap' diff --git a/spec/unit/provider/macauthorization_spec.rb b/spec/unit/provider/macauthorization_spec.rb index d9e04e957..3c74334ba 100755 --- a/spec/unit/provider/macauthorization_spec.rb +++ b/spec/unit/provider/macauthorization_spec.rb @@ -3,7 +3,7 @@ # Unit testing for the macauthorization provider # -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet' require 'facter/util/plist' diff --git a/spec/unit/provider/mcx/mcxcontent_spec.rb b/spec/unit/provider/mcx/mcxcontent_spec.rb index d3fb043b6..82dbf9ac7 100755 --- a/spec/unit/provider/mcx/mcxcontent_spec.rb +++ b/spec/unit/provider/mcx/mcxcontent_spec.rb @@ -18,7 +18,7 @@ # Author: Jeff McCune -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:mcx).provider(:mcxcontent) diff --git a/spec/unit/provider/mount/parsed_spec.rb b/spec/unit/provider/mount/parsed_spec.rb index 7d2e8a84c..a9d00e9d4 100755 --- a/spec/unit/provider/mount/parsed_spec.rb +++ b/spec/unit/provider/mount/parsed_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-9-12. # Copyright (c) 2006. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppettest/support/utils' require 'puppettest/fileparsing' diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb index b034214ee..9ce03f6f0 100755 --- a/spec/unit/provider/mount_spec.rb +++ b/spec/unit/provider/mount_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/provider/mount' diff --git a/spec/unit/provider/naginator_spec.rb b/spec/unit/provider/naginator_spec.rb index 72195756c..8ae1895cc 100755 --- a/spec/unit/provider/naginator_spec.rb +++ b/spec/unit/provider/naginator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/provider/naginator' diff --git a/spec/unit/provider/package/aix_spec.rb b/spec/unit/provider/package/aix_spec.rb index 26732a3f0..40e497c27 100755 --- a/spec/unit/provider/package/aix_spec.rb +++ b/spec/unit/provider/package/aix_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:package).provider(:aix) diff --git a/spec/unit/provider/package/gem_spec.rb b/spec/unit/provider/package/gem_spec.rb index 063e1474b..7c0d34d00 100644 --- a/spec/unit/provider/package/gem_spec.rb +++ b/spec/unit/provider/package/gem_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:package).provider(:gem) diff --git a/spec/unit/provider/package/hpux_spec.rb b/spec/unit/provider/package/hpux_spec.rb index e4ac22e21..e75ae0822 100644 --- a/spec/unit/provider/package/hpux_spec.rb +++ b/spec/unit/provider/package/hpux_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:package).provider(:hpux) diff --git a/spec/unit/provider/package/nim_spec.rb b/spec/unit/provider/package/nim_spec.rb index 53a9cc839..74f903813 100755 --- a/spec/unit/provider/package/nim_spec.rb +++ b/spec/unit/provider/package/nim_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:package).provider(:nim) diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb index f6a99aa78..4e2294a77 100644 --- a/spec/unit/provider/package/yum_spec.rb +++ b/spec/unit/provider/package/yum_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider = Puppet::Type.type(:package).provider(:yum) diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb index 5ac13b659..1bf27ad97 100644 --- a/spec/unit/provider/package/zypper_spec.rb +++ b/spec/unit/provider/package/zypper_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:package).provider(:zypper) diff --git a/spec/unit/provider/parsedfile_spec.rb b/spec/unit/provider/parsedfile_spec.rb index d40f77370..7d95ef1d0 100755 --- a/spec/unit/provider/parsedfile_spec.rb +++ b/spec/unit/provider/parsedfile_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/provider/parsedfile' diff --git a/spec/unit/provider/service/daemontools_spec.rb b/spec/unit/provider/service/daemontools_spec.rb index 5e8b8d055..0bdb0a85d 100755 --- a/spec/unit/provider/service/daemontools_spec.rb +++ b/spec/unit/provider/service/daemontools_spec.rb @@ -4,7 +4,7 @@ # # author Brice Figureau # -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:service).provider(:daemontools) diff --git a/spec/unit/provider/service/debian_spec.rb b/spec/unit/provider/service/debian_spec.rb index 8dee2ee94..8c9522deb 100755 --- a/spec/unit/provider/service/debian_spec.rb +++ b/spec/unit/provider/service/debian_spec.rb @@ -3,7 +3,7 @@ # Unit testing for the debian service provider # -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:service).provider(:debian) diff --git a/spec/unit/provider/service/freebsd_spec.rb b/spec/unit/provider/service/freebsd_spec.rb index 0330adbed..d8b751108 100644 --- a/spec/unit/provider/service/freebsd_spec.rb +++ b/spec/unit/provider/service/freebsd_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:service).provider(:freebsd) diff --git a/spec/unit/provider/service/init_spec.rb b/spec/unit/provider/service/init_spec.rb index bbc88ff76..9e81258fe 100755 --- a/spec/unit/provider/service/init_spec.rb +++ b/spec/unit/provider/service/init_spec.rb @@ -3,7 +3,7 @@ # Unit testing for the Init service Provider # -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:service).provider(:init) diff --git a/spec/unit/provider/service/launchd_spec.rb b/spec/unit/provider/service/launchd_spec.rb index 43e4cba8e..dfcb58fdc 100755 --- a/spec/unit/provider/service/launchd_spec.rb +++ b/spec/unit/provider/service/launchd_spec.rb @@ -3,7 +3,7 @@ # Unit testing for the launchd service provider # -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet' diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb index fd5822788..a3c6247dd 100755 --- a/spec/unit/provider/service/redhat_spec.rb +++ b/spec/unit/provider/service/redhat_spec.rb @@ -2,7 +2,7 @@ # # Unit testing for the RedHat service Provider # -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:service).provider(:redhat) diff --git a/spec/unit/provider/service/runit_spec.rb b/spec/unit/provider/service/runit_spec.rb index 80ce456b4..12dfeeb35 100755 --- a/spec/unit/provider/service/runit_spec.rb +++ b/spec/unit/provider/service/runit_spec.rb @@ -4,7 +4,7 @@ # # author Brice Figureau # -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:service).provider(:runit) diff --git a/spec/unit/provider/service/src_spec.rb b/spec/unit/provider/service/src_spec.rb index eff98f030..dbe073513 100755 --- a/spec/unit/provider/service/src_spec.rb +++ b/spec/unit/provider/service/src_spec.rb @@ -3,7 +3,7 @@ # Unit testing for the AIX System Resource Controller (src) provider # -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:service).provider(:src) diff --git a/spec/unit/provider/service/upstart.rb b/spec/unit/provider/service/upstart.rb index 9fde9e67f..22cf2bdeb 100644 --- a/spec/unit/provider/service/upstart.rb +++ b/spec/unit/provider/service/upstart.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:service).provider(:upstart) diff --git a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb index 11e9233e0..fb4c64926 100755 --- a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +++ b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet_spec/files' require 'puppettest/support/utils' diff --git a/spec/unit/provider/sshkey/parsed_spec.rb b/spec/unit/provider/sshkey/parsed_spec.rb index 1a5470974..7a76b02d6 100755 --- a/spec/unit/provider/sshkey/parsed_spec.rb +++ b/spec/unit/provider/sshkey/parsed_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:sshkey).provider(:parsed) diff --git a/spec/unit/provider/user/hpux_spec.rb b/spec/unit/provider/user/hpux_spec.rb index f53f6c31e..b10f2847c 100755 --- a/spec/unit/provider/user/hpux_spec.rb +++ b/spec/unit/provider/user/hpux_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:user).provider(:hpuxuseradd) diff --git a/spec/unit/provider/user/ldap_spec.rb b/spec/unit/provider/user/ldap_spec.rb index b6635705d..5b2dc98b5 100755 --- a/spec/unit/provider/user/ldap_spec.rb +++ b/spec/unit/provider/user/ldap_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-10. # Copyright (c) 2006. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:user).provider(:ldap) diff --git a/spec/unit/provider/user/user_role_add_spec.rb b/spec/unit/provider/user/user_role_add_spec.rb index 9cf649267..9cd0feb12 100644 --- a/spec/unit/provider/user/user_role_add_spec.rb +++ b/spec/unit/provider/user/user_role_add_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:user).provider(:user_role_add) diff --git a/spec/unit/provider/user/useradd_spec.rb b/spec/unit/provider/user/useradd_spec.rb index 9ebba596c..f9babe6aa 100755 --- a/spec/unit/provider/user/useradd_spec.rb +++ b/spec/unit/provider/user/useradd_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:user).provider(:useradd) diff --git a/spec/unit/provider/zfs/solaris_spec.rb b/spec/unit/provider/zfs/solaris_spec.rb index 43a88b1c7..75f1605cf 100755 --- a/spec/unit/provider/zfs/solaris_spec.rb +++ b/spec/unit/provider/zfs/solaris_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:zfs).provider(:solaris) diff --git a/spec/unit/provider/zone/solaris_spec.rb b/spec/unit/provider/zone/solaris_spec.rb index 44416aa61..4a1d03272 100755 --- a/spec/unit/provider/zone/solaris_spec.rb +++ b/spec/unit/provider/zone/solaris_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:zone).provider(:solaris) diff --git a/spec/unit/provider/zpool/solaris_spec.rb b/spec/unit/provider/zpool/solaris_spec.rb index 99e6997e4..805dd54df 100755 --- a/spec/unit/provider/zpool/solaris_spec.rb +++ b/spec/unit/provider/zpool/solaris_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') provider_class = Puppet::Type.type(:zpool).provider(:solaris) diff --git a/spec/unit/provider_spec.rb b/spec/unit/provider_spec.rb index 629406535..24f5216fe 100755 --- a/spec/unit/provider_spec.rb +++ b/spec/unit/provider_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Puppet::Provider do it "should have a specifity class method" do diff --git a/spec/unit/puppet_spec.rb b/spec/unit/puppet_spec.rb index 60ac9e9d9..28dbd5104 100755 --- a/spec/unit/puppet_spec.rb +++ b/spec/unit/puppet_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby" -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet' describe Puppet do diff --git a/spec/unit/rails/host_spec.rb b/spec/unit/rails/host_spec.rb index 324a673a9..9883a7db5 100755 --- a/spec/unit/rails/host_spec.rb +++ b/spec/unit/rails/host_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe "Puppet::Rails::Host" do confine "Cannot test without ActiveRecord" => Puppet.features.rails? diff --git a/spec/unit/rails/param_value_spec.rb b/spec/unit/rails/param_value_spec.rb index 243456e89..f36f2427c 100755 --- a/spec/unit/rails/param_value_spec.rb +++ b/spec/unit/rails/param_value_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/rails' describe "Puppet::Rails::ParamValue" do diff --git a/spec/unit/rails/resource_spec.rb b/spec/unit/rails/resource_spec.rb index 6e23d2020..277996b38 100755 --- a/spec/unit/rails/resource_spec.rb +++ b/spec/unit/rails/resource_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/rails' describe "Puppet::Rails::Resource" do diff --git a/spec/unit/rails_spec.rb b/spec/unit/rails_spec.rb index 24248e622..71ede5ac1 100755 --- a/spec/unit/rails_spec.rb +++ b/spec/unit/rails_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/rails' describe Puppet::Rails, "when initializing any connection" do diff --git a/spec/unit/relationship_spec.rb b/spec/unit/relationship_spec.rb index 4586cd0f3..a72966a2d 100755 --- a/spec/unit/relationship_spec.rb +++ b/spec/unit/relationship_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-11-1. # Copyright (c) 2006. All rights reserved. -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/relationship' describe Puppet::Relationship do diff --git a/spec/unit/reports_spec.rb b/spec/unit/reports_spec.rb index 57e77a546..a9d10be17 100755 --- a/spec/unit/reports_spec.rb +++ b/spec/unit/reports_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/reports' diff --git a/spec/unit/resource/catalog_spec.rb b/spec/unit/resource/catalog_spec.rb index 672bb8ffc..1af48a5c9 100755 --- a/spec/unit/resource/catalog_spec.rb +++ b/spec/unit/resource/catalog_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Resource::Catalog, "when compiling" do diff --git a/spec/unit/resource/status_spec.rb b/spec/unit/resource/status_spec.rb index 425015a13..ce83e5d47 100755 --- a/spec/unit/resource/status_spec.rb +++ b/spec/unit/resource/status_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/resource/status' diff --git a/spec/unit/resource/type_collection_helper_spec.rb b/spec/unit/resource/type_collection_helper_spec.rb index 608b6e61f..442cfd076 100644 --- a/spec/unit/resource/type_collection_helper_spec.rb +++ b/spec/unit/resource/type_collection_helper_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/resource/type_collection_helper' diff --git a/spec/unit/resource/type_collection_spec.rb b/spec/unit/resource/type_collection_spec.rb index b8da3cf58..278e629bd 100644 --- a/spec/unit/resource/type_collection_spec.rb +++ b/spec/unit/resource/type_collection_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/resource/type_collection' require 'puppet/resource/type' diff --git a/spec/unit/resource/type_spec.rb b/spec/unit/resource/type_spec.rb index ef45712e6..a22dc3572 100755 --- a/spec/unit/resource/type_spec.rb +++ b/spec/unit/resource/type_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/resource/type' diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index e65e8a13a..8be3ec9ee 100755 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/resource' describe Puppet::Resource do diff --git a/spec/unit/run_spec.rb b/spec/unit/run_spec.rb index 58a16d2a6..6c5ecde65 100755 --- a/spec/unit/run_spec.rb +++ b/spec/unit/run_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/agent' require 'puppet/run' diff --git a/spec/unit/simple_graph_spec.rb b/spec/unit/simple_graph_spec.rb index fa0bcb06a..e49811ea7 100755 --- a/spec/unit/simple_graph_spec.rb +++ b/spec/unit/simple_graph_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-11-1. # Copyright (c) 2006. All rights reserved. -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/simple_graph' describe Puppet::SimpleGraph do diff --git a/spec/unit/ssl/base_spec.rb b/spec/unit/ssl/base_spec.rb index 47575feab..99038391f 100755 --- a/spec/unit/ssl/base_spec.rb +++ b/spec/unit/ssl/base_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/ssl/certificate' diff --git a/spec/unit/ssl/certificate_authority/interface_spec.rb b/spec/unit/ssl/certificate_authority/interface_spec.rb index d8c351ae2..7eeb2c067 100755 --- a/spec/unit/ssl/certificate_authority/interface_spec.rb +++ b/spec/unit/ssl/certificate_authority/interface_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/ssl/certificate_authority' diff --git a/spec/unit/ssl/certificate_authority_spec.rb b/spec/unit/ssl/certificate_authority_spec.rb index 7198e33ad..76633b48f 100755 --- a/spec/unit/ssl/certificate_authority_spec.rb +++ b/spec/unit/ssl/certificate_authority_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/ssl/certificate_authority' diff --git a/spec/unit/ssl/certificate_factory_spec.rb b/spec/unit/ssl/certificate_factory_spec.rb index de2093810..c2bcb19ce 100755 --- a/spec/unit/ssl/certificate_factory_spec.rb +++ b/spec/unit/ssl/certificate_factory_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/ssl/certificate_factory' diff --git a/spec/unit/ssl/certificate_request_spec.rb b/spec/unit/ssl/certificate_request_spec.rb index 3a2130765..32c9cb51d 100755 --- a/spec/unit/ssl/certificate_request_spec.rb +++ b/spec/unit/ssl/certificate_request_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/ssl/certificate_request' require 'puppet/ssl/key' diff --git a/spec/unit/ssl/certificate_revocation_list_spec.rb b/spec/unit/ssl/certificate_revocation_list_spec.rb index 3bf12fa0a..e83ad9cc5 100755 --- a/spec/unit/ssl/certificate_revocation_list_spec.rb +++ b/spec/unit/ssl/certificate_revocation_list_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/ssl/certificate_revocation_list' diff --git a/spec/unit/ssl/certificate_spec.rb b/spec/unit/ssl/certificate_spec.rb index 842aa35c5..b3af9f236 100755 --- a/spec/unit/ssl/certificate_spec.rb +++ b/spec/unit/ssl/certificate_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/ssl/certificate' diff --git a/spec/unit/ssl/host_spec.rb b/spec/unit/ssl/host_spec.rb index 77911091e..d8f15e738 100755 --- a/spec/unit/ssl/host_spec.rb +++ b/spec/unit/ssl/host_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/ssl/host' diff --git a/spec/unit/ssl/inventory_spec.rb b/spec/unit/ssl/inventory_spec.rb index 008fece0b..4d47a37c6 100755 --- a/spec/unit/ssl/inventory_spec.rb +++ b/spec/unit/ssl/inventory_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/ssl/inventory' diff --git a/spec/unit/ssl/key_spec.rb b/spec/unit/ssl/key_spec.rb index 58193db28..e0667a5cc 100755 --- a/spec/unit/ssl/key_spec.rb +++ b/spec/unit/ssl/key_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/ssl/key' diff --git a/spec/unit/sslcertificates/ca_spec.rb b/spec/unit/sslcertificates/ca_spec.rb index b1393b25d..4e44f2d90 100644 --- a/spec/unit/sslcertificates/ca_spec.rb +++ b/spec/unit/sslcertificates/ca_spec.rb @@ -1,5 +1,5 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet' require 'puppet/sslcertificates' diff --git a/spec/unit/status_spec.rb b/spec/unit/status_spec.rb index 938bbdf84..3a9c805b3 100644 --- a/spec/unit/status_spec.rb +++ b/spec/unit/status_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Puppet::Status do it "should implement find" do diff --git a/spec/unit/transaction/change_spec.rb b/spec/unit/transaction/change_spec.rb index e443e3baa..eea7ad4e0 100755 --- a/spec/unit/transaction/change_spec.rb +++ b/spec/unit/transaction/change_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/transaction/change' diff --git a/spec/unit/transaction/event_manager_spec.rb b/spec/unit/transaction/event_manager_spec.rb index eeb3d3389..e45fbdf78 100755 --- a/spec/unit/transaction/event_manager_spec.rb +++ b/spec/unit/transaction/event_manager_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/transaction/event_manager' diff --git a/spec/unit/transaction/event_spec.rb b/spec/unit/transaction/event_spec.rb index 9cf6bc165..9128e8541 100755 --- a/spec/unit/transaction/event_spec.rb +++ b/spec/unit/transaction/event_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/transaction/event' diff --git a/spec/unit/transaction/report_spec.rb b/spec/unit/transaction/report_spec.rb index 1f1fdb080..0cce9d14e 100755 --- a/spec/unit/transaction/report_spec.rb +++ b/spec/unit/transaction/report_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/transaction/report' diff --git a/spec/unit/transaction/resource_harness_spec.rb b/spec/unit/transaction/resource_harness_spec.rb index 255481ae4..bf708910c 100755 --- a/spec/unit/transaction/resource_harness_spec.rb +++ b/spec/unit/transaction/resource_harness_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/transaction/resource_harness' diff --git a/spec/unit/transaction_spec.rb b/spec/unit/transaction_spec.rb index 2df4404be..b5341e499 100755 --- a/spec/unit/transaction_spec.rb +++ b/spec/unit/transaction_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require 'puppet/transaction' diff --git a/spec/unit/type/augeas_spec.rb b/spec/unit/type/augeas_spec.rb index e426fbeed..2332bb0b6 100644 --- a/spec/unit/type/augeas_spec.rb +++ b/spec/unit/type/augeas_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') augeas = Puppet::Type.type(:augeas) diff --git a/spec/unit/type/component_spec.rb b/spec/unit/type/component_spec.rb index f7403e5e3..60abfafbf 100755 --- a/spec/unit/type/component_spec.rb +++ b/spec/unit/type/component_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') component = Puppet::Type.type(:component) diff --git a/spec/unit/type/computer_spec.rb b/spec/unit/type/computer_spec.rb index 1f1c55b2f..3177884f7 100755 --- a/spec/unit/type/computer_spec.rb +++ b/spec/unit/type/computer_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') computer = Puppet::Type.type(:computer) diff --git a/spec/unit/type/exec_spec.rb b/spec/unit/type/exec_spec.rb index e04cfc065..e980ec542 100755 --- a/spec/unit/type/exec_spec.rb +++ b/spec/unit/type/exec_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Type.type(:exec) do diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb index 943a3c38a..fd564409f 100755 --- a/spec/unit/type/file_spec.rb +++ b/spec/unit/type/file_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Type.type(:file) do before do diff --git a/spec/unit/type/filebucket_spec.rb b/spec/unit/type/filebucket_spec.rb index 0b8ea50f8..7fcbacc4f 100644 --- a/spec/unit/type/filebucket_spec.rb +++ b/spec/unit/type/filebucket_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Type.type(:filebucket) do describe "when validating attributes" do diff --git a/spec/unit/type/group_spec.rb b/spec/unit/type/group_spec.rb index b41ce71a0..43fdfcd4d 100755 --- a/spec/unit/type/group_spec.rb +++ b/spec/unit/type/group_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Type.type(:group) do before do diff --git a/spec/unit/type/host_spec.rb b/spec/unit/type/host_spec.rb index 12ae2af08..36ef460c1 100755 --- a/spec/unit/type/host_spec.rb +++ b/spec/unit/type/host_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') ssh_authorized_key = Puppet::Type.type(:ssh_authorized_key) diff --git a/spec/unit/type/macauthorization_spec.rb b/spec/unit/type/macauthorization_spec.rb index 544f07f4b..e0d3b9433 100755 --- a/spec/unit/type/macauthorization_spec.rb +++ b/spec/unit/type/macauthorization_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') macauth_type = Puppet::Type.type(:macauthorization) diff --git a/spec/unit/type/mcx_spec.rb b/spec/unit/type/mcx_spec.rb index 703ecb473..4b60a5c96 100755 --- a/spec/unit/type/mcx_spec.rb +++ b/spec/unit/type/mcx_spec.rb @@ -20,7 +20,7 @@ # Most of this code copied from /spec/type/service.rb -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/type/mcx' diff --git a/spec/unit/type/mount_spec.rb b/spec/unit/type/mount_spec.rb index 4aa9baf70..934c6f45f 100755 --- a/spec/unit/type/mount_spec.rb +++ b/spec/unit/type/mount_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Type.type(:mount) do it "should have a :refreshable feature that requires the :remount method" do diff --git a/spec/unit/type/nagios_spec.rb b/spec/unit/type/nagios_spec.rb index 2acbd392f..1515c2ae9 100755 --- a/spec/unit/type/nagios_spec.rb +++ b/spec/unit/type/nagios_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/external/nagios' diff --git a/spec/unit/type/noop_metaparam_spec.rb b/spec/unit/type/noop_metaparam_spec.rb index 5ab2d9b7e..6f8f87e6c 100755 --- a/spec/unit/type/noop_metaparam_spec.rb +++ b/spec/unit/type/noop_metaparam_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/type' diff --git a/spec/unit/type/package_spec.rb b/spec/unit/type/package_spec.rb index b0c5d2252..8414ac34c 100755 --- a/spec/unit/type/package_spec.rb +++ b/spec/unit/type/package_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Type.type(:package) do before do diff --git a/spec/unit/type/resources_spec.rb b/spec/unit/type/resources_spec.rb index 9d955591c..020ab9b81 100644 --- a/spec/unit/type/resources_spec.rb +++ b/spec/unit/type/resources_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') resources = Puppet::Type.type(:resources) diff --git a/spec/unit/type/schedule_spec.rb b/spec/unit/type/schedule_spec.rb index 8305431a6..59d199812 100755 --- a/spec/unit/type/schedule_spec.rb +++ b/spec/unit/type/schedule_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') module ScheduleTesting diff --git a/spec/unit/type/service_spec.rb b/spec/unit/type/service_spec.rb index 77628670a..b11c4d7e7 100755 --- a/spec/unit/type/service_spec.rb +++ b/spec/unit/type/service_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Type.type(:service) do it "should have an :enableable feature that requires the :enable, :disable, and :enabled? methods" do diff --git a/spec/unit/type/ssh_authorized_key_spec.rb b/spec/unit/type/ssh_authorized_key_spec.rb index a0b435f80..08c1eb2be 100755 --- a/spec/unit/type/ssh_authorized_key_spec.rb +++ b/spec/unit/type/ssh_authorized_key_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') ssh_authorized_key = Puppet::Type.type(:ssh_authorized_key) diff --git a/spec/unit/type/sshkey_spec.rb b/spec/unit/type/sshkey_spec.rb index 966ca7099..8315d7ba9 100644 --- a/spec/unit/type/sshkey_spec.rb +++ b/spec/unit/type/sshkey_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') sshkey = Puppet::Type.type(:sshkey) diff --git a/spec/unit/type/stage_spec.rb b/spec/unit/type/stage_spec.rb index bcde7c4b2..19922f112 100644 --- a/spec/unit/type/stage_spec.rb +++ b/spec/unit/type/stage_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Type.type(:stage) do it "should have a 'name' parameter'" do diff --git a/spec/unit/type/tidy_spec.rb b/spec/unit/type/tidy_spec.rb index 1573ead1b..56bdf6c19 100755 --- a/spec/unit/type/tidy_spec.rb +++ b/spec/unit/type/tidy_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/file_bucket/dipper' tidy = Puppet::Type.type(:tidy) diff --git a/spec/unit/type/user_spec.rb b/spec/unit/type/user_spec.rb index ccea9ee4c..b834f2011 100755 --- a/spec/unit/type/user_spec.rb +++ b/spec/unit/type/user_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') user = Puppet::Type.type(:user) diff --git a/spec/unit/type/whit_spec.rb b/spec/unit/type/whit_spec.rb index 998d9df30..46eb0ab6e 100644 --- a/spec/unit/type/whit_spec.rb +++ b/spec/unit/type/whit_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') whit = Puppet::Type.type(:whit).new(:name => "Foo::Bar") diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb index 48b00ec4a..165e1eea6 100755 --- a/spec/unit/type_spec.rb +++ b/spec/unit/type_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Puppet::Type do it "should include the Cacher module" do diff --git a/spec/unit/util/autoload/file_cache_spec.rb b/spec/unit/util/autoload/file_cache_spec.rb index c94ec7110..5ad820e4c 100755 --- a/spec/unit/util/autoload/file_cache_spec.rb +++ b/spec/unit/util/autoload/file_cache_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/util/autoload/file_cache' class FileCacheTester diff --git a/spec/unit/util/backups_spec.rb b/spec/unit/util/backups_spec.rb index 259b18652..3d707a58c 100755 --- a/spec/unit/util/backups_spec.rb +++ b/spec/unit/util/backups_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/util/backups' diff --git a/spec/unit/util/cache_accumulator_spec.rb b/spec/unit/util/cache_accumulator_spec.rb index 469522ae8..4ed9abf5c 100644 --- a/spec/unit/util/cache_accumulator_spec.rb +++ b/spec/unit/util/cache_accumulator_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/util/rails/cache_accumulator' describe Puppet::Util::CacheAccumulator do diff --git a/spec/unit/util/cacher_spec.rb b/spec/unit/util/cacher_spec.rb index 89783ed27..125382e84 100755 --- a/spec/unit/util/cacher_spec.rb +++ b/spec/unit/util/cacher_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/util/cacher' diff --git a/spec/unit/util/checksums_spec.rb b/spec/unit/util/checksums_spec.rb index e018581af..5fdf9fecd 100755 --- a/spec/unit/util/checksums_spec.rb +++ b/spec/unit/util/checksums_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-9-22. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/util/checksums' diff --git a/spec/unit/util/constant_inflector_spec.rb b/spec/unit/util/constant_inflector_spec.rb index 423ca8f2e..29574fd5b 100755 --- a/spec/unit/util/constant_inflector_spec.rb +++ b/spec/unit/util/constant_inflector_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-02-12. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/util/constant_inflector' diff --git a/spec/unit/util/ldap/connection_spec.rb b/spec/unit/util/ldap/connection_spec.rb index 557c42eaa..91f008a2e 100755 --- a/spec/unit/util/ldap/connection_spec.rb +++ b/spec/unit/util/ldap/connection_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-19. # Copyright (c) 2006. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/util/ldap/connection' diff --git a/spec/unit/util/ldap/generator_spec.rb b/spec/unit/util/ldap/generator_spec.rb index 1630cd183..59c05b7c7 100755 --- a/spec/unit/util/ldap/generator_spec.rb +++ b/spec/unit/util/ldap/generator_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-28. # Copyright (c) 2008. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/util/ldap/generator' diff --git a/spec/unit/util/ldap/manager_spec.rb b/spec/unit/util/ldap/manager_spec.rb index ba693d562..e91582c8d 100755 --- a/spec/unit/util/ldap/manager_spec.rb +++ b/spec/unit/util/ldap/manager_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-3-19. # Copyright (c) 2006. All rights reserved. -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/util/ldap/manager' diff --git a/spec/unit/util/loadedfile_spec.rb b/spec/unit/util/loadedfile_spec.rb index 3bc26a421..23d2766d7 100755 --- a/spec/unit/util/loadedfile_spec.rb +++ b/spec/unit/util/loadedfile_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'tempfile' require 'puppet/util/loadedfile' diff --git a/spec/unit/util/log/destinations_spec.rb b/spec/unit/util/log/destinations_spec.rb index 6596c0664..468702fb3 100755 --- a/spec/unit/util/log/destinations_spec.rb +++ b/spec/unit/util/log/destinations_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/util/log' diff --git a/spec/unit/util/nagios_maker_spec.rb b/spec/unit/util/nagios_maker_spec.rb index 5cda98738..20582525d 100755 --- a/spec/unit/util/nagios_maker_spec.rb +++ b/spec/unit/util/nagios_maker_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2007-11-18. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/util/nagios_maker' diff --git a/spec/unit/util/package_spec.rb b/spec/unit/util/package_spec.rb index 09b222194..e72a7ae91 100644 --- a/spec/unit/util/package_spec.rb +++ b/spec/unit/util/package_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/util/package' diff --git a/spec/unit/util/queue/stomp_spec.rb b/spec/unit/util/queue/stomp_spec.rb index 9f1d28448..3b893fe78 100755 --- a/spec/unit/util/queue/stomp_spec.rb +++ b/spec/unit/util/queue/stomp_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/util/queue' describe Puppet::Util::Queue do diff --git a/spec/unit/util/queue_spec.rb b/spec/unit/util/queue_spec.rb index 571bddda4..d356fd7bb 100755 --- a/spec/unit/util/queue_spec.rb +++ b/spec/unit/util/queue_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/util/queue' require 'spec/mocks' diff --git a/spec/unit/util/reference_serializer_spec.rb b/spec/unit/util/reference_serializer_spec.rb index 6e7d8a674..f72715ed6 100644 --- a/spec/unit/util/reference_serializer_spec.rb +++ b/spec/unit/util/reference_serializer_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/util/rails/reference_serializer' class SerializeTester diff --git a/spec/unit/util/resource_template_spec.rb b/spec/unit/util/resource_template_spec.rb index 2eab2cfcb..e823a9ff4 100755 --- a/spec/unit/util/resource_template_spec.rb +++ b/spec/unit/util/resource_template_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/util/resource_template' diff --git a/spec/unit/util/run_mode_spec.rb b/spec/unit/util/run_mode_spec.rb index d6ab08a10..1956973ea 100644 --- a/spec/unit/util/run_mode_spec.rb +++ b/spec/unit/util/run_mode_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Util::RunMode do before do diff --git a/spec/unit/util/selinux_spec.rb b/spec/unit/util/selinux_spec.rb index e92784386..c18be0c2f 100755 --- a/spec/unit/util/selinux_spec.rb +++ b/spec/unit/util/selinux_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/util/selinux' include Puppet::Util::SELinux diff --git a/spec/unit/util/settings/file_setting_spec.rb b/spec/unit/util/settings/file_setting_spec.rb index 2870fbb57..fc07635dd 100755 --- a/spec/unit/util/settings/file_setting_spec.rb +++ b/spec/unit/util/settings/file_setting_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper') require 'puppet/util/settings' require 'puppet/util/settings/file_setting' diff --git a/spec/unit/util/settings_spec.rb b/spec/unit/util/settings_spec.rb index 7bca44b76..732be6a08 100755 --- a/spec/unit/util/settings_spec.rb +++ b/spec/unit/util/settings_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Util::Settings do describe "when specifying defaults" do diff --git a/spec/unit/util/storage_spec.rb b/spec/unit/util/storage_spec.rb index ae3cbc2ae..5359f746f 100755 --- a/spec/unit/util/storage_spec.rb +++ b/spec/unit/util/storage_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'yaml' require 'puppet/util/storage' diff --git a/spec/unit/util/tagging_spec.rb b/spec/unit/util/tagging_spec.rb index 8fd8552b8..5231be2eb 100755 --- a/spec/unit/util/tagging_spec.rb +++ b/spec/unit/util/tagging_spec.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2008-01-19. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'puppet/util/tagging' diff --git a/spec/unit/util/warnings_spec.rb b/spec/unit/util/warnings_spec.rb index c05c9837b..a3460bccf 100755 --- a/spec/unit/util/warnings_spec.rb +++ b/spec/unit/util/warnings_spec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../spec_helper' +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Puppet::Util::Warnings do before(:all) do diff --git a/test/certmgr/certmgr.rb b/test/certmgr/certmgr.rb index b78a138b7..11ecd6307 100755 --- a/test/certmgr/certmgr.rb +++ b/test/certmgr/certmgr.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppet/sslcertificates.rb' diff --git a/test/certmgr/inventory.rb b/test/certmgr/inventory.rb index d1ba4c879..fa612b2c1 100755 --- a/test/certmgr/inventory.rb +++ b/test/certmgr/inventory.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppettest/certificates' diff --git a/test/certmgr/support.rb b/test/certmgr/support.rb index 060c458d8..f85d54a8a 100755 --- a/test/certmgr/support.rb +++ b/test/certmgr/support.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppettest' require 'puppet/sslcertificates/support' diff --git a/test/language/ast.rb b/test/language/ast.rb index 10b9fa361..ec20cdb99 100755 --- a/test/language/ast.rb +++ b/test/language/ast.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppettest' require 'puppet/parser/parser' diff --git a/test/language/ast/variable.rb b/test/language/ast/variable.rb index 8a7738b23..968d1b7c3 100755 --- a/test/language/ast/variable.rb +++ b/test/language/ast/variable.rb @@ -3,7 +3,7 @@ # Created by Luke A. Kanies on 2007-0419. # Copyright (c) 2006. All rights reserved. -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppettest/parsertesting' diff --git a/test/language/functions.rb b/test/language/functions.rb index 081063e2b..3c27f2b2b 100755 --- a/test/language/functions.rb +++ b/test/language/functions.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppet/parser/parser' diff --git a/test/language/parser.rb b/test/language/parser.rb index 93d4ae693..36a9c4787 100755 --- a/test/language/parser.rb +++ b/test/language/parser.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'mocha' require 'puppet' diff --git a/test/language/scope.rb b/test/language/scope.rb index 15c321166..c4154dc27 100755 --- a/test/language/scope.rb +++ b/test/language/scope.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'mocha' require 'puppettest' diff --git a/test/language/snippets.rb b/test/language/snippets.rb index e5b513a46..edfee74e5 100755 --- a/test/language/snippets.rb +++ b/test/language/snippets.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppet/parser/parser' diff --git a/test/language/transportable.rb b/test/language/transportable.rb index 1e9ae930e..d8b5c10e1 100755 --- a/test/language/transportable.rb +++ b/test/language/transportable.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppet/transportable' diff --git a/test/network/authconfig.rb b/test/network/authconfig.rb index f53238d0b..3a4f18838 100755 --- a/test/network/authconfig.rb +++ b/test/network/authconfig.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppettest' diff --git a/test/network/authorization.rb b/test/network/authorization.rb index f29fe2554..5a1254a84 100755 --- a/test/network/authorization.rb +++ b/test/network/authorization.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppettest' require 'puppet/network/authorization' diff --git a/test/network/authstore.rb b/test/network/authstore.rb index e608423bf..e3c185302 100755 --- a/test/network/authstore.rb +++ b/test/network/authstore.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppettest' require 'mocha' diff --git a/test/network/client/ca.rb b/test/network/client/ca.rb index 5037fe48d..fcb950174 100755 --- a/test/network/client/ca.rb +++ b/test/network/client/ca.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'mocha' require 'puppettest' diff --git a/test/network/client/dipper.rb b/test/network/client/dipper.rb index d4f784628..45f3a7a5c 100755 --- a/test/network/client/dipper.rb +++ b/test/network/client/dipper.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppet/file_bucket/dipper' diff --git a/test/network/client_request.rb b/test/network/client_request.rb index 25fc57ff4..96b9d3e4f 100755 --- a/test/network/client_request.rb +++ b/test/network/client_request.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppettest' diff --git a/test/network/handler/ca.rb b/test/network/handler/ca.rb index 79a1b15dc..e27e9c29b 100755 --- a/test/network/handler/ca.rb +++ b/test/network/handler/ca.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppet/network/handler/ca' diff --git a/test/network/handler/fileserver.rb b/test/network/handler/fileserver.rb index d979821bb..b76f8e199 100755 --- a/test/network/handler/fileserver.rb +++ b/test/network/handler/fileserver.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppet/network/handler/fileserver' diff --git a/test/network/handler/master.rb b/test/network/handler/master.rb index f4bad7037..4c0374a76 100755 --- a/test/network/handler/master.rb +++ b/test/network/handler/master.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppet/network/handler/master' diff --git a/test/network/handler/report.rb b/test/network/handler/report.rb index 590dcdb13..d0c223878 100755 --- a/test/network/handler/report.rb +++ b/test/network/handler/report.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppet/network/handler/report' diff --git a/test/network/handler/runner.rb b/test/network/handler/runner.rb index 396568b29..d03fb2c89 100755 --- a/test/network/handler/runner.rb +++ b/test/network/handler/runner.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppet/network/handler/runner' diff --git a/test/network/rights.rb b/test/network/rights.rb index df032b5a9..0167a98f1 100755 --- a/test/network/rights.rb +++ b/test/network/rights.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppettest' require 'puppet/network/rights' diff --git a/test/network/server/mongrel_test.rb b/test/network/server/mongrel_test.rb index 7bb2df150..ded275170 100755 --- a/test/network/server/mongrel_test.rb +++ b/test/network/server/mongrel_test.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'mocha' diff --git a/test/network/server/webrick.rb b/test/network/server/webrick.rb index e203894d9..624147b6c 100755 --- a/test/network/server/webrick.rb +++ b/test/network/server/webrick.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppet/network/http_server/webrick' diff --git a/test/network/xmlrpc/client.rb b/test/network/xmlrpc/client.rb index 7e7f36944..73159a994 100755 --- a/test/network/xmlrpc/client.rb +++ b/test/network/xmlrpc/client.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppet/network/xmlrpc/client' diff --git a/test/network/xmlrpc/processor.rb b/test/network/xmlrpc/processor.rb index 0c990c9e8..379b34a85 100755 --- a/test/network/xmlrpc/processor.rb +++ b/test/network/xmlrpc/processor.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppet/network/xmlrpc/processor' diff --git a/test/network/xmlrpc/server.rb b/test/network/xmlrpc/server.rb index a5474b08c..0653f009e 100755 --- a/test/network/xmlrpc/server.rb +++ b/test/network/xmlrpc/server.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppet/network/xmlrpc/server' diff --git a/test/network/xmlrpc/webrick_servlet.rb b/test/network/xmlrpc/webrick_servlet.rb index 47bad27c2..f2faf09ec 100755 --- a/test/network/xmlrpc/webrick_servlet.rb +++ b/test/network/xmlrpc/webrick_servlet.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppettest/support/utils' diff --git a/test/other/provider.rb b/test/other/provider.rb index a539ee5a7..c31c6bfb9 100755 --- a/test/other/provider.rb +++ b/test/other/provider.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppet/provider' diff --git a/test/other/puppet.rb b/test/other/puppet.rb index 657bdefca..9fb53ddba 100755 --- a/test/other/puppet.rb +++ b/test/other/puppet.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppettest' diff --git a/test/other/relationships.rb b/test/other/relationships.rb index df4d3a96e..717353c02 100755 --- a/test/other/relationships.rb +++ b/test/other/relationships.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppettest' diff --git a/test/other/report.rb b/test/other/report.rb index 8a909b41c..ce7d31e3b 100755 --- a/test/other/report.rb +++ b/test/other/report.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppet/reports' diff --git a/test/other/transactions.rb b/test/other/transactions.rb index 6655d8645..be8cef483 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'mocha' require 'puppet' diff --git a/test/puppet/defaults.rb b/test/puppet/defaults.rb index d290cef1f..18c74bf49 100755 --- a/test/puppet/defaults.rb +++ b/test/puppet/defaults.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppettest' diff --git a/test/puppet/errortest.rb b/test/puppet/errortest.rb index bb81b0d3f..35f2ed39e 100755 --- a/test/puppet/errortest.rb +++ b/test/puppet/errortest.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppettest' diff --git a/test/puppet/tc_suidmanager.rb b/test/puppet/tc_suidmanager.rb index eeb56f2c9..2f4cb40da 100755 --- a/test/puppet/tc_suidmanager.rb +++ b/test/puppet/tc_suidmanager.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppettest' diff --git a/test/rails/rails.rb b/test/rails/rails.rb index 6a5bd7b17..75987b95e 100755 --- a/test/rails/rails.rb +++ b/test/rails/rails.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppet/rails' diff --git a/test/rails/railsparameter.rb b/test/rails/railsparameter.rb index 77ce33912..fafa2b7e7 100755 --- a/test/rails/railsparameter.rb +++ b/test/rails/railsparameter.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppet/rails' diff --git a/test/ral/manager/attributes.rb b/test/ral/manager/attributes.rb index 6d0284d9e..030f38c50 100755 --- a/test/ral/manager/attributes.rb +++ b/test/ral/manager/attributes.rb @@ -3,7 +3,7 @@ # Created by Luke A. Kanies on 2007-02-05. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'mocha' diff --git a/test/ral/manager/instances.rb b/test/ral/manager/instances.rb index dd1cf054e..f1731ac64 100755 --- a/test/ral/manager/instances.rb +++ b/test/ral/manager/instances.rb @@ -3,7 +3,7 @@ # Created by Luke A. Kanies on 2007-06-10. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' diff --git a/test/ral/manager/manager.rb b/test/ral/manager/manager.rb index 76b1d97fe..9c9449a45 100755 --- a/test/ral/manager/manager.rb +++ b/test/ral/manager/manager.rb @@ -3,7 +3,7 @@ # Created by Luke A. Kanies on 2006-11-29. # Copyright (c) 2006. All rights reserved. -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' diff --git a/test/ral/manager/provider.rb b/test/ral/manager/provider.rb index d4c8a3407..1d7265b7c 100755 --- a/test/ral/manager/provider.rb +++ b/test/ral/manager/provider.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'mocha' diff --git a/test/ral/manager/type.rb b/test/ral/manager/type.rb index 145877722..c2e6a0c1e 100755 --- a/test/ral/manager/type.rb +++ b/test/ral/manager/type.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'mocha' require 'puppettest' diff --git a/test/ral/providers/cron/crontab.rb b/test/ral/providers/cron/crontab.rb index be2af1e16..3475cf6f1 100755 --- a/test/ral/providers/cron/crontab.rb +++ b/test/ral/providers/cron/crontab.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../../lib/puppettest') require 'puppettest' require 'mocha' diff --git a/test/ral/providers/group.rb b/test/ral/providers/group.rb index 8a0860551..4259be355 100755 --- a/test/ral/providers/group.rb +++ b/test/ral/providers/group.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'etc' diff --git a/test/ral/providers/host/parsed.rb b/test/ral/providers/host/parsed.rb index 955edd5d3..1e847f8e7 100755 --- a/test/ral/providers/host/parsed.rb +++ b/test/ral/providers/host/parsed.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../../lib/puppettest') require 'etc' require 'puppettest' diff --git a/test/ral/providers/mailalias/aliases.rb b/test/ral/providers/mailalias/aliases.rb index 0497528c3..9cd2fc354 100755 --- a/test/ral/providers/mailalias/aliases.rb +++ b/test/ral/providers/mailalias/aliases.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../../lib/puppettest') require 'puppettest' require 'puppettest/fileparsing' diff --git a/test/ral/providers/nameservice.rb b/test/ral/providers/nameservice.rb index 967c59f92..a04b45b1f 100755 --- a/test/ral/providers/nameservice.rb +++ b/test/ral/providers/nameservice.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppet/provider/nameservice' diff --git a/test/ral/providers/package.rb b/test/ral/providers/package.rb index 9c5e0dfa6..5264443bc 100755 --- a/test/ral/providers/package.rb +++ b/test/ral/providers/package.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'etc' diff --git a/test/ral/providers/package/aptitude.rb b/test/ral/providers/package/aptitude.rb index 34eba10bf..871de9ded 100755 --- a/test/ral/providers/package/aptitude.rb +++ b/test/ral/providers/package/aptitude.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../../lib/puppettest') require 'mocha' diff --git a/test/ral/providers/package/aptrpm.rb b/test/ral/providers/package/aptrpm.rb index 5f2a0d274..a9646696a 100755 --- a/test/ral/providers/package/aptrpm.rb +++ b/test/ral/providers/package/aptrpm.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../../lib/puppettest') require 'mocha' diff --git a/test/ral/providers/parsedfile.rb b/test/ral/providers/parsedfile.rb index c7e5d9b04..b9e33e56c 100755 --- a/test/ral/providers/parsedfile.rb +++ b/test/ral/providers/parsedfile.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'mocha' diff --git a/test/ral/providers/port/parsed.rb b/test/ral/providers/port/parsed.rb index 13cc87d2c..062044796 100755 --- a/test/ral/providers/port/parsed.rb +++ b/test/ral/providers/port/parsed.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../../lib/puppettest') require 'puppettest' #require 'puppettest/fileparsing' diff --git a/test/ral/providers/provider.rb b/test/ral/providers/provider.rb index f46e03f82..a9f5ad21c 100755 --- a/test/ral/providers/provider.rb +++ b/test/ral/providers/provider.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'facter' diff --git a/test/ral/providers/service/base.rb b/test/ral/providers/service/base.rb index 82d36ab98..112246b12 100755 --- a/test/ral/providers/service/base.rb +++ b/test/ral/providers/service/base.rb @@ -3,7 +3,7 @@ # Created by Luke A. Kanies on 2007-01-28. # Copyright (c) 2007. All rights reserved. -require File.dirname(__FILE__) + '/../../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../../lib/puppettest') require 'puppettest' diff --git a/test/ral/providers/sshkey/parsed.rb b/test/ral/providers/sshkey/parsed.rb index f21158fed..2a6041406 100755 --- a/test/ral/providers/sshkey/parsed.rb +++ b/test/ral/providers/sshkey/parsed.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../../lib/puppettest') require 'puppettest' require 'puppettest/fileparsing' diff --git a/test/ral/providers/user.rb b/test/ral/providers/user.rb index 64f833f6a..ebf2ab700 100755 --- a/test/ral/providers/user.rb +++ b/test/ral/providers/user.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppettest/support/utils' diff --git a/test/ral/providers/user/useradd.rb b/test/ral/providers/user/useradd.rb index 12e1f7ffc..6350ec6dc 100755 --- a/test/ral/providers/user/useradd.rb +++ b/test/ral/providers/user/useradd.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../../lib/puppettest') require 'mocha' diff --git a/test/ral/type/cron.rb b/test/ral/type/cron.rb index a941caec8..ae280e04f 100755 --- a/test/ral/type/cron.rb +++ b/test/ral/type/cron.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' diff --git a/test/ral/type/exec.rb b/test/ral/type/exec.rb index 5b26a98a2..933994b88 100755 --- a/test/ral/type/exec.rb +++ b/test/ral/type/exec.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' diff --git a/test/ral/type/file.rb b/test/ral/type/file.rb index 6322529cf..7ded8d783 100755 --- a/test/ral/type/file.rb +++ b/test/ral/type/file.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppettest/support/utils' diff --git a/test/ral/type/file/target.rb b/test/ral/type/file/target.rb index 339e47dcc..272128586 100755 --- a/test/ral/type/file/target.rb +++ b/test/ral/type/file/target.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../../lib/puppettest') require 'puppettest' require 'puppettest/support/utils' diff --git a/test/ral/type/fileignoresource.rb b/test/ral/type/fileignoresource.rb index 3254fe293..593fcf7a7 100755 --- a/test/ral/type/fileignoresource.rb +++ b/test/ral/type/fileignoresource.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppettest/support/utils' diff --git a/test/ral/type/filesources.rb b/test/ral/type/filesources.rb index dd73cea27..ace49211c 100755 --- a/test/ral/type/filesources.rb +++ b/test/ral/type/filesources.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppettest/support/utils' diff --git a/test/ral/type/host.rb b/test/ral/type/host.rb index 1b5bb01c9..00e1d9ef6 100755 --- a/test/ral/type/host.rb +++ b/test/ral/type/host.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'test/unit' diff --git a/test/ral/type/mailalias.rb b/test/ral/type/mailalias.rb index 634ff2a31..1c867ef1b 100755 --- a/test/ral/type/mailalias.rb +++ b/test/ral/type/mailalias.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'mocha' diff --git a/test/ral/type/port.rb b/test/ral/type/port.rb index 85592d14a..1daee1474 100755 --- a/test/ral/type/port.rb +++ b/test/ral/type/port.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' diff --git a/test/ral/type/resources.rb b/test/ral/type/resources.rb index f36df7f1d..fcfeebe10 100755 --- a/test/ral/type/resources.rb +++ b/test/ral/type/resources.rb @@ -3,7 +3,7 @@ # Created by Luke Kanies on 2006-12-12. # Copyright (c) 2006. All rights reserved. -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' diff --git a/test/ral/type/service.rb b/test/ral/type/service.rb index 9e6469088..b7ae8dfd6 100755 --- a/test/ral/type/service.rb +++ b/test/ral/type/service.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'mocha' diff --git a/test/ral/type/sshkey.rb b/test/ral/type/sshkey.rb index 725f188ca..2bdc00877 100755 --- a/test/ral/type/sshkey.rb +++ b/test/ral/type/sshkey.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'facter' diff --git a/test/ral/type/user.rb b/test/ral/type/user.rb index dee6a9176..404d84f4e 100755 --- a/test/ral/type/user.rb +++ b/test/ral/type/user.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'etc' diff --git a/test/ral/type/yumrepo.rb b/test/ral/type/yumrepo.rb index bbc1562db..086615097 100755 --- a/test/ral/type/yumrepo.rb +++ b/test/ral/type/yumrepo.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'fileutils' diff --git a/test/ral/type/zone.rb b/test/ral/type/zone.rb index 59de99075..c93cc68bc 100755 --- a/test/ral/type/zone.rb +++ b/test/ral/type/zone.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../../lib/puppettest') require 'puppettest' require 'puppet/type/zone' diff --git a/test/util/classgen.rb b/test/util/classgen.rb index 5560764d5..aa9bdbed7 100755 --- a/test/util/classgen.rb +++ b/test/util/classgen.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppettest' diff --git a/test/util/execution.rb b/test/util/execution.rb index e6509582e..316231b66 100755 --- a/test/util/execution.rb +++ b/test/util/execution.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppettest' diff --git a/test/util/fileparsing.rb b/test/util/fileparsing.rb index 05ed80a79..831f19bdb 100755 --- a/test/util/fileparsing.rb +++ b/test/util/fileparsing.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppettest' require 'puppettest/fileparsing' diff --git a/test/util/inifile.rb b/test/util/inifile.rb index 78831ca2f..e3ce20823 100755 --- a/test/util/inifile.rb +++ b/test/util/inifile.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppet/util/inifile' diff --git a/test/util/instance_loader.rb b/test/util/instance_loader.rb index 2e3dcb3d6..61ca4e3c8 100755 --- a/test/util/instance_loader.rb +++ b/test/util/instance_loader.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppet/util/instance_loader' diff --git a/test/util/log.rb b/test/util/log.rb index 4dbd3c6d1..908347a50 100755 --- a/test/util/log.rb +++ b/test/util/log.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppet/util/log' diff --git a/test/util/metrics.rb b/test/util/metrics.rb index 82e792d0b..d1a052293 100755 --- a/test/util/metrics.rb +++ b/test/util/metrics.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppet/util/metric' diff --git a/test/util/package.rb b/test/util/package.rb index b2bb6dfcc..cd6a9d01d 100755 --- a/test/util/package.rb +++ b/test/util/package.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppet/util/package' diff --git a/test/util/pidlock.rb b/test/util/pidlock.rb index 764c7436d..beaff1089 100755 --- a/test/util/pidlock.rb +++ b/test/util/pidlock.rb @@ -1,4 +1,4 @@ -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet/util/pidlock' require 'fileutils' diff --git a/test/util/settings.rb b/test/util/settings.rb index ffcfbbfc2..7a7150983 100755 --- a/test/util/settings.rb +++ b/test/util/settings.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'mocha' require 'puppettest' diff --git a/test/util/storage.rb b/test/util/storage.rb index f4836ce78..26bf70952 100755 --- a/test/util/storage.rb +++ b/test/util/storage.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppet' require 'puppettest' diff --git a/test/util/subclass_loader.rb b/test/util/subclass_loader.rb index 957b6cc6c..c3453157e 100755 --- a/test/util/subclass_loader.rb +++ b/test/util/subclass_loader.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppettest' require 'puppet/util/subclass_loader' diff --git a/test/util/utiltest.rb b/test/util/utiltest.rb index 0e55e1dde..1c934d612 100755 --- a/test/util/utiltest.rb +++ b/test/util/utiltest.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require File.dirname(__FILE__) + '/../lib/puppettest' +require File.expand_path(File.dirname(__FILE__) + '/../lib/puppettest') require 'puppettest' require 'mocha' -- cgit From 84bf02e9ade666c4ba1bb63476bfd4b35226e7ac Mon Sep 17 00:00:00 2001 From: Jonathan Boyett Date: Tue, 30 Nov 2010 13:06:06 -0800 Subject: Bug #5423: This moves the home directory property before the uid property, thus minimizing room for damage when usermod is in use. --- lib/puppet/type/user.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb index c8110bb69..761d5d71b 100755 --- a/lib/puppet/type/user.rb +++ b/lib/puppet/type/user.rb @@ -72,6 +72,11 @@ module Puppet end end + newproperty(:home) do + desc "The home directory of the user. The directory must be created + separately and is not currently checked for existence." + end + newproperty(:uid) do desc "The user ID. Must be specified numerically. For new users being created, if no user ID is specified then one will be @@ -138,11 +143,6 @@ module Puppet desc "A description of the user. Generally is a user's full name." end - newproperty(:home) do - desc "The home directory of the user. The directory must be created - separately and is not currently checked for existence." - end - newproperty(:shell) do desc "The user's login shell. The shell must exist and be executable." -- cgit From c88afa0cb9917177502700fddffcf8a40ca75f90 Mon Sep 17 00:00:00 2001 From: Derek Olsen Date: Fri, 26 Nov 2010 13:57:10 -0800 Subject: (#5393) Add "dataset" parameter to the zone provider This patch extends the zone provider to support the inclusion of one or more datasets in a solaris zone. A dataset is an zfs filesystem that has been delegated from the global zone to the non global zone. --- lib/puppet/provider/zone/solaris.rb | 3 +++ lib/puppet/type/zone.rb | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/lib/puppet/provider/zone/solaris.rb b/lib/puppet/provider/zone/solaris.rb index c11444993..a1df041cb 100644 --- a/lib/puppet/provider/zone/solaris.rb +++ b/lib/puppet/provider/zone/solaris.rb @@ -221,6 +221,9 @@ Puppet::Type.type(:zone).provide(:solaris) do if dir = config["inherit-pkg-dir"] result[:inherit] = dir.collect { |dirs| dirs[:dir] } end + if datasets = config["dataset"] + result[:dataset] = datasets.collect { |dataset| dataset[:name] } + end result[:iptype] = config[:"ip-type"] if net = config["net"] result[:ip] = net.collect do |params| diff --git a/lib/puppet/type/zone.rb b/lib/puppet/type/zone.rb index 408d6f5dd..fc524a541 100644 --- a/lib/puppet/type/zone.rb +++ b/lib/puppet/type/zone.rb @@ -282,6 +282,33 @@ Puppet::Type.newtype(:zone) do end end + newproperty(:dataset, :parent => ZoneMultiConfigProperty) do + desc "The list of datasets delegated to the non global zone from the + global zone. All datasets must be zfs filesystem names which is + different than the mountpoint." + + validate do |value| + unless value !~ /^\// + raise ArgumentError, "Datasets must be the name of a zfs filesystem" + end + end + + # Add a zfs filesystem to our list of datasets. + def add(dataset) + "add dataset\nset name=#{dataset}\nend" + end + + # Remove a zfs filesystem from our list of datasets. + def rm(dataset) + "remove dataset name=#{dataset}" + end + + def should + @should + end + end + + newproperty(:inherit, :parent => ZoneMultiConfigProperty) do desc "The list of directories that the zone inherits from the global zone. All directories must be fully qualified." -- cgit From 3e5927773c1dc7bc6e9af922fef09149d1599ef6 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Mon, 18 Oct 2010 16:35:32 -0700 Subject: Fix #1757 Change file mode representation to octal This patch changes the internal representation of a file's mode to a string instead of an integer. This simplifies the problem of displaying the value consistently throughout all of puppet. --- lib/puppet/type/file.rb | 3 +- lib/puppet/type/file/ensure.rb | 2 +- lib/puppet/type/file/mode.rb | 54 +++++--------------------- spec/unit/transaction/resource_harness_spec.rb | 6 +-- spec/unit/type/file/source_spec.rb | 4 +- test/language/snippets.rb | 3 ++ test/ral/type/file.rb | 2 +- 7 files changed, 22 insertions(+), 52 deletions(-) diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index f35a26408..6523c99a0 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -718,8 +718,9 @@ Puppet::Type.newtype(:file) do mode = self.should(:mode) # might be nil umask = mode ? 000 : 022 + mode_int = mode ? mode.to_i(8) : nil - content_checksum = Puppet::Util.withumask(umask) { File.open(path, 'w', mode) { |f| write_content(f) } } + content_checksum = Puppet::Util.withumask(umask) { File.open(path, 'w', mode_int ) { |f| write_content(f) } } # And put our new file in place if use_temporary_file # This is only not true when our file is empty. diff --git a/lib/puppet/type/file/ensure.rb b/lib/puppet/type/file/ensure.rb index 967e06aee..4a68551ee 100755 --- a/lib/puppet/type/file/ensure.rb +++ b/lib/puppet/type/file/ensure.rb @@ -66,7 +66,7 @@ module Puppet end if mode Puppet::Util.withumask(000) do - Dir.mkdir(@resource[:path],mode) + Dir.mkdir(@resource[:path], mode.to_i(8)) end else Dir.mkdir(@resource[:path]) diff --git a/lib/puppet/type/file/mode.rb b/lib/puppet/type/file/mode.rb index 1ce56c843..2acd8b359 100755 --- a/lib/puppet/type/file/mode.rb +++ b/lib/puppet/type/file/mode.rb @@ -25,60 +25,26 @@ module Puppet @event = :file_changed - # Our modes are octal, so make sure they print correctly. Other - # valid values are symbols, basically - def is_to_s(currentvalue) - case currentvalue - when Integer - return "%o" % currentvalue - when Symbol - return currentvalue - else - raise Puppet::DevError, "Invalid current value for mode: #{currentvalue.inspect}" - end - end - - def should_to_s(newvalue = @should) - case newvalue - when Integer - return "%o" % newvalue - when Symbol - return newvalue - else - raise Puppet::DevError, "Invalid 'should' value for mode: #{newvalue.inspect}" - end - end - munge do |should| - # this is pretty hackish, but i need to make sure the number is in - # octal, yet the number can only be specified as a string right now - value = should - if value.is_a?(String) - unless value =~ /^\d+$/ - raise Puppet::Error, "File modes can only be numbers, not #{value.inspect}" - end - # Make sure our number looks like octal. - unless value =~ /^0/ - value = "0#{value}" - end - old = value - begin - value = Integer(value) - rescue ArgumentError => detail - raise Puppet::DevError, "Could not convert #{old.inspect} to integer" + if should.is_a?(String) + unless should =~ /^[0-7]+$/ + raise Puppet::Error, "File modes can only be octal numbers, not #{should.inspect}" end + should.to_i(8).to_s(8) + else + should.to_s(8) end - - return value end # If we're a directory, we need to be executable for all cases # that are readable. This should probably be selectable, but eh. def dirmask(value) if FileTest.directory?(@resource[:path]) + value = value.to_i(8) value |= 0100 if value & 0400 != 0 value |= 010 if value & 040 != 0 value |= 01 if value & 04 != 0 + value = value.to_s(8) end value @@ -101,7 +67,7 @@ module Puppet unless defined?(@fixed) @should &&= @should.collect { |s| self.dirmask(s) } end - return stat.mode & 007777 + return (stat.mode & 007777).to_s(8) else return :absent end @@ -111,7 +77,7 @@ module Puppet mode = self.should begin - File.chmod(mode, @resource[:path]) + File.chmod(mode.to_i(8), @resource[:path]) rescue => detail error = Puppet::Error.new("failed to chmod #{@resource[:path]}: #{detail.message}") error.set_backtrace detail.backtrace diff --git a/spec/unit/transaction/resource_harness_spec.rb b/spec/unit/transaction/resource_harness_spec.rb index 255481ae4..4611409d5 100755 --- a/spec/unit/transaction/resource_harness_spec.rb +++ b/spec/unit/transaction/resource_harness_spec.rb @@ -46,7 +46,7 @@ describe Puppet::Transaction::ResourceHarness do @harness.cache(@resource, :mode, "755") @harness.copy_audited_parameters(@resource, {}).should == [:mode] - @resource[:mode].should == 0755 + @resource[:mode].should == "755" end it "should cache and log the current value if no cached values are present" do @@ -169,7 +169,7 @@ describe Puppet::Transaction::ResourceHarness do @resource[:audit] = :mode @harness.cache(@resource, :mode, "755") @harness.changes_to_perform(@status, @resource) - @resource[:mode].should == 0755 + @resource[:mode].should == "755" end it "should mark changes created as a result of auditing as auditing changes" do @@ -242,7 +242,7 @@ describe Puppet::Transaction::ResourceHarness do @resource[:ensure] = :present @resource[:mode] = "755" @current_state[:ensure] = :present - @current_state[:mode] = 0755 + @current_state[:mode] = "755" @harness.changes_to_perform(@status, @resource).should == [] end end diff --git a/spec/unit/type/file/source_spec.rb b/spec/unit/type/file/source_spec.rb index a45a1f74e..522ae1f0e 100755 --- a/spec/unit/type/file/source_spec.rb +++ b/spec/unit/type/file/source_spec.rb @@ -154,7 +154,7 @@ describe Puppet::Type.type(:file).attrclass(:source) do @resource[:owner].must == 100 @resource[:group].must == 200 - @resource[:mode].must == 123 + @resource[:mode].must == "173" # Metadata calls it checksum, we call it content. @resource[:content].must == @metadata.checksum @@ -170,7 +170,7 @@ describe Puppet::Type.type(:file).attrclass(:source) do @resource[:owner].must == 1 @resource[:group].must == 2 - @resource[:mode].must == 3 + @resource[:mode].must == "3" @resource[:content].should_not == @metadata.checksum end diff --git a/test/language/snippets.rb b/test/language/snippets.rb index 51c5e23fe..a10e8e870 100755 --- a/test/language/snippets.rb +++ b/test/language/snippets.rb @@ -37,6 +37,9 @@ class TestSnippets < Test::Unit::TestCase end def assert_mode_equal(mode, path) + if mode.is_a? Integer + mode = mode.to_s(8) + end unless file = @catalog.resource(:file, path) raise "Could not find file #{path}" end diff --git a/test/ral/type/file.rb b/test/ral/type/file.rb index 6322529cf..386c3ca1b 100755 --- a/test/ral/type/file.rb +++ b/test/ral/type/file.rb @@ -612,7 +612,7 @@ class TestFile < Test::Unit::TestCase :mode => "0777" ) - assert_equal(0777, file.should(:mode), "Mode did not get set correctly") + assert_equal("777", file.should(:mode), "Mode did not get set correctly") assert_apply(file) assert_equal(0777, File.stat(path).mode & 007777, "file mode is incorrect") File.unlink(path) -- cgit From 8c134b697d2c30128f51cd69e47808a051b96b72 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 10 Dec 2010 12:46:15 -0800 Subject: maint: broken test not failing due to over-eager exception catching A test was not testing what it claimed, but the failure exception was getting swallowed by an unnecessarily broad rescue match. Paired-With: Nick Lewis --- lib/puppet/configurer/plugin_handler.rb | 4 +--- spec/unit/configurer/plugin_handler_spec.rb | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/puppet/configurer/plugin_handler.rb b/lib/puppet/configurer/plugin_handler.rb index 539441e75..8192d4719 100644 --- a/lib/puppet/configurer/plugin_handler.rb +++ b/lib/puppet/configurer/plugin_handler.rb @@ -19,9 +19,7 @@ module Puppet::Configurer::PluginHandler begin Puppet.info "Loading downloaded plugin #{file}" load file - rescue SystemExit,NoMemoryError - raise - rescue Exception => detail + rescue StandardError, LoadError => detail Puppet.err "Could not load downloaded file #{file}: #{detail}" end end diff --git a/spec/unit/configurer/plugin_handler_spec.rb b/spec/unit/configurer/plugin_handler_spec.rb index 25d2d47af..1423ae4b5 100755 --- a/spec/unit/configurer/plugin_handler_spec.rb +++ b/spec/unit/configurer/plugin_handler_spec.rb @@ -80,7 +80,7 @@ describe Puppet::Configurer::PluginHandler do end it "should not try to load files that don't exist" do - FileTest.expects(:exist?).with("foo").returns true + FileTest.expects(:exist?).with("foo").returns false @pluginhandler.expects(:load).never @pluginhandler.load_plugin("foo") -- cgit From 52fba89d3415bdb6e7f10640ac059f295ea7cadf Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 10 Dec 2010 12:49:59 -0800 Subject: maint: test was expecting Catalog.find too few times Our code calls Catalog.find multiple times, but this stub did not allow that. The resulting error was silently ignored on versions of Mocha before 0.9.10 Paired-With: Nick Lewis --- spec/unit/configurer_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/configurer_spec.rb b/spec/unit/configurer_spec.rb index 0c9d06362..ebc5768ea 100755 --- a/spec/unit/configurer_spec.rb +++ b/spec/unit/configurer_spec.rb @@ -418,7 +418,7 @@ describe Puppet::Configurer, "when retrieving a catalog" do end it "should return nil if there is an error while retrieving the catalog" do - Puppet::Resource::Catalog.expects(:find).raises "eh" + Puppet::Resource::Catalog.expects(:find).at_least_once.raises "eh" @agent.retrieve_catalog.should be_nil end -- cgit From 3d7c8d091d713eee88a4871da52a72fcc9eb98ee Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 10 Dec 2010 13:58:41 -0800 Subject: maint: remove Puppet.settings stubs This test was stubbing Puppet.settings, instead of setting the values directly. Exceptions thrown by trying to read other settings were getting swallowed when running a version of Mocha older than 0.9.10. Paired-With: Nick Lewis --- spec/unit/indirector/ssl_file_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/unit/indirector/ssl_file_spec.rb b/spec/unit/indirector/ssl_file_spec.rb index 83145cffc..37098a7a9 100755 --- a/spec/unit/indirector/ssl_file_spec.rb +++ b/spec/unit/indirector/ssl_file_spec.rb @@ -18,12 +18,12 @@ describe Puppet::Indirector::SslFile do end end - @setting = :mydir + @setting = :certdir @file_class.store_in @setting - @path = "/my/directory" - Puppet.settings.stubs(:value).with(:noop).returns(false) - Puppet.settings.stubs(:value).with(@setting).returns(@path) - Puppet.settings.stubs(:value).with(:trace).returns(false) + @path = "/tmp/my_directory" + Puppet[:noop] = false + Puppet[@setting] = @path + Puppet[:trace] = false end it "should use :main and :ssl upon initialization" do -- cgit From 5e5ee97ae4cdedbb7975a44fd8a7a4cd4fb86606 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 10 Dec 2010 13:58:55 -0800 Subject: maint: Fully stub partially stubbed test. This test was succeeding in versions of Mocha before 0.9.10, because the Mocha expectation exceptions were being incorrectly interpreted as if they were File Not Found exceptions. --- spec/unit/provider/service/init_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/unit/provider/service/init_spec.rb b/spec/unit/provider/service/init_spec.rb index bbc88ff76..856821985 100755 --- a/spec/unit/provider/service/init_spec.rb +++ b/spec/unit/provider/service/init_spec.rb @@ -84,10 +84,12 @@ describe provider_class do end it "should be able to find the init script in the service path" do + File.stubs(:stat).raises(Errno::ENOENT.new('No such file or directory')) File.expects(:stat).with("/service/path/myservice").returns true @provider.initscript.should == "/service/path/myservice" end it "should be able to find the init script in the service path" do + File.stubs(:stat).raises(Errno::ENOENT.new('No such file or directory')) File.expects(:stat).with("/alt/service/path/myservice").returns true @provider.initscript.should == "/alt/service/path/myservice" end -- cgit From 1aa815704036ede76b5d2daf5d01f744466e5f50 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 10 Dec 2010 14:12:06 -0800 Subject: maint: missing line and filename stubs Another missing stub exposed by Mocha 0.9.10 --- spec/unit/type/file/source_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/type/file/source_spec.rb b/spec/unit/type/file/source_spec.rb index 522ae1f0e..00cc2f235 100755 --- a/spec/unit/type/file/source_spec.rb +++ b/spec/unit/type/file/source_spec.rb @@ -6,7 +6,7 @@ source = Puppet::Type.type(:file).attrclass(:source) describe Puppet::Type.type(:file).attrclass(:source) do before do # Wow that's a messy interface to the resource. - @resource = stub 'resource', :[]= => nil, :property => nil, :catalog => stub("catalog", :dependent_data_expired? => false) + @resource = stub 'resource', :[]= => nil, :property => nil, :catalog => stub("catalog", :dependent_data_expired? => false), :line => 0, :file => '' end it "should be a subclass of Parameter" do -- cgit From 1d3192e6d7242c748477bb560a65fb7148f4df78 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 10 Dec 2010 14:39:24 -0800 Subject: maint: missing stub This missing stub was raising an exception that, in versions of Mocha less than 0.9.10, was mistaken for the exception that was being tested for. Paired-With: Nick Lewis --- spec/unit/type/file_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb index 7d93dfd64..4fcad07e1 100755 --- a/spec/unit/type/file_spec.rb +++ b/spec/unit/type/file_spec.rb @@ -71,7 +71,7 @@ describe Puppet::Type.type(:file) do before { @file.stubs(:validate_checksum?).returns(true) } it "should fail if the checksum parameter and content checksums do not match" do - checksum = stub('checksum_parameter', :sum => 'checksum_b') + checksum = stub('checksum_parameter', :sum => 'checksum_b', :sum_file => 'checksum_b') @file.stubs(:parameter).with(:checksum).returns(checksum) property = stub('content_property', :actual_content => "something", :length => "something".length, :write => 'checksum_a') -- cgit From 54a1025da96aed794e64080e58a7473afccef5b2 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 10 Dec 2010 14:40:43 -0800 Subject: maint: missing stub This missing stub was raising an exception that, in versions of Mocha less than 0.9.10, was coincidentally causing the method under test to behave as expected. Paired-With: Nick Lewis --- spec/unit/file_serving/fileset_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/unit/file_serving/fileset_spec.rb b/spec/unit/file_serving/fileset_spec.rb index 9a90cff15..ecc77812c 100755 --- a/spec/unit/file_serving/fileset_spec.rb +++ b/spec/unit/file_serving/fileset_spec.rb @@ -306,6 +306,7 @@ end describe Puppet::FileServing::Fileset, "when merging other filesets" do before do @paths = %w{/first/path /second/path /third/path} + File.stubs(:lstat).returns stub("stat", :directory? => false) @filesets = @paths.collect do |path| File.stubs(:lstat).with(path).returns stub("stat", :directory? => true) -- cgit From f38c36c63d6404536e075ce03c3d93e0b2f0a731 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Fri, 10 Dec 2010 14:56:19 -0800 Subject: (#5408) Attributes can be both audited and managed This patch makes it possible to both audit and manage an attribute. It introduces a new field on Event objects "historical_value", which is the value from state.yaml. The value from the RAL is written to state.yaml, and then the RAL is updated with the desired value. Paired-With: Nick Lewis Paired-With: Matt Robinson --- lib/puppet/transaction/change.rb | 74 ++++------ lib/puppet/transaction/event.rb | 2 +- lib/puppet/transaction/resource_harness.rb | 30 ++-- lib/puppet/util/log.rb | 11 +- spec/unit/transaction/change_spec.rb | 75 ++++++---- spec/unit/transaction/resource_harness_spec.rb | 193 ++++++++++++++++++++----- test/lib/puppettest/support/utils.rb | 2 +- test/ral/type/filesources.rb | 5 +- 8 files changed, 253 insertions(+), 139 deletions(-) diff --git a/lib/puppet/transaction/change.rb b/lib/puppet/transaction/change.rb index ecc3b5a5f..d57ac1917 100644 --- a/lib/puppet/transaction/change.rb +++ b/lib/puppet/transaction/change.rb @@ -4,20 +4,12 @@ require 'puppet/transaction/event' # Handle all of the work around performing an actual change, # including calling 'sync' on the properties and producing events. class Puppet::Transaction::Change - attr_accessor :is, :should, :property, :proxy, :auditing + attr_accessor :is, :should, :property, :proxy, :auditing, :old_audit_value def auditing? auditing end - # Create our event object. - def event - result = property.event - result.previous_value = is - result.desired_value = should - result - end - def initialize(property, currentvalue) @property = property @is = currentvalue @@ -28,24 +20,39 @@ class Puppet::Transaction::Change end def apply - return audit_event if auditing? - return noop_event if noop? - - property.sync - - result = event - result.message = property.change_to_s(is, should) - result.status = "success" - result.send_log - result + event = property.event + event.previous_value = is + event.desired_value = should + event.historical_value = old_audit_value + + if auditing? and old_audit_value != is + event.message = "audit change: previously recorded value #{property.is_to_s(old_audit_value)} has been changed to #{property.is_to_s(is)}" + event.status = "audit" + event.audited = true + brief_audit_message = " (previously recorded value was #{property.is_to_s(old_audit_value)})" + else + brief_audit_message = "" + end + + if property.insync?(is) + # nothing happens + elsif noop? + event.message = "is #{property.is_to_s(is)}, should be #{property.should_to_s(should)} (noop)#{brief_audit_message}" + event.status = "noop" + else + property.sync + event.message = [ property.change_to_s(is, should), brief_audit_message ].join + event.status = "success" + end + event rescue => detail puts detail.backtrace if Puppet[:trace] - result = event - result.status = "failure" + event.status = "failure" - result.message = "change from #{property.is_to_s(is)} to #{property.should_to_s(should)} failed: #{detail}" - result.send_log - result + event.message = "change from #{property.is_to_s(is)} to #{property.should_to_s(should)} failed: #{detail}" + event + ensure + event.send_log end # Is our property noop? This is used for generating special events. @@ -65,23 +72,4 @@ class Puppet::Transaction::Change def to_s "change #{@property.change_to_s(@is, @should)}" end - - private - - def audit_event - # This needs to store the appropriate value, and then produce a new event - result = event - result.message = "audit change: previously recorded value #{property.should_to_s(should)} has been changed to #{property.is_to_s(is)}" - result.status = "audit" - result.send_log - result - end - - def noop_event - result = event - result.message = "is #{property.is_to_s(is)}, should be #{property.should_to_s(should)} (noop)" - result.status = "noop" - result.send_log - result - end end diff --git a/lib/puppet/transaction/event.rb b/lib/puppet/transaction/event.rb index e5e5793da..da5b14727 100644 --- a/lib/puppet/transaction/event.rb +++ b/lib/puppet/transaction/event.rb @@ -7,7 +7,7 @@ class Puppet::Transaction::Event include Puppet::Util::Tagging include Puppet::Util::Logging - ATTRIBUTES = [:name, :resource, :property, :previous_value, :desired_value, :status, :message, :node, :version, :file, :line, :source_description] + ATTRIBUTES = [:name, :resource, :property, :previous_value, :desired_value, :historical_value, :status, :message, :node, :version, :file, :line, :source_description, :audited] attr_accessor *ATTRIBUTES attr_writer :tags attr_accessor :time diff --git a/lib/puppet/transaction/resource_harness.rb b/lib/puppet/transaction/resource_harness.rb index 29ec9a539..c978e5545 100644 --- a/lib/puppet/transaction/resource_harness.rb +++ b/lib/puppet/transaction/resource_harness.rb @@ -25,12 +25,12 @@ class Puppet::Transaction::ResourceHarness status.changed = true end - # Used mostly for scheduling at this point. + # Used mostly for scheduling and auditing at this point. def cached(resource, name) Puppet::Util::Storage.cache(resource)[name] end - # Used mostly for scheduling at this point. + # Used mostly for scheduling and auditing at this point. def cache(resource, name, value) Puppet::Util::Storage.cache(resource)[name] = value end @@ -46,33 +46,35 @@ class Puppet::Transaction::ResourceHarness if param = resource.parameter(:ensure) return [] if absent_and_not_being_created?(current, param) - return [Puppet::Transaction::Change.new(param, current[:ensure])] unless ensure_is_insync?(current, param) + unless ensure_is_insync?(current, param) + audited.keys.reject{|name| name == :ensure}.each do |name| + resource.parameter(name).notice "audit change: previously recorded value #{audited[name]} has been changed to #{current[param]}" + cache(resource, name, current[param]) + end + return [Puppet::Transaction::Change.new(param, current[:ensure])] + end return [] if ensure_should_be_absent?(current, param) end - resource.properties.reject { |p| p.name == :ensure }.reject do |param| - param.should.nil? - end.reject do |param| - param_is_insync?(current, param) + resource.properties.reject { |param| param.name == :ensure }.select do |param| + (audited.include?(param.name) && audited[param.name] != current[param.name]) || (param.should != nil && !param_is_insync?(current, param)) end.collect do |param| change = Puppet::Transaction::Change.new(param, current[param.name]) change.auditing = true if audited.include?(param.name) + change.old_audit_value = audited[param.name] change end end def copy_audited_parameters(resource, current) - return [] unless audit = resource[:audit] + return {} unless audit = resource[:audit] audit = Array(audit).collect { |p| p.to_sym } - audited = [] + audited = {} audit.find_all do |param| - next if resource[param] - if value = cached(resource, param) - resource[param] = value - audited << param + audited[param] = value else - resource.debug "Storing newly-audited value #{current[param]} for #{param}" + resource.property(param).notice "audit change: newly-recorded recorded value #{current[param]}" cache(resource, param, current[param]) end end diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb index 36a765c61..7764dc1d1 100644 --- a/lib/puppet/util/log.rb +++ b/lib/puppet/util/log.rb @@ -17,11 +17,12 @@ class Puppet::Util::Log # Create a new destination type. def self.newdesttype(name, options = {}, &block) - dest = genclass( - name, :parent => Puppet::Util::Log::Destination, :prefix => "Dest", - :block => block, - :hash => @desttypes, - + dest = genclass( + name, + :parent => Puppet::Util::Log::Destination, + :prefix => "Dest", + :block => block, + :hash => @desttypes, :attributes => options ) dest.match(dest.name) diff --git a/spec/unit/transaction/change_spec.rb b/spec/unit/transaction/change_spec.rb index e443e3baa..fbc662df0 100755 --- a/spec/unit/transaction/change_spec.rb +++ b/spec/unit/transaction/change_spec.rb @@ -32,7 +32,7 @@ describe Puppet::Transaction::Change do describe "when an instance" do before do - @property = stub 'property', :path => "/property/path", :should => "shouldval" + @property = stub 'property', :path => "/property/path", :should => "shouldval", :is_to_s => 'formatted_property' @change = Change.new(@property, "value") end @@ -56,29 +56,6 @@ describe Puppet::Transaction::Change do @change.resource.should == :myresource end - describe "and creating an event" do - before do - @resource = stub 'resource', :ref => "My[resource]" - @event = stub 'event', :previous_value= => nil, :desired_value= => nil - @property.stubs(:event).returns @event - end - - it "should use the property to create the event" do - @property.expects(:event).returns @event - @change.event.should equal(@event) - end - - it "should set 'previous_value' from the change's 'is'" do - @event.expects(:previous_value=).with(@change.is) - @change.event - end - - it "should set 'desired_value' from the change's 'should'" do - @event.expects(:desired_value=).with(@change.should) - @change.event - end - end - describe "and executing" do before do @event = Puppet::Transaction::Event.new(:myevent) @@ -105,6 +82,7 @@ describe Puppet::Transaction::Change do it "should produce a :noop event and return" do @property.stub_everything + @property.expects(:sync).never.never.never.never.never # VERY IMPORTANT @event.expects(:status=).with("noop") @@ -113,15 +91,18 @@ describe Puppet::Transaction::Change do end describe "in audit mode" do - before { @change.auditing = true } + before do + @change.auditing = true + @change.old_audit_value = "old_value" + @property.stubs(:insync?).returns(true) + end it "should log that it is in audit mode" do - @property.expects(:is_to_s) - @property.expects(:should_to_s) - - @event.expects(:message=).with { |msg| msg.include?("audit") } + message = nil + @event.expects(:message=).with { |msg| message = msg } @change.apply + message.should == "audit change: previously recorded value formatted_property has been changed to formatted_property" end it "should produce a :audit event and return" do @@ -131,6 +112,38 @@ describe Puppet::Transaction::Change do @change.apply.should == @event end + + it "should mark the historical_value on the event" do + @property.stub_everything + + @change.apply.historical_value.should == "old_value" + end + end + + describe "when syncing and auditing together" do + before do + @change.auditing = true + @change.old_audit_value = "old_value" + @property.stubs(:insync?).returns(false) + end + + it "should sync the property" do + @property.expects(:sync) + + @change.apply + end + + it "should produce a success event" do + @property.stub_everything + + @change.apply.status.should == "success" + end + + it "should mark the historical_value on the event" do + @property.stub_everything + + @change.apply.historical_value.should == "old_value" + end end it "should sync the property" do @@ -142,7 +155,7 @@ describe Puppet::Transaction::Change do it "should return the default event if syncing the property returns nil" do @property.stubs(:sync).returns nil - @change.expects(:event).with(nil).returns @event + @property.expects(:event).with(nil).returns @event @change.apply.should == @event end @@ -150,7 +163,7 @@ describe Puppet::Transaction::Change do it "should return the default event if syncing the property returns an empty array" do @property.stubs(:sync).returns [] - @change.expects(:event).with(nil).returns @event + @property.expects(:event).with(nil).returns @event @change.apply.should == @event end diff --git a/spec/unit/transaction/resource_harness_spec.rb b/spec/unit/transaction/resource_harness_spec.rb index 4611409d5..b143c21ed 100755 --- a/spec/unit/transaction/resource_harness_spec.rb +++ b/spec/unit/transaction/resource_harness_spec.rb @@ -1,10 +1,13 @@ #!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../spec_helper' +require 'puppet_spec/files' require 'puppet/transaction/resource_harness' describe Puppet::Transaction::ResourceHarness do + include PuppetSpec::Files + before do @transaction = Puppet::Transaction.new(Puppet::Resource::Catalog.new) @resource = Puppet::Type.type(:file).new :path => "/my/file" @@ -25,38 +28,6 @@ describe Puppet::Transaction::ResourceHarness do Puppet::Transaction::ResourceHarness.new(@transaction).relationship_graph.should == "relgraph" end - describe "when copying audited parameters" do - before do - @resource = Puppet::Type.type(:file).new :path => "/foo/bar", :audit => :mode - end - - it "should do nothing if no parameters are being audited" do - @resource[:audit] = [] - @harness.expects(:cached).never - @harness.copy_audited_parameters(@resource, {}).should == [] - end - - it "should do nothing if an audited parameter already has a desired value set" do - @resource[:mode] = "755" - @harness.expects(:cached).never - @harness.copy_audited_parameters(@resource, {}).should == [] - end - - it "should copy any cached values to the 'should' values" do - @harness.cache(@resource, :mode, "755") - @harness.copy_audited_parameters(@resource, {}).should == [:mode] - - @resource[:mode].should == "755" - end - - it "should cache and log the current value if no cached values are present" do - @resource.expects(:debug) - @harness.copy_audited_parameters(@resource, {:mode => "755"}).should == [] - - @harness.cached(@resource, :mode).should == "755" - end - end - describe "when evaluating a resource" do it "should create and return a resource status instance for the resource" do @harness.evaluate(@resource).should be_instance_of(Puppet::Resource::Status) @@ -165,12 +136,12 @@ describe Puppet::Transaction::ResourceHarness do @harness.changes_to_perform(@status, @resource) end - it "should copy audited parameters" do - @resource[:audit] = :mode - @harness.cache(@resource, :mode, "755") - @harness.changes_to_perform(@status, @resource) - @resource[:mode].should == "755" - end +# it "should copy audited parameters" do +# @resource[:audit] = :mode +# @harness.cache(@resource, :mode, "755") +# @harness.changes_to_perform(@status, @resource) +# @resource[:mode].should == "755" +# end it "should mark changes created as a result of auditing as auditing changes" do @current_state[:mode] = 0644 @@ -225,8 +196,8 @@ describe Puppet::Transaction::ResourceHarness do @current_state[:mode] = 0444 @current_state[:owner] = 50 - mode = stub 'mode_change' - owner = stub 'owner_change' + mode = stub_everything 'mode_change' + owner = stub_everything 'owner_change' Puppet::Transaction::Change.expects(:new).with(@resource.parameter(:mode), 0444).returns mode Puppet::Transaction::Change.expects(:new).with(@resource.parameter(:owner), 50).returns owner @@ -285,6 +256,148 @@ describe Puppet::Transaction::ResourceHarness do @harness.cached("myres", "foo").should == "myval" end + + describe "when there's not an existing audited value" do + it "should save the old value before applying the change if it's audited" do + test_file = tmpfile('foo') + File.open(test_file, "w", 0750).close + + resource = Puppet::Type.type(:file).new :path => test_file, :mode => '755', :audit => :mode + + @harness.evaluate(resource) + @harness.cached(resource, :mode).should == "750" + + (File.stat(test_file).mode & 0777).should == 0755 + @logs.map {|l| "#{l.level}: #{l.source}: #{l.message}"}.should =~ [ + "notice: /#{resource}/mode: mode changed '750' to '755'", + "notice: /#{resource}/mode: audit change: newly-recorded recorded value 750" + ] + end + + it "should audit the value if there's no change" do + test_file = tmpfile('foo') + File.open(test_file, "w", 0755).close + + resource = Puppet::Type.type(:file).new :path => test_file, :mode => '755', :audit => :mode + + @harness.evaluate(resource) + @harness.cached(resource, :mode).should == "755" + + (File.stat(test_file).mode & 0777).should == 0755 + + @logs.map {|l| "#{l.level}: #{l.source}: #{l.message}"}.should =~ [ + "notice: /#{resource}/mode: audit change: newly-recorded recorded value 755" + ] + end + + it "should have :absent for audited value if the file doesn't exist" do + test_file = tmpfile('foo') + + resource = Puppet::Type.type(:file).new :ensure => 'present', :path => test_file, :mode => '755', :audit => :mode + + @harness.evaluate(resource) + @harness.cached(resource, :mode).should == :absent + + (File.stat(test_file).mode & 0777).should == 0755 + @logs.map {|l| "#{l.level}: #{l.source}: #{l.message}"}.should =~ [ + "notice: /#{resource}/ensure: created", + "notice: /#{resource}/mode: audit change: newly-recorded recorded value absent" + ] + end + + it "should do nothing if there are no changes to make and the stored value is correct" do + test_file = tmpfile('foo') + + resource = Puppet::Type.type(:file).new :path => test_file, :mode => '755', :audit => :mode, :ensure => 'absent' + @harness.cache(resource, :mode, :absent) + + @harness.evaluate(resource) + @harness.cached(resource, :mode).should == :absent + + File.exists?(test_file).should == false + @logs.map {|l| "#{l.level}: #{l.source}: #{l.message}"}.should =~ [] + end + end + + describe "when there's an existing audited value" do + it "should save the old value before applying the change" do + test_file = tmpfile('foo') + File.open(test_file, "w", 0750).close + + resource = Puppet::Type.type(:file).new :path => test_file, :audit => :mode + @harness.cache(resource, :mode, '555') + + @harness.evaluate(resource) + @harness.cached(resource, :mode).should == "750" + + (File.stat(test_file).mode & 0777).should == 0750 + @logs.map {|l| "#{l.level}: #{l.source}: #{l.message}"}.should =~ [ + "notice: /#{resource}/mode: audit change: previously recorded value 555 has been changed to 750" + ] + end + + it "should save the old value before applying the change" do + test_file = tmpfile('foo') + File.open(test_file, "w", 0750).close + + resource = Puppet::Type.type(:file).new :path => test_file, :mode => '755', :audit => :mode + @harness.cache(resource, :mode, '555') + + @harness.evaluate(resource) + @harness.cached(resource, :mode).should == "750" + + (File.stat(test_file).mode & 0777).should == 0755 + @logs.map {|l| "#{l.level}: #{l.source}: #{l.message}"}.should =~ [ + "notice: /#{resource}/mode: mode changed '750' to '755' (previously recorded value was 555)" + ] + end + + it "should audit the value if there's no change" do + test_file = tmpfile('foo') + File.open(test_file, "w", 0755).close + + resource = Puppet::Type.type(:file).new :path => test_file, :mode => '755', :audit => :mode + @harness.cache(resource, :mode, '555') + + @harness.evaluate(resource) + @harness.cached(resource, :mode).should == "755" + + (File.stat(test_file).mode & 0777).should == 0755 + @logs.map {|l| "#{l.level}: #{l.source}: #{l.message}"}.should =~ [ + "notice: /#{resource}/mode: audit change: previously recorded value 555 has been changed to 755" + ] + end + + it "should have :absent for audited value if the file doesn't exist" do + test_file = tmpfile('foo') + + resource = Puppet::Type.type(:file).new :ensure => 'present', :path => test_file, :mode => '755', :audit => :mode + @harness.cache(resource, :mode, '555') + + @harness.evaluate(resource) + @harness.cached(resource, :mode).should == :absent + + (File.stat(test_file).mode & 0777).should == 0755 + + @logs.map {|l| "#{l.level}: #{l.source}: #{l.message}"}.should =~ [ + "notice: /#{resource}/ensure: created", "notice: /#{resource}/mode: audit change: previously recorded value 555 has been changed to absent" + ] + end + + it "should do nothing if there are no changes to make and the stored value is correct" do + test_file = tmpfile('foo') + File.open(test_file, "w", 0755).close + + resource = Puppet::Type.type(:file).new :path => test_file, :mode => '755', :audit => :mode + @harness.cache(resource, :mode, '755') + + @harness.evaluate(resource) + @harness.cached(resource, :mode).should == "755" + + (File.stat(test_file).mode & 0777).should == 0755 + @logs.map {|l| "#{l.level}: #{l.source}: #{l.message}"}.should =~ [] + end + end end describe "when determining whether the resource can be changed" do diff --git a/test/lib/puppettest/support/utils.rb b/test/lib/puppettest/support/utils.rb index e022f123c..bca5d9634 100644 --- a/test/lib/puppettest/support/utils.rb +++ b/test/lib/puppettest/support/utils.rb @@ -92,7 +92,7 @@ module PuppetTest::Support::Utils method = type trans.send(method) - newevents = trans.events.reject { |e| e.status == 'failure' }.collect { |e| + newevents = trans.events.reject { |e| ['failure', 'audit'].include? e.status }.collect { |e| e.name } diff --git a/test/ral/type/filesources.rb b/test/ral/type/filesources.rb index dd73cea27..242a82e83 100755 --- a/test/ral/type/filesources.rb +++ b/test/ral/type/filesources.rb @@ -327,12 +327,9 @@ class TestFileSources < Test::Unit::TestCase file = nil assert_nothing_raised { - - file = Puppet::Type.type(:file).new( - + file = Puppet::Type.type(:file).new( :name => dest, :ensure => "file", - :source => source ) } -- cgit From 3ac50fab81216789d6d5f7d22cb675d3264674cd Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Mon, 13 Dec 2010 13:30:24 -0800 Subject: maint: restore plugin handler safety The previous maintenance patch for this file didn't provide as strong of a guarantee of loading plugins as the code it replaced. This patch restores the extremely broad exception catching, but prevents mocha exceptions from being silently ignored. --- lib/puppet/configurer/plugin_handler.rb | 2 +- spec/unit/configurer/plugin_handler_spec.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/puppet/configurer/plugin_handler.rb b/lib/puppet/configurer/plugin_handler.rb index 8192d4719..cfc6b5a0b 100644 --- a/lib/puppet/configurer/plugin_handler.rb +++ b/lib/puppet/configurer/plugin_handler.rb @@ -19,7 +19,7 @@ module Puppet::Configurer::PluginHandler begin Puppet.info "Loading downloaded plugin #{file}" load file - rescue StandardError, LoadError => detail + rescue Exception => detail Puppet.err "Could not load downloaded file #{file}: #{detail}" end end diff --git a/spec/unit/configurer/plugin_handler_spec.rb b/spec/unit/configurer/plugin_handler_spec.rb index 1423ae4b5..30b135e8f 100755 --- a/spec/unit/configurer/plugin_handler_spec.rb +++ b/spec/unit/configurer/plugin_handler_spec.rb @@ -11,6 +11,10 @@ end describe Puppet::Configurer::PluginHandler do before do @pluginhandler = PluginHandlerTester.new + + # PluginHandler#load_plugin has an extra-strong rescue clause + # this mock is to make sure that we don't silently ignore errors + Puppet.expects(:err).never end it "should have a method for downloading plugins" do -- cgit From 7f4e058133a0aa6b07bd3402cf01009818066d32 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Mon, 13 Dec 2010 17:07:33 -0800 Subject: (#4487) Fix environment column in hosts table An entire environment object was being stored in a string field, causing the ZAML form of the environment to be stored. This was over-ridden to return just the ZAML serialized version of the name. Since the hosts model didn't know how to interpret a serialized value, it just returned the ZAML string as the environment. This patch stringifies the environment before putting it in the hosts table, which stores it properly. This patch also introduces a new method of testing using Tableless ActiveRecord models, which emulate their database schema. This helps to eliminate some stubbing, but it is still impossible to fully and accurately test all ActiveRecord interactions without a real database. Paired-With: Matt Robinson --- lib/puppet/indirector/catalog/active_record.rb | 2 +- spec/unit/indirector/catalog/active_record_spec.rb | 37 +++++++++++++++------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/lib/puppet/indirector/catalog/active_record.rb b/lib/puppet/indirector/catalog/active_record.rb index fabb08eb9..f814f4aff 100644 --- a/lib/puppet/indirector/catalog/active_record.rb +++ b/lib/puppet/indirector/catalog/active_record.rb @@ -32,7 +32,7 @@ class Puppet::Resource::Catalog::ActiveRecord < Puppet::Indirector::ActiveRecord if node = Puppet::Node.find(catalog.name) host.ip = node.parameters["ipaddress"] - host.environment = node.environment + host.environment = node.environment.to_s end host.save diff --git a/spec/unit/indirector/catalog/active_record_spec.rb b/spec/unit/indirector/catalog/active_record_spec.rb index 4e9d049a1..df61d59d7 100755 --- a/spec/unit/indirector/catalog/active_record_spec.rb +++ b/spec/unit/indirector/catalog/active_record_spec.rb @@ -6,6 +6,23 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "Puppet::Resource::Catalog::ActiveRecord" do confine "Missing Rails" => Puppet.features.rails? + require 'puppet/rails' + class Tableless < ActiveRecord::Base + def self.columns + @columns ||= [] + end + def self.column(name, sql_type=nil, default=nil, null=true) + columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null) + end + end + + class Host < Tableless + column :name, :string, :null => false + column :ip, :string + column :environment, :string + column :last_compile, :datetime + end + before do require 'puppet/indirector/catalog/active_record' Puppet.features.stubs(:rails?).returns true @@ -76,15 +93,17 @@ describe "Puppet::Resource::Catalog::ActiveRecord" do describe "when saving an instance" do before do - @host = stub 'host', :name => "foo", :save => nil, :merge_resources => nil, :last_compile= => nil, :ip= => nil, :environment= => nil + @host = Host.new(:name => "foo") + @host.stubs(:merge_resources) + @host.stubs(:save) @host.stubs(:railsmark).yields - @node = stub_everything 'node', :parameters => {} - Puppet::Node.stubs(:find).returns(@node) + @node = Puppet::Node.new("foo", :environment => "environment") + Puppet::Node.indirection.stubs(:find).with("foo").returns(@node) Puppet::Rails::Host.stubs(:find_by_name).returns @host @catalog = Puppet::Resource::Catalog.new("foo") - @request = stub 'request', :key => "foo", :instance => @catalog + @request = Puppet::Indirector::Request.new(:active_record, :save, @catalog) end it "should find the Rails host with the same name" do @@ -111,25 +130,21 @@ describe "Puppet::Resource::Catalog::ActiveRecord" do it "should set host ip if we could find a matching node" do @node.stubs(:parameters).returns({"ipaddress" => "192.168.0.1"}) - @host.expects(:ip=).with '192.168.0.1' - @terminus.save(@request) + @host.ip.should == '192.168.0.1' end it "should set host environment if we could find a matching node" do - @node.stubs(:environment).returns("myenv") - - @host.expects(:environment=).with 'myenv' - @terminus.save(@request) + @host.environment.should == "environment" end it "should set the last compile time on the host" do now = Time.now Time.expects(:now).returns now - @host.expects(:last_compile=).with now @terminus.save(@request) + @host.last_compile.should == now end it "should save the Rails host instance" do -- cgit From cca3436db8ba90eeaeefd8a58567becfcb330acc Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Tue, 14 Dec 2010 11:51:13 -0800 Subject: (#5427) Remove redundant testunit tests These tests are now better tested in the specs. Paired-with: Nick Lewis --- test/ral/providers/host/parsed.rb | 205 -------------------------------------- 1 file changed, 205 deletions(-) diff --git a/test/ral/providers/host/parsed.rb b/test/ral/providers/host/parsed.rb index 1e847f8e7..521654d53 100755 --- a/test/ral/providers/host/parsed.rb +++ b/test/ral/providers/host/parsed.rb @@ -2,7 +2,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../lib/puppettest') -require 'etc' require 'puppettest' require 'puppettest/fileparsing' require 'test/unit' @@ -25,213 +24,9 @@ class TestParsedHostProvider < Test::Unit::TestCase super end - def test_provider_existence - assert(@provider, "Could not retrieve provider") - end - - # Here we just create a fake host type that answers to all of the methods - # but does not modify our actual system. - def mkfaketype - @provider.filetype = Puppet::Util::FileType.filetype(:ram) - end - - def mkhosthash - if defined?(@hcount) - @hcount += 1 - else - @hcount = 1 - end - - return { - :name => "fakehost#{@hcount}", - :ip => "192.168.27.#{@hcount}", - :host_aliases => ["alias#{@hcount}"], - :ensure => :present - } - end - - def mkhost - hash = mkhosthash - - fakeresource = fakeresource(:host, hash[:name]) - - host = @provider.new(fakeresource) - - assert(host, "Could not create provider host") - hash.each do |name, val| - host.send(name.to_s + "=", val) - end - - host - end - - # Make sure we convert both directlys correctly using a simple host. - def test_basic_isomorphism - hash = {:record_type => :parsed, :name => "myhost", :ip => "192.168.43.56", :host_aliases => %w{another host}, - :comment => ''} - - str = nil - assert_nothing_raised do - str = @provider.to_line(hash) - end - - assert_equal("192.168.43.56\tmyhost\tanother\thost", str) - - newhash = nil - assert_nothing_raised do - newhash = @provider.parse(str).shift - end - - assert_equal(hash, newhash) - end - - # Make sure parsing gets comments, blanks, and hosts - def test_blanks_and_comments - mkfaketype - text = %{# comment one - -192.168.43.56\tmyhost\tanother\thost - -# another comment -192.168.43.57\tanotherhost -} - - instances = nil - assert_nothing_raised do - instances = @provider.parse(text) - end - - - assert_equal( - [ - {:record_type => :comment, :line => "# comment one"}, - {:record_type => :blank, :line => ""}, - {:record_type => :parsed, :name => "myhost", :ip => "192.168.43.56", :host_aliases => %w{another host}, - :comment => ''}, - {:record_type => :blank, :line => " "}, - {:record_type => :comment, :line => "# another comment"}, - - {:record_type => :parsed, :name => "anotherhost", :ip => "192.168.43.57", :host_aliases => [], - :comment => ''} - ], instances) - - newtext = nil - assert_nothing_raised do - newtext = @provider.to_file(instances).gsub(/^# HEADER.+\n/, '') - end - - assert_equal(text, newtext) - end - - def test_simplehost - mkfaketype - @provider.default_target = :yayness - file = @provider.target_object(:yayness) - - # Start out with no content. - assert_nothing_raised { - assert_equal([], @provider.parse(file.read)) - } - - # Now create a provider - host = nil - assert_nothing_raised { - host = mkhost - } - - # Make sure we're still empty - assert_nothing_raised { - assert_equal([], @provider.parse(file.read)) - } - - # Try storing it - assert_nothing_raised do - host.flush - end - - # Make sure we get the host back - assert_nothing_raised { - - assert( - file.read.include?(host.name), - - "Did not flush host to disk") - } - - # Remove a single field and make sure it gets tossed - name = host.host_aliases - host.host_aliases = [:absent] - - assert_nothing_raised { - host.flush - - assert( - ! file.read.include?(name[0]), - - "Did not remove host_aliases from disk") - } - - # Make sure it throws up if we remove a required field - host.ip = :absent - - assert_raise(ArgumentError) { - host.flush - } - - # Now remove the whole object - host.ensure = :absent - assert_nothing_raised { - host.flush - assert_equal([], @provider.parse(file.read)) - } - end - # Parse our sample data and make sure we regenerate it correctly. def test_hostsparse fakedata("data/types/hosts").each do |file| fakedataparse(file) end end - - # Make sure we can modify the file elsewhere and those modifications will - # get taken into account. - def test_modifyingfile - hostfile = tempfile - @provider.default_target = hostfile - - file = @provider.target_object(hostfile) - - hosts = [] - 3.times { - h = mkhost - hosts << h - } - - hosts.each do |host| - host.flush - end - - newhost = mkhost - hosts << newhost - - # Now store our new host - newhost.flush - - # Verify we can retrieve that info - assert_nothing_raised("Could not retrieve after second write") { - @provider.prefetch - } - - text = file.read - - instances = @provider.parse(text) - - # And verify that we have data for everything - hosts.each { |host| - name = host.resource[:name] - assert(text.include?(name), "Host #{name} is not in file") - hash = host.property_hash - assert(! hash.empty?, "Could not find host #{name}") - assert(hash[:ip], "Could not find ip for host #{name}") - } - end end -- cgit From b94c1b444d76a7fa1bcd63dd6ba653abf0b49826 Mon Sep 17 00:00:00 2001 From: Stefan Schulte Date: Thu, 18 Nov 2010 23:38:10 +0100 Subject: (#5427) Using Propery::OrderedList for host_alias This uses the propertyclass Puppet::Property::OrderedList to represent the list of host_aliases. This lets us remove the in_sync, should_to_s etc overrides. In the provider class the list is represented by a string (=no array) so there were a few changes necessary as well. Because Puppet::Property::List uses the specified delimiter when converting should values to strings, I changed the delimiter to a simple space instead a tab. This keeps messages produced by puppet in a nice format. The tests had to be changed to work with the new behaviour of host_aliases. There are a few additional tests as well. --- lib/puppet/provider/host/parsed.rb | 8 ++--- lib/puppet/type/host.rb | 33 ++++++--------------- spec/unit/provider/host/parsed_spec.rb | 28 +++++++++++------- spec/unit/type/host_spec.rb | 53 ++++++++++++++++++++++++++++++++-- 4 files changed, 80 insertions(+), 42 deletions(-) diff --git a/lib/puppet/provider/host/parsed.rb b/lib/puppet/provider/host/parsed.rb index a303c4bcf..2ba01a41c 100644 --- a/lib/puppet/provider/host/parsed.rb +++ b/lib/puppet/provider/host/parsed.rb @@ -22,9 +22,7 @@ Puppet::Type.type(:host).provide(:parsed,:parent => Puppet::Provider::ParsedFile # An absent comment should match "comment => ''" hash[:comment] = '' if hash[:comment].nil? or hash[:comment] == :absent unless hash[:host_aliases].nil? or hash[:host_aliases] == :absent - hash[:host_aliases] = hash[:host_aliases].split(/\s+/) - else - hash[:host_aliases] = [] + hash[:host_aliases].gsub!(/\s+/,' ') # Change delimiter end }, :to_line => proc { |hash| @@ -32,8 +30,8 @@ Puppet::Type.type(:host).provide(:parsed,:parent => Puppet::Provider::ParsedFile raise ArgumentError, "#{n} is a required attribute for hosts" unless hash[n] and hash[n] != :absent end str = "#{hash[:ip]}\t#{hash[:name]}" - if hash.include? :host_aliases and !hash[:host_aliases].empty? - str += "\t#{hash[:host_aliases].join("\t")}" + if hash.include? :host_aliases and !hash[:host_aliases].nil? and hash[:host_aliases] != :absent + str += "\t#{hash[:host_aliases]}" end if hash.include? :comment and !hash[:comment].empty? str += "\t# #{hash[:comment]}" diff --git a/lib/puppet/type/host.rb b/lib/puppet/type/host.rb index 1af74d886..867ef2ab3 100755 --- a/lib/puppet/type/host.rb +++ b/lib/puppet/type/host.rb @@ -1,3 +1,5 @@ +require 'puppet/property/ordered_list' + module Puppet newtype(:host) do ensurable @@ -13,41 +15,24 @@ module Puppet end - newproperty(:host_aliases) do + # for now we use OrderedList to indicate that the order does matter. + newproperty(:host_aliases, :parent => Puppet::Property::OrderedList) do desc "Any aliases the host might have. Multiple values must be specified as an array." - def insync?(is) - is == @should + def delimiter + " " end - def is_to_s(currentvalue = @is) - currentvalue = [currentvalue] unless currentvalue.is_a? Array - currentvalue.join(" ") - end - - # We actually want to return the whole array here, not just the first - # value. - def should - if defined?(@should) - if @should == [:absent] - return :absent - else - return @should - end - else - return nil - end - end - - def should_to_s(newvalue = @should) - newvalue.join(" ") + def inclusive? + true end validate do |value| raise Puppet::Error, "Host aliases cannot include whitespace" if value =~ /\s/ raise Puppet::Error, "Host alias cannot be an empty string. Use an empty array to delete all host_aliases " if value =~ /^\s*$/ end + end newproperty(:comment) do diff --git a/spec/unit/provider/host/parsed_spec.rb b/spec/unit/provider/host/parsed_spec.rb index 3e00a2190..5704304ba 100644 --- a/spec/unit/provider/host/parsed_spec.rb +++ b/spec/unit/provider/host/parsed_spec.rb @@ -28,9 +28,13 @@ describe provider_class do hostresource = Puppet::Type::Host.new(:name => args[:name]) hostresource.stubs(:should).with(:target).returns @hostfile - # Using setters of provider + # Using setters of provider to build our testobject + # Note: We already proved, that in case of host_aliases + # the provider setter "host_aliases=(value)" will be + # called with the joined array, so we just simulate that host = @provider.new(hostresource) args.each do |property,value| + value = value.join(" ") if property == :host_aliases and value.is_a?(Array) host.send("#{property}=", value) end host @@ -63,6 +67,10 @@ describe provider_class do @provider.parse_line("::1 localhost")[:comment].should == "" end + it "should set host_aliases to :absent" do + @provider.parse_line("::1 localhost")[:host_aliases].should == :absent + end + end describe "when parsing a line with ip, hostname and comment" do @@ -87,13 +95,13 @@ describe provider_class do describe "when parsing a line with ip, hostname and aliases" do it "should parse alias from the third field" do - @provider.parse_line("127.0.0.1 localhost localhost.localdomain")[:host_aliases].should == ["localhost.localdomain"] + @provider.parse_line("127.0.0.1 localhost localhost.localdomain")[:host_aliases].should == "localhost.localdomain" end it "should parse multiple aliases" do - @provider.parse_line("127.0.0.1 host alias1 alias2")[:host_aliases].should == ['alias1', 'alias2'] - @provider.parse_line("127.0.0.1 host alias1\talias2")[:host_aliases].should == ['alias1', 'alias2'] - @provider.parse_line("127.0.0.1 host alias1\talias2 alias3")[:host_aliases].should == ['alias1', 'alias2', 'alias3'] + @provider.parse_line("127.0.0.1 host alias1 alias2")[:host_aliases].should == 'alias1 alias2' + @provider.parse_line("127.0.0.1 host alias1\talias2")[:host_aliases].should == 'alias1 alias2' + @provider.parse_line("127.0.0.1 host alias1\talias2 alias3")[:host_aliases].should == 'alias1 alias2 alias3' end end @@ -114,7 +122,7 @@ describe provider_class do end it "should parse all host_aliases from the third field" do - @provider.parse_line(@testline)[:host_aliases].should == ['alias1' ,'alias2', 'alias3'] + @provider.parse_line(@testline)[:host_aliases].should == 'alias1 alias2 alias3' end it "should parse the comment after the first '#' character" do @@ -143,7 +151,7 @@ describe provider_class do host = mkhost( :name => 'localhost.localdomain', :ip => '127.0.0.1', - :host_aliases => ['localhost'], + :host_aliases => 'localhost', :ensure => :present ) genhost(host).should == "127.0.0.1\tlocalhost.localdomain\tlocalhost\n" @@ -156,7 +164,7 @@ describe provider_class do :host_aliases => [ 'a1','a2','a3','a4' ], :ensure => :present ) - genhost(host).should == "192.0.0.1\thost\ta1\ta2\ta3\ta4\n" + genhost(host).should == "192.0.0.1\thost\ta1 a2 a3 a4\n" end it "should be able to generate a simple hostfile entry with comments" do @@ -173,7 +181,7 @@ describe provider_class do host = mkhost( :name => 'localhost.localdomain', :ip => '127.0.0.1', - :host_aliases => ['localhost'], + :host_aliases => 'localhost', :comment => 'Bazinga!', :ensure => :present ) @@ -188,7 +196,7 @@ describe provider_class do :comment => 'Bazinga!', :ensure => :present ) - genhost(host).should == "192.0.0.1\thost\ta1\ta2\ta3\ta4\t# Bazinga!\n" + genhost(host).should == "192.0.0.1\thost\ta1 a2 a3 a4\t# Bazinga!\n" end end diff --git a/spec/unit/type/host_spec.rb b/spec/unit/type/host_spec.rb index 36ef460c1..60ce73c6d 100755 --- a/spec/unit/type/host_spec.rb +++ b/spec/unit/type/host_spec.rb @@ -2,12 +2,14 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') -ssh_authorized_key = Puppet::Type.type(:ssh_authorized_key) +host = Puppet::Type.type(:host) -describe Puppet::Type.type(:host) do +describe host do before do - @class = Puppet::Type.type(:host) + @class = host @catalog = Puppet::Resource::Catalog.new + @provider = stub 'provider' + @resource = stub 'resource', :resource => nil, :provider => @provider end it "should have :name be its namevar" do @@ -26,6 +28,11 @@ describe Puppet::Type.type(:host) do @class.attrtype(property).should == :property end end + + it "should have a list host_aliases" do + @class.attrclass(:host_aliases).ancestors.should be_include(Puppet::Property::OrderedList) + end + end describe "when validating values" do @@ -80,4 +87,44 @@ describe Puppet::Type.type(:host) do proc { @class.new(:name => "foo", :host_aliases => ['alias1','']) }.should raise_error end end + + describe "when syncing" do + + it "should send the first value to the provider for ip property" do + @ip = @class.attrclass(:ip).new(:resource => @resource, :should => %w{192.168.0.1 192.168.0.2}) + @provider.expects(:ip=).with '192.168.0.1' + @ip.sync + end + + it "should send the first value to the provider for comment property" do + @comment = @class.attrclass(:comment).new(:resource => @resource, :should => %w{Bazinga Notme}) + @provider.expects(:comment=).with 'Bazinga' + @comment.sync + end + + it "should send the joined array to the provider for host_alias" do + @host_aliases = @class.attrclass(:host_aliases).new(:resource => @resource, :should => %w{foo bar}) + @provider.expects(:host_aliases=).with 'foo bar' + @host_aliases.sync + end + + it "should also use the specified delimiter for joining" do + @host_aliases = @class.attrclass(:host_aliases).new(:resource => @resource, :should => %w{foo bar}) + @host_aliases.stubs(:delimiter).returns "\t" + @provider.expects(:host_aliases=).with "foo\tbar" + @host_aliases.sync + end + + it "should care about the order of host_aliases" do + @host_aliases = @class.attrclass(:host_aliases).new(:resource => @resource, :should => %w{foo bar}) + @host_aliases.insync?(%w{foo bar}).should == true + @host_aliases.insync?(%w{bar foo}).should == false + end + + it "should not consider aliases to be in sync if should is a subset of current" do + @host_aliases = @class.attrclass(:host_aliases).new(:resource => @resource, :should => %w{foo bar}) + @host_aliases.insync?(%w{foo bar anotherone}).should == false + end + + end end -- cgit