diff options
author | Andrew Brown <andrew.brown@shopify.com> | 2016-05-30 12:01:51 -0400 |
---|---|---|
committer | Andrew Brown <andrew.brown@shopify.com> | 2016-05-30 12:04:47 -0400 |
commit | d8014435565ce81b961dde09b5b801e24d5c2d42 (patch) | |
tree | 7a7d021a2bfc4794841accbe8d176b88f345b3b7 /lib/chef/dsl | |
parent | bb640efa12ac8843658fc45bba9ea70bd15e8221 (diff) | |
download | chef-d8014435565ce81b961dde09b5b801e24d5c2d42.tar.gz |
File atomic update default: false on docker files
If unspecified, the default setting for atomic updates on docker special
files should be 'false' to avoid Errno::EBUSY. This allows for a cookbook
author to override this behaviour if desired.
Diffstat (limited to 'lib/chef/dsl')
-rw-r--r-- | lib/chef/dsl/platform_introspection.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/chef/dsl/platform_introspection.rb b/lib/chef/dsl/platform_introspection.rb index 276a03af63..679b702383 100644 --- a/lib/chef/dsl/platform_introspection.rb +++ b/lib/chef/dsl/platform_introspection.rb @@ -245,6 +245,19 @@ class Chef end end + # Shamelessly stolen from https://github.com/sethvargo/chef-sugar/blob/master/lib/chef/sugar/docker.rb + # Given a node object, returns whether the node is a docker container. + # + # === Parameters + # node:: [Chef::Node] The node to check. + # + # === Returns + # true:: if the current node is a docker container + # false:: if the current node is not a docker container + def docker?(node) + ::File.exist?('/.dockerinit') || ::File.exist?('/.dockerenv') + end + end end end |