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

MSFT_PackageManagementSource: Resource conflict because ProviderName not part of key #536

Open
uw-dc opened this issue Sep 29, 2022 · 0 comments

Comments

@uw-dc
Copy link

uw-dc commented Sep 29, 2022

After installing ChocolateyGet package provider, I have these Package Sources:

> Get-PackageSource

Name                             ProviderName     IsTrusted  Location
----                             ------------     ---------  --------
chocolatey                       Chocolatey       False      http://chocolatey.org/api/v2/
PSGallery                        PowerShellGet    False      https://www.powershellgallery.com/api/v2
chocolatey                       ChocolateyGet    True       https://community.chocolatey.org/api/v2/

I want to use PackageManagementSource DSC resource to remove both chocolatey package sources:

    PackageManagementSource 'ChocoChocoPackageManagementSource'
    {
        Name = 'chocolatey'
        ProviderName = 'Chocolatey'
        SourceLocation = 'http://chocolatey.org/api/v2/'
        Ensure = 'Absent'
    }

    PackageManagementSource 'ChocoChocoGetPackageManagementSource'
    {
        Name = 'chocolatey'
        ProviderName = 'ChocolateyGet'
        SourceLocation = 'https://community.chocolatey.org/api/v2/'
        Ensure = 'Absent'
    }

The above results in the following error, because of identical key:

Test-ConflictingResources : A conflict was detected between resources
'[PackageManagementSource]ChocoChocoPackageManagementSource
(D:\DscService\Build\Modules\MyDSCConfigModule\0.0.2.14\MyDSCConfigModule.psm1::1043::5::PackageManagementSource)' and
'[PackageManagementSource]ChocoChocoGetPackageManagementSource
(D:\DscService\Build\Modules\MyDSCConfigModule\0.0.2.14\MyDSCConfigModule.psm1::1051::5::PackageManagementSource)' in
node someserver.somedomain.sometld'. Resources have identical key properties but there are differences in the following
non-key properties: 'ProviderName'. Values 'Chocolatey' don't match values 'ChocolateyGet'. Please update these
property values so that they are identical in both cases.

I would suggest changing ProviderName to also be a key property

@uw-dc uw-dc changed the title MSFT_PackageManagementSource: MSFT_PackageManagementSource: Resource conflict because ProviderName not part of key Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant