chocolatey / cChoco

Community resource to manage Chocolatey
Apache License 2.0
153 stars 99 forks source link

cChocoPackageInstaller Source Parameter Isn't Working #118

Closed smcolligan closed 5 years ago

smcolligan commented 5 years ago

Hello,

I've been trying to use the Source parameter on the cChocoPackageInstaller resource to point to our internal repository. However, the resource still pulls from the public repository.

    cChocoPackageInstaller 'Install SVN'
    {
        Name        = 'svn'
        Ensure      = 'Present'
        AutoUpgrade = $false
        Version     = 1.8.17
        Source      = 'https://myhost.com/Chocolatey/chocolatey'
        DependsOn   = '[Script]Install Chocolatey'
    }

I've been checking the choco logs on the machine in question, and can find no reference to my source. But, I do see it reaching out to sourceforge to download the package.

Any ideas?

Thanks,

Sean

pauby commented 5 years ago

What does choco source list on the computer return?

pauby commented 5 years ago

I'd also be interested in the logs and verbose output from running this.

smcolligan commented 5 years ago

Hi @pauby - Unfortunately, I had to move on from this. I needed to get this working and couldn't make it work using the Source attribute. So I refactored my code to use Script resources instead:

Script 'Install SVN' {
        GetScript   = {
            return @{ 'Result' = "Install SVN" }
        }
        TestScript  = {
            return ((& $using:chocoInstalledEXEPath list -l | Where-Object {$_ -match $using:svnPackageName}) -ne $null)
        }
        SetScript   = {
            & $using:chocoInstalledEXEPath install $using:svnPackageName --version $using:svnPackageVersion -s $using:chocoInternalSource -y
        }
        DependsOn   = '[Script]Install Chocolatey'
    }

Given that, I'm unfortunately not in a position to reproduce this at the moment.

pauby commented 5 years ago

I tried this:

        cChocoPackageInstaller 'Install dummy-pkg'
        {
            Name        = 'dummy-pkg'
            Ensure      = 'Present'
            AutoUpgrade = $false
            Version     = 1.0.0
            Source      = 'c:\packages'
            DependsOn = "[cChocoInstaller]InstallChocolatey"
        }

And it worked as it should. dummy-pkg obviously doesn't exist in the Chocolatey Community Repository so could only be picked up locally.

I also tried:

        cChocoPackageInstaller 'Install dummy-pkg'
        {
            Name        = 'winrar'
            Ensure      = 'Present'
            AutoUpgrade = $false
            Version     = 5.70.0.20190305
            Source      = 'c:\packages'
            DependsOn = "[cChocoInstaller]InstallChocolatey"
        }

I don't have Winrar internalised so it can only come from the community repository but as this explicitly states the source it should fail, which it does.

I can't see the issue here and as there are no logs from the original issue I'm going to close this ticket but if it appears in the future we can always re-open.