Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote_file resource uses Tempfile from Chef::HTTP which does not obey file_staging_uses_destdir #2401

Closed
johusta opened this issue Nov 11, 2014 · 10 comments · Fixed by #6701
Labels
Priority: Medium Type: Bug Does not work as expected.

Comments

@johusta
Copy link

johusta commented Nov 11, 2014

I rebuilt my chef-client as it appeared this issue was resolved sometime in Sept and stated to be fixed in 12.0.0.

It still tries to stage to /tmp with this set in my client.rb file.

@lamont-granquist
Copy link
Contributor

You're gonna have to include more information, e.g. a minimal, complete verifiable example:

http://stackoverflow.com/help/mcve

@johusta
Copy link
Author

johusta commented Nov 12, 2014

Hi There
Here is what I have in my client.rb file in /etc/chef. The ssl stuff and validation key stuff is in there as that no longer works now either on the newer level.

validation_client_name "chef-validator" # Registration info
validation_key "/etc/chef/validation.pem" # Registration info
file_staging_uses_destdir true
ssl_verify_mode :verify_none

Here is the output of my chef-client run:

Chef Client failed. 0 resources updated in 38.584187002 seconds
[2014-11-12T08:35:23-05:00] ERROR: remote_file[/home/db2inst1/tpc/tpcc_SRV_tar.gz] (TPCC::TPCC_dl line 44) had an error: Errno::ENOSPC: No space left on device @ io_write - /tmp/chef-rest20141112-117431-dkndr6
[2014-11-12T08:35:23-05:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Thank you

@lamont-granquist lamont-granquist changed the title built the latest 12.0.0 client and file_staging_uses_destdir true still does not work remote_file resource uses Tempfile from Chef::REST which does not obey file_staging_uses_destdir Nov 12, 2014
@lamont-granquist lamont-granquist changed the title remote_file resource uses Tempfile from Chef::REST which does not obey file_staging_uses_destdir remote_file resource uses Tempfile from Chef::HTTP which does not obey file_staging_uses_destdir Nov 12, 2014
@lamont-granquist
Copy link
Contributor

This is the code being used and it needs to accept the remote_file injecting a tempfile to write to, or we need a different API that accepts injecting a tempfile (which stream_to_tempfile could then be refactored to use):

https://github.com/opscode/chef/blob/69b3c83c3fed6fb18855c44854c2de90eccf2259/lib/chef/http.rb#L370

@lamont-granquist
Copy link
Contributor

This has also come up before and is a dup of at least one old ticket in the old ticketing system

@johusta
Copy link
Author

johusta commented Nov 24, 2014

Thank you...do you have an idea of when this may get fixed. I have some time before we go into production but if I run out of time is there a workaround?

@lamont-granquist
Copy link
Contributor

No, not that I'm aware of, and it won't be fixed in 12.0 and unlikely to be fixed in 12.2

@lamont-granquist lamont-granquist added this to the 12.2.0 milestone Nov 24, 2014
@lamont-granquist lamont-granquist modified the milestones: Accepted Minor, 12.1.0 Sep 2, 2015
@julian7
Copy link

julian7 commented Feb 20, 2016

I want to replace an executable, which is used by a process. Therefore it always returns Text File Busy error. My solution was to modify Chef::Provider::RemoteFile::HTTP#fetch:

        def fetch
          http = Chef::HTTP::Simple.new(uri, http_client_opts)
          tempfile = http.streaming_request(uri, headers)
          if tempfile
            update_cache_control_data(tempfile, http.last_response)
            tempfile.close
            stagefile = Chef::FileContentManagement::Tempfile.new(new_resource).tempfile
            Chef::Log.debug("Staging #{tempfile} to #{stagefile}")
            ::FileUtils.mv(tempfile, stagefile)
            tempfile = stagefile
          end
          tempfile
        end

While it continues to use Dir.tmpdir as a default, but it also moves it to the staging area afterwards.

@axos88
Copy link
Contributor

axos88 commented Jan 5, 2017

+1

@thommay thommay added Type: Bug Does not work as expected. Priority: Medium and removed Bug labels Jan 25, 2017
@msgarbossa
Copy link

+1
It seems like Chef::Config[:file_staging_uses_destdir] isn't really defaulting to true in the client config. Also a bigger problem on AIX where filesystems are not as large as Linux.

lamont-granquist added a commit that referenced this issue Dec 19, 2017
use this to inject the tempfile from
Chef::FileContentManagement::Tempfile

closes #2401

Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
@lock
Copy link

lock bot commented Jan 18, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Priority: Medium Type: Bug Does not work as expected.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants