[master] add show diff for new file in file.managed#65547
Conversation
|
@twangboy do you have any ideas why these Windows tests might be failing? Not sure if there's anything interesting about how that OS handles temp files. |
@twangboy , any thoughts on this? seems to work fine for all other operating systems Also, can someone add an cc: @dwoz |
|
I think it's trying to open that file that doesn't exist yet it's throwing that error. Maybe the lstat command or something. I don't think it's actually a permissions issue. I think that's just a misleading error message. There are also some issues with line endings... this should get you close. I'm still looking at it, but I'm getting pulled to other things. This also needs a rebase and conflicts resolved |
|
@nicholasmhughes OK, I got the tests working on Windows. I had to change the way you were opening the temp file. For some reason the In the test on Windows it seems to return an additional dict entry in changes for "newfile". Maybe it doesn't do that on Linux. So, all the tests will now fail on Linux. I'll let you decide if you wanna hunt that down or modify the test for Linux. |
|
Also, this still needs a rebase and conflict resolution |
Use salt.utils.files.mkstemp isntead of tempfile.NamedTemporaryFile when creating the temporary file for get_diff Fix the test to check for the linesep of the os at the end On windows there is also a newfile entry in the change dict
|
Looks like fixing the test for Windows breaks it for everything else. I don't know why you get a "new_file" on Windows but not the other OS's. It seems to me like that would be valid output if a new file is being created. |
What does this PR do?
See issue for details.
What issues does this PR fix or reference?
Fixes: #65546
Previous Behavior
State output only showed
newfile: <name>ordiff: New filein changes.New Behavior
Diff is now able to be optionally shown.
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.