Private chocolatey_package resource

Hi people,

I would like to have cookbooks installing packages on my node using a private repo located on the workstation for exemple, I don’t want to have my nodes searching for the packages on the internet but from a private chocolatey repo for exemple. Do you know how i could do this ?


You can mirror the chocolatey repo locally using a simple web server, or an artifact repository that supports nuget (nexus, artifactory).

Here are instructions on chocolatey’s wiki.

Then change the chocolatey_package ‘source’ attribute

chocolatey_package 'name' do
  action                     :install

Hi @spuder

Thanks for your help , i finally used nexus to mirror my repo but i have two problems :
i need to authenticate with admin/admin123 in order to reach the repo. So how can we pass credentials in the chocolatey_package ressource?
my source is : localhost:8081/repository/ which is located on my workstation so i need to change this url to access server.
Do you know how can we do that from nexus?


You can try using chocolatey_package the way that the chocolatey resource worked

chocolatey "some_private_secure_package" do
  source "https://some.proget/feed"
  options ({'u' => 'username', 'p' => 'password'})

Sorry I don’t have a private repository set up to validate this. That snippet is taken from the chocolatey-cookbook repository

Yes you want to use the options property to pass along the user and password switches. The chocolatey_package handles the options property a bit differently than the chocolatey cookbook’s chocolatey LWRP. Instead of a hash you want to pass a string. So it would look like:

chocolatey_package "some_private_secure_package" do
  source "https://some.proget/feed"
  options '-u=username -p=password'
1 Like


Thanks for your answers that helped me a lot! i tested the method to download and install soapui from a private nexus repo

that’s the recipe i used:
include_recipe ‘chocolatey’

chocolatey_package ‘soapui’ do
source "http://servername:8081/repository/"
options '-u=admin -p=admin123’
version "v5.2.1"

i had this error though:

  • chocolatey_package[soapui] action install[2016-07-19T15:49:00+02:00] INFO: P
    rocessing chocolatey_package[soapui] action install (soapui::default line 10)

    • No version specified, and no candidate version available for soapuie[0m
      Error executing action install on resource ‘chocolatey_package[soapui]’


    No version specified, and no candidate version available for soapui

    Resource Declaration:

    In c:/chef/cache/cookbooks/soapui/recipes/default.rb

    10: chocolatey_package ‘soapui’ do
    11: source "http://servername:8081/repository/
    12: options '-u=admin -p=admin123’
    13: version "v5.2.1"
    14: end

    Compiled Resource:

    Declared in c:/chef/cache/cookbooks/soapui/recipes/default.rb:10:in `from_


chocolatey_package("soapui") do
  package_name ["soapui"]
  action [:install]
  retries 0
  retry_delay 2
  default_guard_interpreter :default
  declared_type :chocolatey_package
  cookbook_name "soapui"
  recipe_name "default"
  source "http://servername:8081/repository/

options "-u=admin -p=admin123"
version [“v5.2.1”]


[2016-07-19T15:49:02+02:00] INFO: Running queued delayed notifications before re
-raising exception
Running handlers:
[2016-07-19T15:49:02+02:00] ERROR: Running exception handlers
Running handlers complete
[2016-07-19T15:49:02+02:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 18 seconds
[2016-07-19T15:49:02+02:00] INFO: Sending resource update report (run-id: 985740
[2016-07-19T15:49:02+02:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stack
[2016-07-19T15:49:02+02:00] FATAL: Please provide the contents of the stacktrace
.out file if you file a bug report
[2016-07-19T15:49:02+02:00] FATAL: Chef::Exceptions::package: chocolatey_package
[soapui] (soapui::default line 10) had an error: Chef::Exceptions::package: No v
ersion specified, and no candidate version available for soapui

Do you get the error? chocolatey seemes to recognize soapui though…

This means it could not find version v5.2.1. This makes sense since that format is not a legal nuget package version. Try 5.2.1 without the v.

okay! great i’ll try this!

Thanks a lot!