-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Updated the salt.states.file.copy function to make the call to file.remove with the force parameter set to the same as one for salt.states.file.copy. #51740
Conversation
…emove with the force parameter set to the same as one for salt.states.file.copy.
…allow file.copy to work on windows with read-only files.
This PR seems to conflict with issue #25250. I'll have to look at it the next time I get free time, but in summary it looks like This fix is essentially a 12-byte patch that only passes the |
…allow file.copy to work on windows with read-only files.
…t.modules.file.remove now supports kwargs.
…ove from salt.states.file.append and salt.states.file.tidied.
Ok, I added the kwargs support to |
@twangboy, when you get a chance next week, lmk if there's anything else I need to do to get these merged upstream as next weekend I won't be able to get back to these saltstack PRs due to them not being even closely related to my regular job. Thanks for your help! |
Hmm..why is
|
Thanks! |
What does this PR do?
On the windows platform, the
salt.state.file.copy
function does not handle files with the read-only attribute properly. Whenforce
is set totrue, the
file.copyfunction uses
file.removeto attempt to remove the target before copying it. This function fails with an exception when the read-only attribute is set. However when
file.removehas its
force` parameter set to true, this gets handled properly.This PR passes the value of the
force
parameter fromfile.copy
to its call tofile.remove
so that files with the read-only attribute are handled.What issues does this PR fix or reference?
This closes issue #51739.
Previous Behavior
Previously when
file.copy
tried to remove the target directory it would fail when encountering a read-only file.New Behavior
Now when
force
is set totrue
, the call tofile.remove
will inherit the same value which allowsfile.copy
to successfully remove the target directory.Tests written?
No
Commits signed with GPG?
No