diff options
author | Tim Smith <tsmith@chef.io> | 2017-12-18 20:39:31 -0800 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2017-12-18 20:39:31 -0800 |
commit | 087809b8b75051a7294a908f64cc1a0aad6fedf0 (patch) | |
tree | cb579f082c65c8ec157bdb3375d94c31c5c70043 /lib | |
parent | f61f8bb75fcc0ba934b688c34f8d018bfcb3ca81 (diff) | |
download | chef-087809b8b75051a7294a908f64cc1a0aad6fedf0.tar.gz |
Modernize directory resource
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib')
-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..ab9bb6b5c0 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 |