MSFT_PackageManagementSource: Resource conflict because ProviderName not part of key
uw-dc opened this issue · 0 comments
uw-dc commented
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