diff options
author | Tim Smith <tsmith@chef.io> | 2017-12-19 10:16:28 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-19 10:16:28 -0800 |
commit | 01a801e1caa39a8aee63c569d2c6df41c59da1f7 (patch) | |
tree | f000acda3cb60ed1b4f7ab0051d337fc60c5b462 | |
parent | 1acb731686fb94f77e1c6cda49c3897b851b358a (diff) | |
parent | dfa996aeb1ca89e8fd6b3c6aa5a45629ef4d81e3 (diff) | |
download | chef-01a801e1caa39a8aee63c569d2c6df41c59da1f7.tar.gz |
Merge pull request #6693 from chef/cleanup
Modernize directory resource
-rw-r--r-- | lib/chef/resource/directory.rb | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/lib/chef/resource/directory.rb b/lib/chef/resource/directory.rb index faad659668..b989b3ecde 100644 --- a/lib/chef/resource/directory.rb +++ b/lib/chef/resource/directory.rb @@ -2,7 +2,7 @@ # Author:: Adam Jacob (<adam@chef.io>) # Author:: Seth Chisamore (<schisamo@chef.io>) # Author:: Tyler Cloke (<tyler@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2017, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,14 +19,16 @@ # require "chef/resource" -require "chef/provider/directory" require "chef/mixin/securable" class Chef class Resource + # Use the directory resource to manage a directory, which is a hierarchy of folders that comprises all of the + # information stored on a computer. The root directory is the top-level, under which the rest of the directory + # is organized. The directory resource uses the name property to specify the path to a location in a directory. + # Typically, permission to access that location in the directory is required. class Directory < Chef::Resource - - identity_attr :path + resource_name :directory state_attrs :group, :mode, :owner @@ -35,28 +37,8 @@ class Chef default_action :create allowed_actions :create, :delete - def initialize(name, run_context = nil) - super - @path = name - @recursive = false - end - - def recursive(arg = nil) - set_or_return( - :recursive, - arg, - :kind_of => [ TrueClass, FalseClass ] - ) - end - - def path(arg = nil) - set_or_return( - :path, - arg, - :kind_of => String - ) - end - + property :path, String, name_property: true, identity: true + property :recursive, [ TrueClass, FalseClass ], default: false end end end |