diff options
author | John Keiser <john@johnkeiser.com> | 2016-09-16 15:57:52 -0700 |
---|---|---|
committer | John Keiser <john@johnkeiser.com> | 2016-09-16 18:14:08 -0700 |
commit | 3ca1e2f8d7a06f7bdf8413f21106c5cb153b304c (patch) | |
tree | e0582c9503b771e54d9770a7f8af155dcb54b960 | |
parent | c9ae0b2e98a4619f9b4092ee03201b791acdf722 (diff) | |
download | chef-jk/file-resource.tar.gz |
Make `file` resource and subtypes use `property`jk/file-resource
-rw-r--r-- | lib/chef/resource/cookbook_file.rb | 21 | ||||
-rw-r--r-- | lib/chef/resource/file.rb | 1 |
2 files changed, 3 insertions, 19 deletions
diff --git a/lib/chef/resource/cookbook_file.rb b/lib/chef/resource/cookbook_file.rb index 785cf693be..8315e3f8b8 100644 --- a/lib/chef/resource/cookbook_file.rb +++ b/lib/chef/resource/cookbook_file.rb @@ -25,25 +25,8 @@ require "chef/mixin/securable" class Chef class Resource class CookbookFile < Chef::Resource::File - include Chef::Mixin::Securable - - default_action :create - - def initialize(name, run_context = nil) - super - @provider = Chef::Provider::CookbookFile - @source = ::File.basename(name) - @cookbook = nil - end - - def source(source_filename = nil) - set_or_return(:source, source_filename, :kind_of => [ String, Array ]) - end - - def cookbook(cookbook_name = nil) - set_or_return(:cookbook, cookbook_name, :kind_of => String) - end - + property :source, [ String, Array ], default: lazy { ::File.basename(path) }, desired_state: false + property :cookbook_name, [ String, Array ], desired_state: false end end end diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb index 7088e7613e..d17d7fb323 100644 --- a/lib/chef/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -50,6 +50,7 @@ class Chef allowed_actions :create, :delete, :touch, :create_if_missing property :path, String, name_property: true, identity: true + property :atomic_update, [ true, false ], desired_state: false, default: lazy { |r| r.docker? && r.special_docker_files?(r.path) ? false : Chef::Config[:file_atomic_update] } property :backup, [ Integer, false ], desired_state: false, default: 5 property :checksum, [ /^[a-zA-Z0-9]{64}$/, nil ] |