Using /var/chef/tmp instead of /tmp as a workspace for recipes

It came to my attention this morning that some admins mount the /tmp with
the noexec flag

The java::oracle recipe downloads the oracle jdk*.bin file to the tmp
directory and executes it there. The result is an unpacked jdk directory

Would it be useful for me to use a new directory like /var/chef/tmp instead
of /tmp for this kind of thing?

i prefer to use the Chef::Config[:file_cache_path] (which usually points to
/var/chef/cache) for similar use cases

On Thu, Jun 14, 2012 at 2:02 PM, Bryan Berry bryan.berry@gmail.com wrote:

It came to my attention this morning that some admins mount the /tmp with
the noexec flag

The java::oracle recipe downloads the oracle jdk*.bin file to the tmp
directory and executes it there. The result is an unpacked jdk directory

Would it be useful for me to use a new directory like /var/chef/tmp
instead of /tmp for this kind of thing?

I mirror Ranjib Dey's feedback -- we use the :file_cache_path for
similar purposes

--AJ

On 14 June 2012 18:05, Ranjib Dey ranjibd@thoughtworks.com wrote:

i prefer to use the Chef::Config[:file_cache_path] (which usually points to
/var/chef/cache) for similar use cases

On Thu, Jun 14, 2012 at 2:02 PM, Bryan Berry bryan.berry@gmail.com wrote:

It came to my attention this morning that some admins mount the /tmp with
the noexec flag

The java::oracle recipe downloads the oracle jdk*.bin file to the tmp
directory and executes it there. The result is an unpacked jdk directory

Would it be useful for me to use a new directory like /var/chef/tmp
instead of /tmp for this kind of thing?

Hi,

On Wed, Jun 13, 2012 at 11:05 PM, Ranjib Dey ranjibd@thoughtworks.com wrote:

i prefer to use the Chef::Config[:file_cache_path] (which usually points to
/var/chef/cache) for similar use cases

I'm also a fan of of using Chef::Config[:file_cache_path] for things
like this. It is also helpful in cases where /tmp is being mounted as
a tmpfs and avoid chef-client runs periodically taking longer after
something cleared out /tmp.

Cheers,

Steven

sounds like there is consensus

Would this make for a good foodcritic rule?

Dir.mktmpdir w/out arguments creates a directory in /tmp

Dir.mktmpdir("/foo/bar") creates a tmpdir in /foo/bar/

a foodcritic rule would flag Dir.mktmpdir w/out a prefix

Would such a rule be useful to anyone besides me?

On Thu, Jun 14, 2012 at 8:11 AM, Steven Danna steve@opscode.com wrote:

Hi,

On Wed, Jun 13, 2012 at 11:05 PM, Ranjib Dey ranjibd@thoughtworks.com
wrote:

i prefer to use the Chef::Config[:file_cache_path] (which usually points
to
/var/chef/cache) for similar use cases

I'm also a fan of of using Chef::Config[:file_cache_path] for things
like this. It is also helpful in cases where /tmp is being mounted as
a tmpfs and avoid chef-client runs periodically taking longer after
something cleared out /tmp.

Cheers,

Steven

On Thu, Jun 14, 2012 at 4:16 PM, Bryan Berry bryan.berry@gmail.com wrote:

sounds like there is consensus

Would this make for a good foodcritic rule?

Just a heads up on:

http://tickets.opscode.com/browse/CHEF-2786

Which can result in issues like this:

The workaround for which is:

HTH

Dir.mktmpdir w/out arguments creates a directory in /tmp

Dir.mktmpdir("/foo/bar") creates a tmpdir in /foo/bar/

a foodcritic rule would flag Dir.mktmpdir w/out a prefix

Would such a rule be useful to anyone besides me?

On Thu, Jun 14, 2012 at 8:11 AM, Steven Danna steve@opscode.com wrote:

Hi,

On Wed, Jun 13, 2012 at 11:05 PM, Ranjib Dey ranjibd@thoughtworks.com
wrote:

i prefer to use the Chef::Config[:file_cache_path] (which usually points
to
/var/chef/cache) for similar use cases

I'm also a fan of of using Chef::Config[:file_cache_path] for things
like this. It is also helpful in cases where /tmp is being mounted as
a tmpfs and avoid chef-client runs periodically taking longer after
something cleared out /tmp.

Cheers,

Steven

--
πόλλ' οἶδ ἀλώπηξ, ἀλλ' ἐχῖνος ἓν μέγα
[The fox knows many things, but the hedgehog knows one big thing.]
Archilochus, Greek poet (c. 680 BC – c. 645 BC)
http://hedgehogshiatus.com

hmm, sounds like this calls for a new primitive

Dir.chef_tmpdir that creates a tmpdir in the caching path that chef
configured to use

On Thu, Jun 14, 2012 at 2:44 PM, Hedge Hog hedgehogshiatus@gmail.comwrote:

On Thu, Jun 14, 2012 at 4:16 PM, Bryan Berry bryan.berry@gmail.com
wrote:

sounds like there is consensus

Would this make for a good foodcritic rule?

Just a heads up on:

http://tickets.opscode.com/browse/CHEF-2786

Which can result in issues like this:

Fails with: the enclosing directory /root/.chef/state/cache does not exist · Issue #2 · sous-chefs/ruby_build · GitHub

The workaround for which is:

A workaround that closes issue #2 · hedgehog/chef-ruby_build@3ad5860 · GitHub

HTH

Dir.mktmpdir w/out arguments creates a directory in /tmp

Dir.mktmpdir("/foo/bar") creates a tmpdir in /foo/bar/

a foodcritic rule would flag Dir.mktmpdir w/out a prefix

Would such a rule be useful to anyone besides me?

On Thu, Jun 14, 2012 at 8:11 AM, Steven Danna steve@opscode.com wrote:

Hi,

On Wed, Jun 13, 2012 at 11:05 PM, Ranjib Dey ranjibd@thoughtworks.com
wrote:

i prefer to use the Chef::Config[:file_cache_path] (which usually
points
to
/var/chef/cache) for similar use cases

I'm also a fan of of using Chef::Config[:file_cache_path] for things
like this. It is also helpful in cases where /tmp is being mounted as
a tmpfs and avoid chef-client runs periodically taking longer after
something cleared out /tmp.

Cheers,

Steven

--
πόλλ' οἶδ ἀλώπηξ, ἀλλ' ἐχῖνος ἓν μέγα
[The fox knows many things, but the hedgehog knows one big thing.]
Archilochus, Greek poet (c. 680 BC – c. 645 BC)
http://hedgehogshiatus.com