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


#1

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?


#2

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?


#3

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?


#4

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


#5

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


#6

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


#7

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:

https://github.com/fnichol/chef-ruby_build/issues/2

The workaround for which is:

https://github.com/hedgehog/chef-ruby_build/commit/3ad58600f16d24e7aa51fa0ec66f51ba2ba62038

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