Please review pull request #145: Maint: Ensure cached catalogs get deleted before starting agent/master test cases opened by (joshcooper)

Description:

These commits ensure with_master_running_on deletes the contents of the puppet agent vardir, and fixes an issue on Windows due to paths with spaces.

  • Opened: Tue Feb 14 00:23:22 UTC 2012
  • Based on: puppetlabs:master (aab8cb10d88546be057580632405e439b680edde)
  • Requested merge: joshcooper:maint/master/vardir-not-getting-deleted (3382f9c608b51169adb6657011e4092f3024ad5d)

Diff follows:

diff --git a/lib/host/windows.rb b/lib/host/windows.rb
index f41e7dc..f76d806 100644
--- a/lib/host/windows.rb
+++ b/lib/host/windows.rb
@@ -16,8 +16,8 @@ class Host < Host
     DEFAULTS = {
       'user'         => 'Administrator',
       'group'        => 'Administrators',
-      'puppetpath'   => '"`cygpath -F 35`/PuppetLabs/puppet/etc"',
-      'puppetvardir' => '"`cygpath -F 35`/PuppetLabs/puppet/var"'
+      'puppetpath'   => '`cygpath -smF 35`/PuppetLabs/puppet/etc',
+      'puppetvardir' => '`cygpath -smF 35`/PuppetLabs/puppet/var'
     }
 
     def initialize(name, overrides, defaults)
diff --git a/lib/test_case.rb b/lib/test_case.rb
index 9cc3612..1032ca5 100644
--- a/lib/test_case.rb
+++ b/lib/test_case.rb
@@ -283,9 +283,9 @@ def with_master_running_on(host, arg='--daemonize', &block)
 
     on hosts, host_command('rm -rf #{host["puppetpath"]}/ssl')
     agents.each do |agent|
-      if ((vardir = agent['puppetvardir']) && File.exists?(vardir))
+      if vardir = agent['puppetvardir']
         # we want to remove everything except the log directory
-        on agent, "for f in #{vardir}/*; do if [ \"$f\" != \"#{vardir}/log\" ]; then rm -r \"$f\"; fi; done"
+        on agent, "if [ -e \"#{vardir}\" ]; then for f in #{vardir}/*; do if [ \"$f\" != \"#{vardir}/log\" ]; then rm -rf \"$f\"; fi; done; fi"
       end
     end
 

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to