chocolatey / cChoco

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

cChocoPackageInstaller not finding package in local source #119

Closed MubSalim closed 5 years ago

MubSalim commented 5 years ago

Hi,

I've been playing around with cChoco and was attempting to install SQL 2016. I have set up a chocolatey repo on a remote server and I'm able to set it as a source using the cChocoSource resource. I can then see it when I do a "Choco sources" and I can even install SQL using the sql2016 package I created if I run “choco install sql2016”

The issue is if I try an install of the same package using cChocoPackageInstaller I get an error saying

2019-03-01 14:48:20,878 2584 [ERROR] - sql2016 not installed. The package was not found with the source(s) listed. Source(s): '\remoteservername\c$\ChocolateyRepo\;https://chocolatey.org/api/v2/'

The configuration I’m using is as follows:

Configuration ToolInstall
{
    Import-DscResource -ModuleName cChoco

    Node $AllNodes.NodeName
    {
        cChocoInstaller installChoco {
            InstallDir = "C:\Program Files\Chocolatey"
        }

        cChocoSource SetSource {
            Name     = "LCCRepo"
            source   = "\\remoteservername\c$\ChocolateyRepo\"
            Priority = 1

        }

        foreach ($tool in $ConfigurationData.ToolData.Tools) {
            cChocoPackageInstaller $tool {
                Name   = $tool
                Ensure = "Present"
            }
        }
    }
}

I’m new to chocolatey so any assistance would be appreciated.

Thanks

pauby commented 5 years ago

Does the account DSC is running under have access to that share?

MubSalim commented 5 years ago

The account does have admin access. This is a two server dev environment so everything is pretty open.

pauby commented 5 years ago

@MubSalim The error you are getting is one from choco itself so I don't think this is a cChoco issue. Can you reach out to the Gitter channels for choco (https://gitter.im/chocolatey/choco)? Let us know how you get on and we can come back to this issue.

pauby commented 5 years ago

]Gitter conversation](https://gitter.im/chocolatey/choco?at=5c8100a4f895944c08559fc4) for this resolved the issue which turned out to be permissions on the share. DSC, by default, runs under the SYSTEM account on the local computer. This had no permissions to the share.

The fix in this case was to use the PsDscRunAsCredential which is documented at Microsoft Docs.

Interesting article on how to check which account DSC is running under.