diff options
author | sersut <serdar@opscode.com> | 2013-05-20 15:32:15 -0700 |
---|---|---|
committer | sersut <serdar@opscode.com> | 2013-05-20 15:32:15 -0700 |
commit | 669bb5913611ebe4838afee4c120d0006d289646 (patch) | |
tree | 7243d34fb1d79cd3a8f5f8bfc66a422c61b3acd8 /lib/chef | |
parent | 622b857c2dd1d06392a99ff10812b2acf721e0c5 (diff) | |
download | chef-669bb5913611ebe4838afee4c120d0006d289646.tar.gz |
Rename file config parameters to be file_atomic_update & file_staging_uses_destdir
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/config.rb | 8 | ||||
-rw-r--r-- | lib/chef/file_content_management/deploy.rb | 9 | ||||
-rw-r--r-- | lib/chef/file_content_management/tempfile.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/file.rb | 4 | ||||
-rw-r--r-- | lib/chef/resource/file.rb | 6 |
5 files changed, 14 insertions, 15 deletions
diff --git a/lib/chef/config.rb b/lib/chef/config.rb index a010d4874d..9bfc591382 100644 --- a/lib/chef/config.rb +++ b/lib/chef/config.rb @@ -328,12 +328,14 @@ class Chef # only if selinux is enabled in the system. enable_selinux_file_permission_fixup true - # for file resources, deploy files with either :move or :copy - file_deploy_with :move + # Use atomic updates (i.e. move operation) hile updating contents + # of the files resources. When set to false :copy operation is + # used to update files. + file_atomic_update true # If false file deployment is will be done via tempfiles that are # created under ENV['TMP'] otherwise tempfiles will be created in # the directory that files are going to reside. - file_deployment_uses_destdir false + file_staging_uses_destdir false end end diff --git a/lib/chef/file_content_management/deploy.rb b/lib/chef/file_content_management/deploy.rb index a57af7b938..35ea3c6fc8 100644 --- a/lib/chef/file_content_management/deploy.rb +++ b/lib/chef/file_content_management/deploy.rb @@ -25,14 +25,11 @@ end class Chef class FileContentManagement class Deploy - def self.strategy(deploy_with) - case deploy_with - when :move + def self.strategy(atomic_update) + if atomic_update Chef::Platform.windows? ? MvWindows.new() : MvUnix.new() - when :copy - Cp.new() else - raise "invalid deployment strategy use :move or :copy" + Cp.new() end end end diff --git a/lib/chef/file_content_management/tempfile.rb b/lib/chef/file_content_management/tempfile.rb index 30ab89367b..d109e3f51f 100644 --- a/lib/chef/file_content_management/tempfile.rb +++ b/lib/chef/file_content_management/tempfile.rb @@ -52,7 +52,7 @@ class Chef end def tempfile_dirname - Chef::Config[:file_deployment_uses_destdir] ? ::File.dirname(@new_resource.path) : Dir::tmpdir + Chef::Config[:file_staging_uses_destdir] ? ::File.dirname(@new_resource.path) : Dir::tmpdir end end end diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb index 06291a32a0..221cb9fe5e 100644 --- a/lib/chef/provider/file.rb +++ b/lib/chef/provider/file.rb @@ -58,8 +58,8 @@ class Chef def initialize(new_resource, run_context) @content_class ||= Chef::Provider::File::Content - if new_resource.respond_to?(:deploy_with) - @deployment_strategy = Chef::FileContentManagement::Deploy.strategy(new_resource.deploy_with) + if new_resource.respond_to?(:atomic_update) + @deployment_strategy = Chef::FileContentManagement::Deploy.strategy(new_resource.atomic_update) end super end diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb index 3d165017ff..31b08e826d 100644 --- a/lib/chef/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -47,7 +47,7 @@ class Chef @allowed_actions.push(:create, :delete, :touch, :create_if_missing) @provider = Chef::Provider::File @binmode = Platform.windows? ? true : false - @deploy_with = Chef::Config[:file_deploy_with] + @atomic_update = Chef::Config[:file_atomic_update] @force_unlink = false @diff = nil end @@ -101,9 +101,9 @@ class Chef ) end - def deploy_with(arg=nil) + def atomic_update(arg=nil) set_or_return( - :deploy_with, + :atomic_update, arg, :equal_to => [ :move, :copy ] ) |