diff --git a/lib/itamae/resource/remote_directory.rb b/lib/itamae/resource/remote_directory.rb index 42032959..d4c0f29d 100644 --- a/lib/itamae/resource/remote_directory.rb +++ b/lib/itamae/resource/remote_directory.rb @@ -9,6 +9,8 @@ class RemoteDirectory < Base define_attribute :mode, type: String define_attribute :owner, type: String define_attribute :group, type: String + define_attribute :recursive_mode, type: [TrueClass, FalseClass], default: false + define_attribute :recursive_owner_and_group, type: [TrueClass, FalseClass], default: false def pre_action directory = ::File.expand_path(attributes.source, ::File.dirname(@recipe.path)) @@ -56,10 +58,10 @@ def show_differences def action_create(options) if attributes.mode - run_specinfra(:change_file_mode, @temppath, attributes.mode) + run_specinfra(:change_file_mode, @temppath, attributes.mode, recursive: attributes.recursive_mode) end if attributes.owner || attributes.group - run_specinfra(:change_file_owner, @temppath, attributes.owner, attributes.group) + run_specinfra(:change_file_owner, @temppath, attributes.owner, attributes.group, recursive: attributes.recursive_owner_and_group) end if run_specinfra(:check_file_is_file, attributes.path)