-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add recursive chmod/chown to remote_directory resource. #218
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: [String, Symbol], default: :true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you use |
||
define_attribute :recursive_owner, type: [String, Symbol], default: :true | ||
|
||
def pre_action | ||
directory = ::File.expand_path(attributes.source, ::File.dirname(@recipe.path)) | ||
|
@@ -56,10 +58,18 @@ def show_differences | |
|
||
def action_create(options) | ||
if attributes.mode | ||
run_specinfra(:change_file_mode, @temppath, attributes.mode) | ||
if attributes.recursive_mode == :true | ||
run_specinfra(:change_file_mode, @temppath, attributes.mode, :recursive => true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks to your suggestion! |
||
else | ||
run_specinfra(:change_file_mode, @temppath, attributes.mode) | ||
end | ||
end | ||
if attributes.owner || attributes.group | ||
run_specinfra(:change_file_owner, @temppath, attributes.owner, attributes.group) | ||
if attributes.recursive_owner == :true | ||
run_specinfra(:change_file_owner, @temppath, attributes.owner, attributes.group, :recursive => true) | ||
else | ||
run_specinfra(:change_file_owner, @temppath, attributes.owner, attributes.group) | ||
end | ||
end | ||
|
||
if run_specinfra(:check_file_is_file, attributes.path) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think setting false as the default value is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think better way of recursive chown/chmod in default in my local usage.
But, this patch changes behavior from current version. It is not good.
I change to boolean false in default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just change to default on false.
Sorry too late.