The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #8415

script tmp file does not always exist when we try to scp it

Added by Dan Bode over 3 years ago. Updated 10 months ago.

Status:ClosedStart date:07/13/2011
Priority:HighDue date:
Assignee:Dan Bode% Done:

0%

Category:cloud provisioner
Target version:-
Keywords: cloud_provisioner Affected URL:
Branch:https://github.com/bodepd/puppet-cloudpack/tree/issue/master/8415_fix_tmp_file Affected PE version:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.


Description

The symptom of this issue is the following error message:

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

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:

-      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

History

#1 Updated by Dan Bode over 3 years ago

  • Branch set to https://github.com/bodepd/puppet-cloudpack/tree/issue/master/8415_fix_tmp_file

#2 Updated by Jeff McCune over 3 years ago

  • 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)

commit fe2449365d581e888961b4d29e04b87ffc3d4e75
Merge: ac2e540 b11d6a3
Author: Jeff McCune 
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 
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

#3 Updated by Jeff McCune over 3 years ago

  • Status changed from Merged - Pending Release to Closed

#4 Updated by Charlie Sharpsteen 10 months ago

  • Project changed from Cloud-Provisioner to Puppet Enterprise (Public)
  • Category deleted (cloudpack)
  • Target version deleted (0.6.0)

#5 Updated by Kenn Hussey 10 months ago

  • Category set to cloud provisioner

Also available in: Atom PDF