-
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
Implement hardlink() for both salt.modules.file and salt.states.file #55000
Conversation
… semantics for hard links.
…that it works as stated in the documentation.
… not attempt to remove any files.
…s "link()". Culled the new one, and updated everything to use the old one.
(Force-push'd to cull out reverts) |
…dlink()" function instead of the correct "link()".
Okay. I really need help on this. Somebody halp plz. In this PR, I haven't touched any of the following lines. I do use These are the relevant lines (according to the lint check) in salt.states.file at line +314. Again, line +314 is the white space in the center.
|
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.
@arizvisa The linter is un-happy
Yeah, my previous message mentions the following, and I'm not sure how to proceed here because I haven't touched the relevant lines at all, and the PR works in Python3 for me.
|
…e it's fucking stupid and can't distinguish when the builtin is actually being properly iterated through.
@dwoz, apparently from debugging PyLint it believes that This is because pylint's checker is looking for
However, the parent for
which instead takes this branch and
Instead of sitting around and waiting for PyLint to fix their issue which would then block this PR,
All our tools are fucked.. |
@arizvisa In the future you can also skip that check for the line pylint doesn't understand |
@dwoz, gotcha. thanks for the heads up. |
What does this PR do?
This adds the
hardlink()
function as intended by PR #20428 but was dropped by the author. PR #20428 seemed to be a copy-paste job fromsymlink()
, and although this PR is based on it. The semantics in this PR were changed so that it made sense for hard links. (i.e. you can't hard link a directory, lack of windows support, etc.) Hard link symmetry is determined by comparing the inode of the source and target paths.What issues does this PR fix or reference?
This closes issue #39475 which was actually closed originally due to the issue going stale.
Previous Behavior
There was no way to create hard links on posixy environments.
New Behavior
There are now two functions in
salt.modules.file
. These are the.is_hardlink()
which checks the st_nlink field to determine if something is a hard link, and.hardlink()
which can be used to actually make the link. There is also a new state insalt.states.file
which allows one to create a hard link without overwriting a non-hardlink unless theforce
option is provided.Tests written?
Yes. It was very painful. It is 4am over here.
Commits signed with GPG?
No.