Page 1 of 1

[PSS 2016] DSC Project

Posted: Sun Dec 18, 2016 12:36 pm
by Bosparan

yet another bigger request :)
I'm currently busy building a fairly big DSC resource for one of our customers and it's a pain in the ass to do with PSS:
- Almost none of the files are directly supported by PSS - I always have to keep manually creating the files and importing it as existing file
- Many repetitive steps need to be done manually, when they could be already automatic.
So I got this yearning for ... you know, a project optimized for DSC!
Only ... what features would I actually want?

Well, after spending some brain on it this weekend, I got a proposal worked out:

A DSC Project consists of three main sections:

The place where the individual DSC resources are created

.ps1 scripts that are loaded for each resource. Useful for global function libraries.

.ps1 scripts that are loaded for some resources, as configured in the resource. This avoids cluttering Primal Sense with helper functions on bigger projects.

Now for the details ...

The context Menu allows adding, naming and removing resources. Each resource is shown as a single item, even though it represents a folder structure with various contents and properties.
Each resource has - similar to a form - multiple tabs:

Comes with the three base DSC functions predefined. All globals (see below) are available, all shared content that was linked (see below) is available, the localized strings (see below) are available in the "$strings" Variable.

The base MOF structure predefined. Validates types against the parameters of Set-TargetResource. Validates Get- & Test- against the [key]-Parameter

A table of strings, mapping key to text. Comes by default with a "Keys"-column and an "en-US"-column. Additional languages (and thus columns) can be added, the default language can be chosen.

List of all shared scripts (see below). They can be enabled by checking a checkbox. These are available in "script"-view through the $strings variable, for which Primal Sense should be given.

The resource Manifest (equivalent to a module manifest. It's optional but good practice)

When publishing a DSC-project, it will generate a DSC module with the appropriate folder structure, generate the .psm1 and .schema.mof files, create a subfolder with the region code of every language that has been added in the strings section, adds the .psd1-files with the strings. The .psm1 file starts importing the globals, the linked shared scripts, the strings and then whatever the user added in the actual script view.

This is a plain folder view where scripts can be placed and subfolders can be created. All scripts that are set to "Shared" are available in all resources.

This is again a folder view where scripts can be placed and subfolders can be created. Only these aren't quite regular scripts as PSS handles file types, in that they have a second tab, listing all resources, and shows which use it and which don't (through checkboxes). This allows configuring which shared scripts is available in which resource both at the resource level as well as the shared script level, coming in handy depending on which process of the development you are busy with.

While I'd really like the entire package of ideas, here's the priority list for me by feature in descending order (top = greatest use):
- Creating everything out-of-the-box within the project
- Abstracting the resource pieces into one document type
- Strings / localization, including Primal Sense
- [some empty space]
- "Shared" feature
So if it comes to culling time, cull the "Shared" feature-part of the idea first ;)

I've considered adding a section for tests in the proposal above but ... I'm not sure enough yet - I'll need more experience with DSC tests (looking up how Microsoft does those things right now), before I know where best to stuff them and whether they have a solid place as part of the project or not.

Any thoughts / comments on the idea?


Re: [PSS 2016] DSC Project

Posted: Mon Dec 19, 2016 12:22 pm
by DevinL
While we currently have DSC support on our wishlist, I'll be sure to make note of your specific requests for the project.

Thanks for the thoughtful suggestion yet again.