1

Closed

Running Install-BoxstarterPackage against a remote computer does not allow sourcing a package from a custom NuGet Repo

description

I have my system bootstrap package located in a custom NuGet repo and am running the following command's from my workstation PC against the server I am trying to BootStrap
#################
# Workstation PC
#################

# Set NuGet Repo
Set-BoxStarterConfig -NugetSources "http://www.myget.org/F/MyNugetFeed/api/v2;http://chocolatey.org/api/v2;http://10.4.48.112:8080/nuget/MyRepo"

# Start Remote Install
Install-BoxstarterPackage -ComputerName 10.136.175.171 -Credential $cred -PackageName MyPackageInMyCustomRepo -Verbose
The console then logs the following (I am only showing the important parts)
VERBOSE: [MyServer]Boxstarter: Installing 1 packages from
C:\Users\AdminAccount\AppData\Local\Temp\Boxstarter\BuildPackages;http://chocolatey.org/api/v2;http://www.myget.org/F/boxstarter/api/v2

.
.
.

Chocolatey (v0.9.8.23) is installing 'MyPackageInMyCustomRepo' and dependencies. By installing you accept the license for
'MyPackageInMyCustomRepo ' and each dependency you are installing.
Unable to find package 'MyPackageInMyCustomRepo'.

Command 'install' failed (sometimes this indicates a partial failure). Additional info/packages: MyPackageInMyCustomRepo
VERBOSE: [MyServer]Boxstarter: Exit Code: 1
Chocolatey reported an unsuccessful exit code of 1
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error
    + PSComputerName        : 10.136.175.171
When BoxStarter is doing this remote installation, it creates the temporary directory C:\Users\MyUserName\AppData\Local\Temp\boxstarter on the destination PC. Inside this folder is boxstarter.config. It is using this file to know where its NuGet soruces are. This is where the problem lies.

I tried putting boxstarter.config on the destination server there first with my custom NuGet repo, but when you run the Install-BoxstarterPackage against the remote server, this file is replaced.

I have also tried pre-installing BoxStarter on the destination server and running Set-BoxStarterConfig but when you run Install-BoxstarterPackage it will only look at the configuration from the C:\Users\MyUserName\AppData\Local\Temp\boxstarter folder.

I am not sure if this is by design or not, but if an additional parameter could be added to the Install-BoxstarterPackage function, for example -UseLocalBoxstarterConfig, this would resolve it. I guess the way to implement is, after sending the remote computer the Boxstarter.zip package and extracting it, also sends the workstations boxstarter.config file to the remote machine, so when the remote machine attempts to search for the package, it uses the same sources as the workstation machine.
Closed Sep 16, 2014 at 5:07 AM by mwrock

comments

Hodge wrote May 7, 2014 at 1:26 AM

Just in case someone else stumbles upon this issue before it is looked at, I am resolving this by modifying the boxstarter.config in side the zip file $env:UserProfile\AppData\Roaming\Boxstarter\Boxstarter.Chocolatey\Boxstarter.zip and adding my custom NuGet repository there.

When you call Install-BoxstarterPackage -ComputerName 10.136.175.171 -Credential $cred -PackageName MyPackageInMyCustomRepo it then copies the boxstarter.config to the remote system and allows my package to be found.

mwrock wrote May 7, 2014 at 9:05 AM

Yup. this is a bug. I think the best way to handle this scenario is to regenerate the zip when you call Set-BoxstarterConfig

Hodge wrote May 7, 2014 at 12:44 PM

Sounds like a good solution to me :)

Thanks very much Matt, I love the tool.