Open XVII opened 3 years ago
was this abandoned, since I shows assigned?
It seems there were no one in the community to reviewed the PR so it could be merge, and the contributor eventually removed the working branch so the PR closed. If someone send in a new PR then someone in the community have a chance to reviewed and we can merge it. 🙂
The
Test-TargetResource
returns$false
even though the file may match the checksum. This is because when deploying a new configuration, it clears the "attribute cache" that's used to tell whether it matches the source or not (as documented).In my eyes, it's more important that the contents match over the attributes matching the cache.
-MatchSource
should work with the CheckSum rather than just the cached file attributes alone.I propose the
$fileExists -eq True
is removed as it should check the file checksum, no matter if it's in the attribute cache or otherwise. I guess this would mean an extra hash calculation, but if-MatchSource
is set, the file hashes should match too.For Files:
https://github.com/dsccommunity/xPSDesiredStateConfiguration/blob/475885cb016e987a43c5433b0e8a03f7decbc5a1/source/DSCResources/DSC_xRemoteFile/DSC_xRemoteFile.psm1#L523-L526
and for Directories:
https://github.com/dsccommunity/xPSDesiredStateConfiguration/blob/475885cb016e987a43c5433b0e8a03f7decbc5a1/source/DSCResources/DSC_xRemoteFile/DSC_xRemoteFile.psm1#L575-L578
We use this for a file that gets copied onto a server which becomes locked. We've noticed that DSC xRemoteFile is trying to update this file, even though it shouldn't be touching it -- the hash matches.