This topic contains 3 replies, has 3 voices, and was last updated by
June 17, 2015 at 6:15 pm #26597ParticipantPoints: 0Rank: Member
I have created a custom resource 'SyncShare' and I can get it to run with expected results if I copy the resource folder to the modulepath on the target node. However, if I try to combine copying that resource to the target and applying it in a single configuration ( see below), the LCM on the target says that the resource isn't in the psmodulepath –despite the fact that I have used the 'DependsOn' property to ensure that the directory exists. In fact, the custom resource is not respecting the dependsOn property at all, since I find that it is always being evaluated before the file resource that would make that resource available. See this configuration fragment:
Type = "Directory"
DestinationPath = $Node.ResourceRootPath+"\SyncShare"
SourcePath = $Node.ResourceSourcePath+"\SyncShare"
Ensure = "Present"
MatchSource = $True
Recurse = $True
Force = $True
Credential = $Credential
Checksum = "modifiedDate"
Name = "Tools"
SourceDirectory = $Node.ToolsDirSourcePath
DestinationDirectory = $Node.ToolsDirDestinationPath
ChecksumFileName = "sync.checksum"
Ensure = "Present"
DependsOn = "[File]Resource_SyncShare"
June 17, 2015 at 6:55 pm #26598MemberPoints: 0Rank: Member
The LCM is probably reading the whole file and making sure that the resources exist before it starts to actually execute anything. You won't be able to distribute the resources that way.
If you're using a pull server, don't worry about it, as the resources will be downloaded from there on an as-needed basis. If you're using Push deployments, then you'll need to copy out the necessary resources just before you execute Start-DscConfiguration.
In PowerShell v5, you can do a hybrid of the two, where a pull server is used to download resources, but you can still apply configurations with a push via Start-DscConfiguration.
June 17, 2015 at 7:11 pm #26601KeymasterPoints: 1,811Rank: Community Hero
Correct: the LCM pre-scans the file to make sure it has every resource needed before it processes anything. And, as Dave notes, it'll then grab modules from a pull server, if so configured. So you can't use a config to file-copy a resource AND use that resource. This is essentially what a pull server is meant to help solve.
June 18, 2015 at 10:15 am #26635ParticipantPoints: 0Rank: Member
Thanks for the reply. I'm going to wait on setting up a pull server in prod until WMF5 is in GA.
The topic ‘'DependsOn' property ignored in custom resource’ is closed to new replies.