-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Configuration processors #3008
Configuration processors #3008
Conversation
…nd implement details
…ingDetails. Missing UTs and some details in their implementation
This comment has been minimized.
This comment has been minimized.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
@@ -189,7 +194,8 @@ LPWCH | |||
LPWSTR | |||
LSTATUS | |||
LTDA | |||
maclachlan | |||
luffy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import anime_expect.txt
internal static class Modules | ||
{ | ||
public const string PSDesiredStateConfiguration = "PSDesiredStateConfiguration"; | ||
public const string PSDesiredStateConfigurationMinVersion = "2.0.6"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ignoring the PowerShellGet minimum version requirement for now? I think I would rather we fail explicitly in that case than inexplicably, even if we aren't taking any actions to correct it.
} | ||
else if (dscResourceInfos.Count > 1) | ||
{ | ||
throw new ArgumentException(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there isn't a better built in exception type for "not specific enough", then you should probably create one.
Actually, this applies a lot of places below. I don't think ArgumentException
is appropriate for anything after calling into a dependency (you should be able to check for ArgumentException
from the arguments and object state alone).
// Even if the windows system32 windows powershell module path is removed they | ||
// will show up. | ||
if (dscResourceInfo.ParentPath!.StartsWith( | ||
@"C:\WINDOWS\system32\WindowsPowershell\v1.0\Modules\PsDesiredStateConfiguration\DscResources", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider a readonly array in your constants to contain these exclusions.
/// <summary> | ||
/// Resource not found by Find-DscResource. | ||
/// </summary> | ||
internal class FindDscResourceNotFoundException : Exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add a new error HR to the native code (shared lib) and then set the exception HR for these to that so that we can have a good mapping between the two.
/// Initializes a new instance of the <see cref="ConfigurationProcessorFactoryProperties"/> class. | ||
/// </summary> | ||
/// <param name="additionalModulePaths">Additional module paths.</param> | ||
public ConfigurationProcessorFactoryProperties(IReadOnlyList<string> additionalModulePaths) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a default constructor and all of the properties should be settable.
if (dscResourceInfo is null) | ||
{ | ||
// Well, this is awkward. | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe an exception instead?
src/Microsoft.Management.Configuration/Microsoft.Management.Configuration.idl
Outdated
Show resolved
Hide resolved
src/Microsoft.Management.Configuration/Microsoft.Management.Configuration.idl
Outdated
Show resolved
Hide resolved
…nfiguration.idl Co-authored-by: JohnMcPMS <[email protected]>
…nfiguration.idl Co-authored-by: JohnMcPMS <[email protected]>
This work is also a small part of #2845
Change
Microsoft.Management.Configuration.Process is a cswinrt component that provides implementation of
IConfigurationSetProcessor
,IConfigurationUnitProcessor
,IConfigurationUnitProcessorDetails
,IConfigurationUnitSettingDetails
andIConfigurationProcessorFactory
defined in #2942 as well as new runtime classes and an interface.ConfigurationSetProcessorFactory
implementsIConfigurationProcessorFactory
, which takes the type of configuration and optionalIConfigurationProcessorFactoryProperties
with additional properties that need to be defined for the processor set. An implementation ofIConfigurationProcessorFactoryProperties
is also provided.Internally, it uses PowerShell Host to find and install DSC modules and apply them via InvokeDscResource.
Requires PSDesiredStateConfiguration 2.0.6
Validation
Added unit tests and test locally full E2E.
Microsoft Reviewers: Open in CodeFlow