Where can I go to request a feature be added to DSC. I really need the ability to trigger certain things happening when a test-targetresource is triggered. I’m having to create my own resources a lot when I could have used an existing one if I had the ability to trigger my own code when for instance the File resource test-targetresource is triggered I want to kill certain processes so it will not fail with file in use errors.
Hi,
Have you tried using DependsOn on the File Resource to depend on a Service Resource where you implement Status = Off or similar ?
I doubt there will be an api or hook into the set-get-test structure of the Resource to add your code, but i think with DependsOn and perhaps even WaitFor Resource you might be able to do some orchestration.
From my perspective DSC isnt a full IAC, as it lacks the orchestration but you can implement workflow in powershell to build a bigger solution that will fit.
Arie H.
Arie H I cannot accomplish my above request with either DependsOn or WaitFor. If you know something I don’t please put up a sample. Specifically I’m looking to “upgrade” a service. This really just involves copying the new files for the service the problem is I first need to stop the service or else I get files in use.
Hi Aaron,
Don’t you know the name of the service the updated files are part of ?
Unless I missed something this should fill the need to “upgrade” a service.
Service MyService
{
Ensure=‘Present’
State=‘Stopped’
}
Folder MyNewServiceFiles
{
Ensure=‘Present’
Type=‘Folder’
Recursive=$true
Source=‘path to source’
Target=‘path to target’
DependsOn=‘[Service]MyService’
}
This will stop the service and not start copying the new files until the service is stopped
Once that was done, just issue a new DSC script to activate the service.
As I mentioned above, DSC lacks the orchestration and you need to adjust around it.