-
Notifications
You must be signed in to change notification settings - Fork 133
DSC for PowerShell 7 #265
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
DSC for PowerShell 7 #265
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,323 @@ | ||
| --- | ||
| RFC: RFCxxxx | ||
| Author: Steve Lee | ||
| Status: Draft | ||
| SupercededBy: N/A | ||
| Version: 1.0 | ||
| Area: Desired State Configuration | ||
| Comments Due: Nov 22, 2020 | ||
| Plan to implement: Yes | ||
| --- | ||
|
|
||
| # DSC for PowerShell 7 | ||
|
|
||
| [Desired State Configuration](https://docs.microsoft.com/powershell/scripting/dsc/overview/overview) | ||
| (DSC) is a platform in PowerShell enabling configuration as code. | ||
|
|
||
| ## Background | ||
|
|
||
| DSC contains many components including: | ||
|
|
||
| - The `configuration` keyword that is part of the PowerShell engine | ||
| - Compilation to a configuration MOF file | ||
| - DSC resources (those that ship in Windows and those on PowerShellGallery.com) | ||
| - Local Configuration Manager (LCM) in Windows and maintained as open-source for Linux, | ||
| a service that maintains and/or reports on configuration drift | ||
| - the DSC Pull Server, which is used by LCM's configured in pull mode to acquire new | ||
| resources and configurations | ||
| - the `PSDesiredStateConfiguration` module that includes cmdlets like `Get-DscResource` | ||
|
|
||
| DSC ships as a component of Windows 10 and as an open source project for Linux. | ||
| It is also integrated into cloud-based server management services in multiple | ||
| public clouds including Microsoft Azure and Amazon Web Services (AWS). | ||
|
|
||
| The versions of DSC that ship in Windows PowerShell are tightly coupled with | ||
| [Windows Management Instrumentation (WMI)](https://docs.microsoft.com/windows/win32/wmisdk/wmi-start-page) | ||
| on Windows and | ||
| [Open Management Interface](https://www.dmtf.org/content/open-management-interface-omi-%E2%80%93-open-source-implementation-dmtf-cimwbem-standards) | ||
| (OMI) on Linux. | ||
| The *MI libraries are used to host the Local Configuration Manager (LCM) and APIs | ||
| are used to parse information stored in Managed Object Framework (MOF) file format, | ||
| which is used for both configuration files and schema files. | ||
|
|
||
| ### Challenges with the current versions of DSC | ||
|
|
||
| Very few community authored DSC resources exist for Linux because C++ is the only | ||
| supported language. Other than using the Script/nxScript resources combined with | ||
| a composite resource, it is near-impossible today to create a DSC solution that is cross-platform. | ||
|
|
||
| Today, third party solutions leveraging DSC resources need to call the LCM | ||
| to run Get/Set/Test, making it complicated to integrate with partner ecosystems. | ||
|
|
||
| ## Scope of DSC implementation for PowerShell 7 | ||
|
|
||
| Unlike DSC for Windows PowerShell, DSC for PowerShell 7 is only intended to provide | ||
| a platform for building or integrating with configuration solutions. For PowerShell 7, | ||
| the scope of DSC support is limited to the `configuration` keyword, authoring, | ||
| compilation, and using DSC resources via the PSDesiredStateConfiguration module. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make explicit that compilation results in JSON instead of MOF |
||
|
|
||
| This means that a default agent (LCM) is not included and existing pull servers are not supported. | ||
|
|
||
| ### Motivation | ||
|
|
||
| DSC in PowerShell 7 should enable the following user scenarios: | ||
|
|
||
| As a developer of configuration management solutions, | ||
| I can easily integrate DSC resources | ||
| so that my solution can leverage the PowerShell ecosystem and its users and contributors. | ||
|
|
||
| As an IT Pro, | ||
| I can directly invoke DSC resources | ||
| so that I can build ad hoc cross platform configurations. | ||
|
|
||
| ### Cross platform first | ||
|
|
||
| DSC has supported both Windows and Linux, however, the | ||
| [Linux support](https://docs.microsoft.com/powershell/scripting/dsc/getting-started/lnxGettingStarted) | ||
| was dependent on a Microsoft-maintained implementation of | ||
| [OMI](https://github.com/Microsoft/omi) | ||
| and did not encourage authoring Linux DSC resources in PowerShell, | ||
| making development inconsistent and difficult for non-expert users. | ||
|
|
||
| DSC for PowerShell 7 will prioritize being cross platform and having a consistent | ||
| user experience and capabilities on all supported platforms. | ||
|
|
||
| ### Invoke-DscResource | ||
|
|
||
| About a year ago, we worked with | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although i appreciate the shout-out to Gael, I'm not sure this paragraph belongs here. Perhaps an acknowledgement section in the back of the RFC would be more appropriate.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The point here was to connect it back to the |
||
| [Gael Colas](https://twitter.com/gaelcolas) | ||
| to author an RFC describing fundamental changes to | ||
| [`Invoke-DscResource`](https://docs.microsoft.com/powershell/module/psdesiredstateconfiguration/invoke-dscresource) | ||
| in PowerShell 7.0. | ||
| This enabled executing the Get, Set, and Test methods on DSC resources bypassing | ||
| the LCM on Windows and removing the need for OMI on Linux. This was the start | ||
| to enable cross platform DSC resources to be authored in PowerShell script (with | ||
| some limitations). | ||
|
|
||
| The changes to DSC shipped as an | ||
| [experimental feature](https://docs.microsoft.com/powershell/scripting/learn/experimental-features) | ||
| in PowerShell 7.0. | ||
|
|
||
| ### Bring your own agent (BYOA) | ||
|
|
||
| A significant change from existing DSC for Windows PowerShell is there will be no | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still not clear on what I need to do here. Do we have documentation to which we can refer for enabling this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is confusing to me as well. If I'm understanding correctly this would be the new workflow:
I think step 3 is where my disconnect is. Could we have a built in command that would would parse the JSON file and run the DSC resources? This would at least give us the base functionality, which we could then extend if needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIK since there is no schema, I think it wont be an easy thig to provide a built-in cmdlet for that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well there doesn’t need to be a strict schema. The configuration file is basically just key value pairs. All DSC resources have get, test, and set methods you use to compare with the values in the config. That’s what the original LCM did. Granted it wouldn’t be very hard to write a script to reproduce that functionality, but I feel like by not having this built in, it will prevent a lot of non-programmers from using DSC. I mean the original point of DSC was so non-programmers could easily build up configurations. If you really strip things down to basics, we don’t even really need DSC resources. We could just write PowerShell scripts that apply the settings we want directly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep, I agree There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A small clarification about ...
This is one option; that is if the user decides to go through Another (faster) option is to just call There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand. My main point was that one of the original benefits of DSC was that people without a lot of programming or scripting experience could still write configurations. Having to manually call the resources with Invoke-DscResource, or build a script to replace the functionality of the LCM, just seems like a bit of a step back. I like the idea of having it open for third-parties to build on, but it feels like we are loosing some base functionality in the process. Anyway, that’s just my 2 cents.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kinda agree with you, but we lost that already from 5.1. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey, I like the discussion so far. But I must agree with @kgraves83 a lot. By removing the LCM completely, it will be hard for people to manage DSC. I know in the RFC it's talking about: With the new solution, you must first find the current I mean it's a good starting point to implement first the logic of "how a configuration is parsed and can be used". But this RFC shouldn't forget the management of many configurations for a big DSC environment. The popular configuration solutions had for me two downsides:
So in a completely Windows based environment that is disconnected, there is no solution. I really want to see something like a basic tooling for those use cases. I think the idea of something like a LCM as agent isn't a bad idea. I think DSC need something like that to work well. The downsides of not having it are to big. Maybe this is the wrong RFC for that discussion , but I think that is important. I really wish to see something like LCM 2.0 or something like that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth noting here: From a CM vendor perspective ( For Puppet specifically, we've been doing a lot of work over the last year to build a strong translation layer between the API surface of DSC Resources and Puppet so you can consume DSC Resources just like any other Puppet resource - with the full suite of support sugar from our VSCode extension, compile time validation, etc. I think that experience is going to be better for our users than a new Puppet resource which allows you to specify a JSON blob (as a herestring or path to the blob) and is only able to do change reporting based on the entire blob or (assuming property-by-property reporting gets implemented at the same time as these other changes) needs custom logic to surface DSC's internal change reporting. I suspect but do not know that the situation for other CM vendors is similar from an integration perspective. The more important need for us is to make sure we can fully map a DSC Resource's surface from |
||
| default agent (LCM) shipped with PowerShell 7. Instead, we want to make it easier | ||
| to integrate with existing configuration agents like | ||
| [Ansible](https://docs.ansible.com/ansible/latest/user_guide/windows_dsc.html), | ||
| [Chef](https://docs.chef.io/resources/dsc_resource/), | ||
| [Puppet](https://forge.puppet.com/puppetlabs/dsc), | ||
| [Azure Policy Guest Configuration](https://docs.microsoft.com/azure/governance/policy/concepts/guest-configuration), | ||
| and other popular configuration solutions. | ||
|
|
||
| Custom agents can use the existing PowerShell API (or call out to `pwsh`) to | ||
| directly invoke DSC resources. For ad hoc configuration management, solutions can | ||
| even use a PowerShell script run by TaskScheduler or cron. | ||
|
|
||
| Along with the lack of a default agent, there is no pre-defined push or pull | ||
| model for deploying DSC. | ||
|
|
||
| ### Move away from WMI/OMI/MOF | ||
|
|
||
| DSC on Windows was originally designed relying on | ||
| [WMI](https://docs.microsoft.com/windows/win32/wmisdk/wmi-start-page) | ||
| as a host on Windows, | ||
| [OMI](https://www.dmtf.org/content/open-management-interface-omi-%E2%80%93-open-source-implementation-dmtf-cimwbem-standards) | ||
| as a host on Linux, and | ||
| [MOF](https://docs.microsoft.com/windows/win32/wmisdk/managed-object-format--mof-) | ||
| for configuration and schema. | ||
|
|
||
| MOF as a format is not something most developers are familiar with and there is no | ||
| tooling support. However, developers of DSC resources written in PowerShell script | ||
| still needed to learn MOF and also keep their MOF schema in sync with their script | ||
| implementation. | ||
|
|
||
| Today, when you execute a | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sort of burying the lead here. I think it will be better to lead with the JSON config and use the earlier sentences as rational for the change. |
||
| [DSC configuration script](https://docs.microsoft.com/powershell/scripting/dsc/configurations/configurations), | ||
| the output is a MOF configuration file. In general, users do not need to read this | ||
| MOF file as it's intended to be used by machines. However, MOF parsing creates a | ||
| dependency on WMI/OMI. Instead, we will move towards a JSON configuration file format. | ||
|
|
||
| Since there is no default agent to understand the JSON configuration file, it will | ||
| be up to users or 3rd party agents to understand the configuration file. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how? Do we have a pointer for folks to follow to construct this? |
||
|
|
||
| Moving from WMI/OMI also means no longer supporting C++ resources nor Python based resources. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i assume that someone could build their own python based resources if they also build an agent for them.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, as use of DSC Resources is via the *-DscResource cmdlets, those only understand PowerShell classes, so unless they transcompile to a PowerShell class, then other languages are not currently planned to be supported
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember the File/Directory resource is written in C++ (WMI provider), so it's no longer supported with the new DSC, right? If so, the example below may need to change as it's still using
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is correct, the File resource was just used as an example of configuration file format |
||
|
|
||
| Example configuration file: | ||
|
|
||
| ```powershell | ||
| Configuration FileResourceDemo | ||
| { | ||
| Node "localhost" | ||
| { | ||
| File DirectoryCopy | ||
| { | ||
| Ensure = "Present" # Ensure the directory is Present on the target node. | ||
| Type = "Directory" # The default is File. | ||
| Recurse = $true # Recursively copy all subdirectories. | ||
| SourcePath = "\\PullServer\DemoSource" | ||
| DestinationPath = "C:\Users\Public\Documents\DSCDemo\DemoDestination" | ||
| } | ||
|
|
||
| Log AfterDirectoryCopy | ||
| { | ||
| # The message below gets written to the Microsoft-Windows-Desired State Configuration/Analytic log | ||
| Message = "Finished running the file resource with ID DirectoryCopy" | ||
| DependsOn = "[File]DirectoryCopy" # Depends on successful execution of the File resource. | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Generated MOF: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this useful if we're not building MOF? |
||
|
|
||
| ```mof | ||
| /* | ||
| @TargetNode='localhost' | ||
| @GeneratedBy=slee | ||
| @GenerationDate=11/05/2020 11:09:47 | ||
| @GenerationHost=SLEE-DESKTOP | ||
| */ | ||
|
|
||
| instance of MSFT_FileDirectoryConfiguration as $MSFT_FileDirectoryConfiguration1ref | ||
| { | ||
| SourceInfo = "C:\\Users\\slee\\test\\file.dsc.ps1::6::9::File"; | ||
| DestinationPath = "C:\\Users\\Public\\Documents\\DSCDemo\\DemoDestination"; | ||
| SourcePath = "\\\\PullServer\\DemoSource"; | ||
| Recurse = True; | ||
| Ensure = "Present"; | ||
| Type = "Directory"; | ||
| ModuleName = "PSDesiredStateConfiguration"; | ||
| ResourceID = "[File]DirectoryCopy"; | ||
| ModuleVersion = "1.0"; | ||
| ConfigurationName = "FileResourceDemo"; | ||
| }; | ||
|
|
||
| instance of MSFT_LogResource as $MSFT_LogResource1ref | ||
| { | ||
| SourceInfo = "C:\\Users\\slee\\test\\file.dsc.ps1::15::9::Log"; | ||
| ModuleName = "PsDesiredStateConfiguration"; | ||
| Message = "Finished running the file resource with ID DirectoryCopy"; | ||
| ResourceID = "[Log]AfterDirectoryCopy"; | ||
| ModuleVersion = "1.0"; | ||
| DependsOn = { | ||
| "[File]DirectoryCopy" | ||
| }; | ||
| ConfigurationName = "FileResourceDemo"; | ||
| }; | ||
|
|
||
| instance of OMI_ConfigurationDocument | ||
| { | ||
| Version="2.0.0"; | ||
| MinimumCompatibleVersion = "1.0.0"; | ||
| CompatibleVersionAdditionalProperties= {"Omi_BaseResource:ConfigurationName"}; | ||
| Author="slee"; | ||
| GenerationDate="11/05/2020 11:09:47"; | ||
| GenerationHost="SLEE-DESKTOP"; | ||
| Name="FileResourceDemo"; | ||
| }; | ||
| ``` | ||
|
|
||
| Example JSON representation of generated configuration: | ||
|
|
||
| ```json | ||
| { | ||
| "ConfigurationDocument": { | ||
| "GenerationDate": "11/05/2020 11:09:47", | ||
| "MinimumCompatibleVersion": "1.0.0", | ||
| "CompatibleVersionAdditionalProperties": [ | ||
| "BaseResource:ConfigurationName" | ||
| ], | ||
| "Name": "FileResourceDemo", | ||
| "Version": "2.0.0", | ||
| "Author": "slee", | ||
| "GenerationHost": "SLEE-DESKTOP" | ||
| }, | ||
| "LogResource": [ | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix ordering of instances to match mof example |
||
| { | ||
| "SourceInfo": "C:\\\\Users\\\\slee\\\\test\\\\file.dsc.ps1::15::9::Log", | ||
| "ModuleVersion": "1.0", | ||
| "Message": "Finished running the file resource with ID DirectoryCopy", | ||
| "ResourceID": "[Log]AfterDirectoryCopy", | ||
| "ModuleName": "PsDesiredStateConfiguration", | ||
| "ConfigurationName": "FileResourceDemo", | ||
| "DependsOn": [ | ||
| "[File]DirectoryCopy" | ||
| ] | ||
| } | ||
| ], | ||
| "FileDirectoryConfiguration": [ | ||
| { | ||
| "ResourceID": "[File]DirectoryCopy", | ||
| "Ensure": "Present", | ||
| "Recurse": true, | ||
| "ModuleVersion": "1.0", | ||
| "DestinationPath": "C:\\\\Users\\\\Public\\\\Documents\\\\DSCDemo\\\\DemoDestination", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think the backslashes need to be double escaped here. once for JSON encoding, but that is all it should need |
||
| "ConfigurationName": "FileResourceDemo", | ||
| "SourceInfo": "C:\\\\Users\\\\slee\\\\test\\\\file.dsc.ps1::6::9::File", | ||
| "ModuleName": "PSDesiredStateConfiguration", | ||
| "Type": "Directory", | ||
| "SourcePath": "\\\\\\\\PullServer\\\\DemoSource" | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename PullServer to some other computer name to avoid confusion with pull server |
||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it might be useful to have examples for |
||
| Important differences: | ||
|
|
||
| - CIM class name prefixes are removed as they are not needed | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed from what? |
||
| - Instances are represented as an array of the type name | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not very clear to me what this mean as I cannot map this statement to the above demo. |
||
| - The comment at the start is dropped as that information is available within `ConfigurationDocument` | ||
|
|
||
| ### No longer require MOF schema by switching to improved class-based resources | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a pretty strong argument to drop the MOF equivalent above. |
||
| Although DSC resources can be written as WMI/OMI providers, this requires writing | ||
| C/C++ code and compiling for specific Linux distros and processor architectures. | ||
| Writing PowerShell script DSC resources currently still requires a matching schema | ||
| file making it more complex. Instead, the current plan is to | ||
| [only support PowerShell class-based DSC resources](https://github.com/PowerShell/PowerShell/issues/13731) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is there no C# class-based DSC resource?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's certainly something that can be supported later if there is a need for it. Initially, we're targeting making it simpler and PowerShell class-based DSC resource development model already exists while we'd have to create one for C#. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please correct me if I'm wrong but there really shouldn't be much additional work required supporting PowerShell and C# class-based resources. If the PowerShell class is being imported as a dynamic assembly, DSC can use the same logic to identify C# and PowerShell DSC resources. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, theoretically there really shouldn't be much additional work to support C# resources, however things get complex when we get into details because the existing code is rather difficult for historical reasons. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it is difficult to add enhancements to the existing code base, then maybe its time to look at redesigning/refactoring while these major DSC changes are being proposed. As for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is good info about |
||
| in DSC for PowerShell 7. Whereas previously embedded objects were CIMInstance types, | ||
| they will now be .NET types based on PowerShell classes. Additional reasoning | ||
| and discussion is in the issue linked above. | ||
|
|
||
| Making the change from script-based resources to class-based resources could make | ||
| learning DSC a frustrating experience for new users. To resolve this, tooling will | ||
| be needed that scaffolds as much of the class requirements as possible based | ||
| on a .psm1 module file containing traditionally authored Get/Set/Test-TargetResource | ||
| functions. This would also aid in migrating the more than 1000 existing resources | ||
| for Windows. | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. totally agree - is this sort of an open switch or do you have ideas/suggestions for this? |
||
| ### Open Source | ||
|
|
||
| The current | ||
| [PSDesiredStateConfiguration](https://docs.microsoft.com/powershell/module/psdesiredstateconfiguration/) | ||
| module is not Open Source. The intent is to clean up the code and prepare the GitHub | ||
| repository to be made public as an Open Source project. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yay! |
||
| However, DSC for PowerShell 7 does not depend on PSDesiredStateConfiguration being Open Source. | ||
|
|
||
| ### PowerShell engine changes | ||
|
|
||
| To enable DSC for PowerShell 7 to evolve independently to PowerShell 7 itself, the | ||
| code in the engine that handles the DSC configuration keyword will be separated | ||
| as a plugin and made to be part of the PSDesiredStateConfiguration module. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Link to subsystem RFC once published |
||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. although not really needed here - is there an RFC for enabling custom keywords? |
||
| ## Alternate Proposals and Considerations | ||
|
|
||
| ### Supporting existing script based resources | ||
|
|
||
| Existing script-based resources (not class-based) require a MOF schema file for | ||
| PowerShell to understand the types and nested types. We had prototyped using a JSON | ||
| based schema instead of the existing MOF schema file but it still required the DSC | ||
| resource author to create a schema file and ensure it aligns with the script implementation. | ||
|
|
||
| It is simpler to create a PowerShell class based resource which itself is the schema | ||
| removing the need to understand and maintain a separate schema file. In addition, | ||
| having a single model (class based) for authoring DSC resources will help the community | ||
| in the long term by having a single consistent way to write DSC resources, making | ||
| it easier for new authors to find | ||
| [documentation and examples](https://dsccommunity.org/blog/class-based-dsc-resources/). | ||
|
|
||
| ### Tooling for parsing JSON configuration | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as an aside, we need to be sure that a schema for the JSON is published or otherwise available for a good authoring experience. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see an opportunity for a tool or VSCode plugin to generate a schema on the fly from available resources. Based on the example json earlier in the RFC, the schema will end up very generic and not able to offer more than basic structural validation. An auto generated schema can offer a much stronger validation and auto complete for resource properties. |
||
| To help developers of agents, we can provide APIs to parse the configuration | ||
| JSON file into a dependency graph as this would be required by every agent to | ||
| properly apply a configuration. | ||
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.
Make it explicit here it's only PowerShell class based DSC resources