-
Notifications
You must be signed in to change notification settings - Fork 35
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
Enable using adapter resources without the adapter wrapper #720
Conversation
One problem is that if both WinPS and PS7 adapters support the same resource, the first one found is used. This is generally not a problem, but when using |
Maybe we can further filter the results by whether they support the current operation, or consider (eventually?) defining a default adapter or an adapter priority in the DSC settings? For example, in the case of
That could be implemented independently of any settings value that defines adapter priority. |
Rather than make this PR even bigger, I'm going to fix up the tests and defer the discovery to next PR. For that one, I'll prepare for supporting specifying versions as discovery should take into account version and capability rather than the simple approach right now which is just finding the first type that matches. |
…testadapter, fix tests, fix export format
Co-authored-by: Tess Gauthier <tgauth@bu.edu>
PR Summary
This is a breaking change, but should not affect anyone as no one has implemented an adapter yet, but we should doc it.
dsc
exe instead of the library so it was only written for direct resource invocation and not for configurationSo all that code was removed. The old code relied on modifying the input JSON and injecting the special property, so parameters for functions were changed to no longer need the input to be mutable.
Instead, this PR removes all that old code (the breaking change) and instead when a resource is specified whether in a config or direct resource invocation and requires an adapter, then internally it dynamically generates a configuration with that adapter along with the resource and executes that instead. The resource part of the configuration invocation output is extracted to appear as though just the resource was executed.
In the PS Adapter, I removed the code that checked for the special property so this means adapters should ONLY expect to get configuration and doesn't need to handle whether the input it received was for a resource or a complete configuration. Also, to improve error messages, added
-ErrorAction Stop
to use ofInvoke-DscResource
so that the correct error surfaces rather than a later error.WMI Adapter updated to also only expect configuration. TestAdapter fixed as export requires an array of instances of properties representing the resources.
PR Context
Fix #693