Skip to content
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

PowershellModule, PowershellRepository: New resource proposal #393

Open
nickgw opened this issue Oct 25, 2022 · 5 comments
Open

PowershellModule, PowershellRepository: New resource proposal #393

nickgw opened this issue Oct 25, 2022 · 5 comments
Labels
in progress The issue is being actively worked on by someone. resource proposal The issue is proposing a new resource in the resource module.

Comments

@nickgw
Copy link
Contributor

nickgw commented Oct 25, 2022

Resource proposal

Currently, psmodule and psrepository are bundled in the PowershellGet v2 module. In PowerShellGet v3 the resources have been moved into a new, dsc specific module, PowerShellGetDsc. Unfortunately, these repositories are either no longer maintained, or have not had any activity in years.

I'm proposing taking the resources and moving them into ComputerManagementDsc with new names to avoid multiple DSC resources with the same name. This way, the community can add features and bug fixes more rapidly. If there comes a time that PowershellGetDsc is actively maintained, we can take the contributions from ComputerManagementDsc and port them over.

https://github.com/PowerShell/PowerShellGetDsc - no contributions in 11 months, no target production release
https://github.com/PowerShell/PowerShellGet - does not include Dsc resources anymore
https://github.com/PowerShell/PowerShellGetv2 - Contains PSModule and PSRepository, no longer in development and not accepting any pull requests

Proposed properties

[ClassVersion("1.0.0.0"),FriendlyName("PSModule")]
class MSFT_PSModule : OMI_BaseResource
{
[Key] String Name;
[Write,ValueMap{"Present", "Absent"},Values{"Present", "Absent"}] String Ensure;
[Write] String Repository;
[Write,ValueMap{"Trusted", "Untrusted"},Values{"Trusted", "Untrusted"}] String InstallationPolicy;
[Write] Boolean Trusted;
[Write] String Version;
[Write] Boolean NoClobber;
[Write] Boolean SkipPublisherCheck;
[Read] string Description;
[Read] String InstalledVersion;
[Read] String Guid;
[Read] String ModuleBase;
[Read] String ModuleType;
[Read] String Author;
};

[ClassVersion("1.0.0.0"),FriendlyName("PSRepository")]
class MSFT_PSRepository : OMI_BaseResource
{
[Key] String Name;
[Write, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Write] String URL;
[Write] String Priority;
[Write, ValueMap{"Trusted","Untrusted"}, Values{"Trusted","Untrusted"}] String InstallationPolicy;
[Read] Boolean Trusted;
[Read] Boolean Registered;
};

Special considerations or limitations

There may come a time when psmodule and psrepository are actively developed and we should work to contribute any fixes or features from ComputerManagementDsc to the official repository.

@johlju
Copy link
Member

johlju commented Oct 26, 2022

We could name the resources PSResource and PSResourceRepository to align with PowerShellGet v3, and they would not conflict with any existing DSC resources. Though, in case the goal of the PowerShell team is to create those resources we could name them differently. But since there has not been any activity for the existing resources for PSGet v3 maybe we could use the names.

Also suggest the resources are made as class-based resources so that they also work (can be made work) cross-platform. Of course the goal should also be to support both v2 and v3 of PowerShellGet (once the later is released).

@nickgw
Copy link
Contributor Author

nickgw commented Oct 29, 2022

@johlju Do we have any examples of class-based resource structure in a module that is all mof based? I can take a stab at this but JeaDsc's resource structure doesn't seem quite applicable.

@johlju
Copy link
Member

johlju commented Oct 29, 2022

Please look at SqlServerDsc, it has both class-based resources and MOF-based resources, and uses the pattern we try to follow.

@johlju
Copy link
Member

johlju commented Oct 29, 2022

Use the resource SqlAudit in SqlServerDsc as an example. There are also class-based resources in DnsServerDsc

@PlagueHO
Copy link
Member

This does sound like a great idea. I'd be all for this. And agree that we should aim to make them class-based if possible.

@johlju johlju added in progress The issue is being actively worked on by someone. resource proposal The issue is proposing a new resource in the resource module. labels Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in progress The issue is being actively worked on by someone. resource proposal The issue is proposing a new resource in the resource module.
Projects
None yet
Development

No branches or pull requests

3 participants