Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

PSModule DSC resource does not detect metadata-only modules #3

Description

Some modules, such as Az (Azure PowerShell), are "metadata-only" modules, that is, they only contain dependencies on other, more granular modules (but the entire tree of modules is released at once, as a single unit). Such modules are not returned by Get-Module -ListAvailable, which is what the PSModule resource uses internally.

As a consequence, this configuration

PSModule Az
{
    Name = 'Az'
    Ensure = 'Present'
    MinimumVersion = '5.5.0'
    Repository = 'PSGallery'
}

will install the module correctly, but will never reach a stable state - Test-TargetResource will always return false.
(The resource will also attempt to install the module even if a higher version is already installed.)

A more appropriate way would possibly be to detect the presence of modules using Get-InstalledModule, which is how it was done in the PowerShellGet 2.x PackageManagement provider interface (Get-InstalledPackage, Get-InstalledModuleDetails).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions