PowerShell / PowerShellGetv2

PowerShellGet is the Package Manager for PowerShell
https://www.PowerShellGallery.com
MIT License
431 stars 138 forks source link

the installationpolicy of the PSGallery does not change even when the output states that #690

Open fabricesemti80 opened 1 year ago

fabricesemti80 commented 1 year ago

Prerequisites

Steps to reproduce

As I explained it here: https://stackoverflow.com/questions/74549128/why-is-the-installationpolicy-of-the-psgallery-does-not-change-even-when-puppet?noredirect=1#comment131597704_74549128 I am using the Puppet module wrapped around this, and it gives me the output it changed the galery from untrusted to trusted, but in reallity - checking after the Puppet run with Get-Psgalery - it is not updated. On Stack overflow I have been suggested it is rather an issue with the module than Puppet, so I am hoping to get some advise?

Expected behavior

Repo changes from `untrusted` to `trusted` installationpolicy

Actual behavior

Repo's installation policy does not change

Error details

no error

Environment data

PS C:\Users\Administrator> Get-Module PowerShellGet; $PSVersionTable 

Name                           Value                                                                                                                                                                                                              
----                           -----                                                                                                                                                                                                              
PSVersion                      5.1.17763.592                                                                                                                                                                                                      
PSEdition                      Desktop                                                                                                                                                                                                            
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                                            
BuildVersion                   10.0.17763.592                                                                                                                                                                                                     
CLRVersion                     4.0.30319.42000                                                                                                                                                                                                    
WSManStackVersion              3.0                                                                                                                                                                                                                
PSRemotingProtocolVersion      2.3                                                                                                                                                                                                                
SerializationVersion           1.1.0.1

Visuals

No response

anamnavi commented 1 year ago

@fabricesemti80 looking at the link you posted in the Stack Overflow post > Usage section > the example recommends that installation policy is case sensitive and should be trusted or untrusted. It also does not use quotes around the installationpolicy text as in the example you shared. Can you try it like the example in the Usage section?

fabricesemti80 commented 1 year ago

Thanks for your reply @anamnavi

I changed the code to

  ## ensure PSGallery is present - relies on mod 'dsc-powershellget', '2.2.5-0-3'
  dsc_psrepository { 'Trust public gallery':
    dsc_name               => 'PSGallery',
    dsc_ensure             => 'Present',
    dsc_installationpolicy => trusted,
  }

image

Puppet says it is applied, but there is no change in reallity.

image