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

PSResource: New resource proposal #398

Open
nickgw opened this issue Nov 17, 2022 · 2 comments · May be fixed by #400
Open

PSResource: New resource proposal #398

nickgw opened this issue Nov 17, 2022 · 2 comments · May be fixed by #400
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 Nov 17, 2022

Resource proposal

This is a duplicate of Issue #393 , but scoped solely to the proposed PSResource resource.

Currently, psmodule is bundled in the PowershellGet v2 module. In PowerShellGet v3 the resources has 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;
};

Special considerations or limitations

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

@nickgw nickgw linked a pull request Nov 19, 2022 that will close this issue
9 tasks
@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 19, 2022
@nickgw
Copy link
Contributor Author

nickgw commented Nov 27, 2022

@johlju I've got some questions about the design of this resource.

For the properties MaximumVersion, and MinimumVersion does specifying a state of one of them mean all resources out of compliance are uninstalled, or do we just say the resource is in the correct state if a single resource meets the critera.

For example: Given this resource declaration:

$Params = @{
  Name = 'PSResource'
  ModuleName = 'ComputerManagementDsc'
  Property = @{
    Name   = 'jeadsc'
    Ensure = 'Present'
    MaximumVersion = '0.6.0'
  }
  Method = 'Get'
}

and this result of Get-Module -Name JeaDsc -ListAvailable

PS C:\Users\vagrant> Get-Module -Name JeaDsc -ListAvailable


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands                                                                                                           
---------- -------    ----                                ----------------                                                                                                           
Script     0.7.2      JeaDsc                              ConvertTo-Expression                                                                                                       
Script     0.6.0      JeaDsc                              {Compare-JeaConfiguration, Convert-ObjectToHashtable, Convert-StringToObject}

Is the resource in compliance because JeaDsc version 6.0.0 meets the resource, or out of spec because 0.7.2 exceeds it and we need to uninstall 0.7.2?

Similar question for RequiredVersion, but I think it's more cut and dry that as long as the resource of the requiredversion exists, we're in the correct state.

thanks!

@nickgw
Copy link
Contributor Author

nickgw commented Nov 27, 2022

@johlju I've got some questions about the design of this resource.

For the properties MaximumVersion, and MinimumVersion does specifying a state of one of them mean all resources out of compliance are uninstalled, or do we just say the resource is in the correct state if a single resource meets the critera.

For example: Given this resource declaration:

$Params = @{
  Name = 'PSResource'
  ModuleName = 'ComputerManagementDsc'
  Property = @{
    Name   = 'jeadsc'
    Ensure = 'Present'
    MaximumVersion = '0.6.0'
  }
  Method = 'Get'
}

and this result of Get-Module -Name JeaDsc -ListAvailable

PS C:\Users\vagrant> Get-Module -Name JeaDsc -ListAvailable


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands                                                                                                           
---------- -------    ----                                ----------------                                                                                                           
Script     0.7.2      JeaDsc                              ConvertTo-Expression                                                                                                       
Script     0.6.0      JeaDsc                              {Compare-JeaConfiguration, Convert-ObjectToHashtable, Convert-StringToObject}

Is the resource in compliance because JeaDsc version 6.0.0 meets the resource, or out of spec because 0.7.2 exceeds it and we need to uninstall 0.7.2?

Similar question for RequiredVersion, but I think it's more cut and dry that as long as the resource of the requiredversion exists, we're in the correct state.

thanks!

#399 (comment)

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

Successfully merging a pull request may close this issue.

2 participants