[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5
Daniel Pittman
daniel at rimspace.net
Tue May 10 08:05:42 UTC 2011
The following commit has been merged in the experimental branch:
commit f490526726a5f35437cda11652ae9977d89279e5
Author: Daniel Pittman <daniel at rimspace.net>
Date: Thu Mar 3 10:35:27 2011 -0800
(#6582) move more helper code into methods, out of RSpec#configure
We move the tempfile cleanup support off into the module that uses it, which
removes some of the dependency on magic globals from configure. It still
exists, but is hidden in the same module that uses it, which helps.
Reviewed-By: Nick Lewis <nick at puppetlabs.com>
diff --git a/spec/lib/puppet_spec/files.rb b/spec/lib/puppet_spec/files.rb
index 52ed903..38c51a5 100644
--- a/spec/lib/puppet_spec/files.rb
+++ b/spec/lib/puppet_spec/files.rb
@@ -3,6 +3,29 @@ require 'tempfile'
# A support module for testing files.
module PuppetSpec::Files
+ def self.cleanup
+ if defined?($tmpfiles)
+ $tmpfiles.each do |file|
+ file = File.expand_path(file)
+ if Puppet.features.posix? and file !~ /^\/tmp/ and file !~ /^\/var\/folders/
+ puts "Not deleting tmpfile #{file} outside of /tmp or /var/folders"
+ next
+ elsif Puppet.features.microsoft_windows?
+ tempdir = File.expand_path(File.join(Dir::LOCAL_APPDATA, "Temp"))
+ if file !~ /^#{tempdir}/
+ puts "Not deleting tmpfile #{file} outside of #{tempdir}"
+ next
+ end
+ end
+ if FileTest.exist?(file)
+ system("chmod -R 755 '#{file}'")
+ system("rm -rf '#{file}'")
+ end
+ end
+ $tmpfiles.clear
+ end
+ end
+
def tmpfile(name)
source = Tempfile.new(name)
path = source.path
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index cf5f39b..7f36544 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -55,26 +55,7 @@ RSpec.configure do |config|
Puppet::Node::Environment.clear
Puppet::Util::Storage.clear
- if defined?($tmpfiles)
- $tmpfiles.each do |file|
- file = File.expand_path(file)
- if Puppet.features.posix? and file !~ /^\/tmp/ and file !~ /^\/var\/folders/
- puts "Not deleting tmpfile #{file} outside of /tmp or /var/folders"
- next
- elsif Puppet.features.microsoft_windows?
- tempdir = File.expand_path(File.join(Dir::LOCAL_APPDATA, "Temp"))
- if file !~ /^#{tempdir}/
- puts "Not deleting tmpfile #{file} outside of #{tempdir}"
- next
- end
- end
- if FileTest.exist?(file)
- system("chmod -R 755 '#{file}'")
- system("rm -rf '#{file}'")
- end
- end
- $tmpfiles.clear
- end
+ PuppetSpec::Files.cleanup
@logs.clear
Puppet::Util::Log.close_all
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list