Issue #8415 has been updated by Jeff McCune.

Category set to cloudpack
Status changed from Unreviewed to Merged - Pending Release
Assignee set to Dan Bode
Target version set to 0.6.0

# Merged #

This has been merged into master as:

(Dan says he has tests pending, which will be another merge)

<pre>
commit fe2449365d581e888961b4d29e04b87ffc3d4e75
Merge: ac2e540 b11d6a3
Author: Jeff McCune <[email protected]>
Date:   Thu Jul 14 14:06:20 2011 -0700

    Merge branch 'issue/master/8415_fix_tmp_file'
    
    * issue/master/8415_fix_tmp_file:
      (#8415) Clean up tmp script file

commit b11d6a31097d5ef5248716cb42ad9debbbdc21f3
Author: Dan Bode <[email protected]>
Date:   Wed Jul 13 19:13:38 2011 -0700

    (#8415) Clean up tmp script file
    
    Previously, I was using File to write to a file
    that I had created with Tempfile.
    
    This appeared to cause problems b/c I had not
    properly closed the Tempfile handle.
    
    Issue is resolved by using the Tempfile API for both
    creation and writing the file.
    
    I have also added code that explicitly closes the file
    handle.
    
    Reviewed-by: Jeff McCune
</pre>
----------------------------------------
Bug #8415: script tmp file does not always exist when we try to scp it
https://projects.puppetlabs.com/issues/8415

Author: Dan Bode
Status: Merged - Pending Release
Priority: High
Assignee: Dan Bode
Category: cloudpack
Target version: 0.6.0
Keywords: 
Branch: 
https://github.com/bodepd/puppet-cloudpack/tree/issue/master/8415_fix_tmp_file


The symptom of this issue is the following error message:

<pre>
err: No such file or directory - 
/var/folders/co/coFoByf5E3GCBRvVpQOD6E+++TI/-Tmp-/install_script20110713-12603-hrci3m-0
err: Try 'puppet help node install' for usage
</pre>

The problem appears to be that I was writing to a temporary file without 
closing it properly.

The following code seems to resolve the issue:

<pre>
-      tmp_install_script = Tempfile.new('install_script').path
-      File.open(tmp_install_script, 'w') do |fh|
-        fh.write(install_script)
+
+      # create a temp file to write compiled script to
+      # capture the name of the path as tmp_install_script
+      tmp_install_script = begin
+        f = Tempfile.open('install_script')
+        f.write(install_script)
+        f.path
+      ensure
+        f.close
       end
</pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to