diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-12-10 18:42:27 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-12-14 12:51:58 -0800 |
commit | 2a07b31a618ba3155f07eaf9453d642426f58d51 (patch) | |
tree | 5004ac15a95c8ac49331f5a54b4684a4cf7fd3e0 /lib/chef/resource/file.rb | |
parent | 27cb74bc5983b31ddbc9de46c8e020122251abe7 (diff) | |
download | chef-2a07b31a618ba3155f07eaf9453d642426f58d51.tar.gz |
implement verifications as a property
the unit tests on this one did some excessive stubbing/mocking, i just
let them create a real verification object which the 'true' or 'false'
then failed (for real).
Diffstat (limited to 'lib/chef/resource/file.rb')
-rw-r--r-- | lib/chef/resource/file.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb index 80fae1b4dc..f5a8cf809c 100644 --- a/lib/chef/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -50,11 +50,6 @@ class Chef default_action :create allowed_actions :create, :delete, :touch, :create_if_missing - def initialize(name, run_context=nil) - super - @verifications = [] - end - property :content, [ String, nil ], desired_state: false property :backup, [ Integer, false ], desired_state: false, default: 5 property :checksum, [ String, nil ], is: /^[a-zA-Z0-9]{64}$/ @@ -63,6 +58,7 @@ class Chef property :atomic_update, [ true, false ], desired_state: false, default: Chef::Config[:file_atomic_update] property :force_unlink, [ true, false ], desired_state: false, default: false property :manage_symlink_source, [ true, false ], desired_state: false + property :verifications, Array, default: [] def verify(command=nil, opts={}, &block) if ! (command.nil? || [String, Symbol].include?(command.class)) @@ -70,9 +66,9 @@ class Chef end if command || block_given? - @verifications << Verification.new(self, command, opts, &block) + verifications << Verification.new(self, command, opts, &block) else - @verifications + verifications end end |