Error installing firefox or googlechrome using a recipe on windows

Hi,

I wrote a simple cookbook installing firefox using the chocolatey_package resource, it doesn’t work though. I also used chocolatey manually to install it but it indicates the same error

Starting Chef Client, version 12.10.24
[2016-07-18T16:34:55+02:00] INFO: *** Chef 12.10.24 ***
[2016-07-18T16:34:55+02:00] INFO: Platform: i386-mingw32
[2016-07-18T16:34:55+02:00] INFO: Chef-client pid: 6624
[2016-07-18T16:35:17+02:00] INFO: Setting the run_list to [#<Chef::RunList::RunL
istItem:0x4f99548 @version=nil, @type=:recipe, @name=“firefox”>] from CLI option
s
[2016-07-18T16:35:17+02:00] INFO: Run List is [recipe[firefox]]
[2016-07-18T16:35:17+02:00] INFO: Run List expands to [firefox]
[2016-07-18T16:35:17+02:00] INFO: Starting Chef Run for ACCOR-GSMTH5J.accor.loca
l.com
[2016-07-18T16:35:17+02:00] INFO: Running start handlers
[2016-07-18T16:35:17+02:00] INFO: Start handlers complete.
resolving cookbooks for run list: [“firefox”]
[2016-07-18T16:35:18+02:00] INFO: Loading cookbooks [firefox@0.1.0, chocolatey@1
.0.0, windows@1.39.2, chef_handler@1.3.0]
[2016-07-18T16:35:18+02:00] INFO: Removing cookbooks/tomcat/CHANGELOG.md from th
e cache; its cookbook is no longer needed on this client.
[2016-07-18T16:35:18+02:00] INFO: Removing cookbooks/tomcat/metadata.rb from the
cache; its cookbook is no longer needed on this client.
[2016-07-18T16:35:18+02:00] INFO: Removing cookbooks/tomcat/README.md from the c
ache; its cookbook is no longer needed on this client.
[2016-07-18T16:35:18+02:00] INFO: Removing cookbooks/tomcat/recipes/default.rb f
rom the cache; its cookbook is no longer needed on this client.
Synchronizing Cookbooks:

  • chocolatey (1.0.0)
    [2016-07-18T16:35:18+02:00] INFO: Storing updated cookbooks/firefox/README.md in
    the cache.
    [2016-07-18T16:35:18+02:00] INFO: Storing updated cookbooks/firefox/metadata.rb
    in the cache.
    [2016-07-18T16:35:18+02:00] INFO: Storing updated cookbooks/firefox/CHANGELOG.md
    in the cache.
    [2016-07-18T16:35:18+02:00] INFO: Storing updated cookbooks/firefox/recipes/defa
    ult.rb in the cache.
  • firefox (0.1.0)
  • chef_handler (1.3.0)
  • windows (1.39.2)
    Installing Cookbook Gems:
    Compiling Cookbooks…
    C:/opscode/chefdk/embedded/lib/ruby/2.1.0/i386-mingw32/dl.so: warning: already i
    nitialized constant DL::RUBY_FREE
    C:/opscode/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.1.1/lib/net/ssh/au
    thentication/pageant.rb:16: warning: previous definition of RUBY_FREE was here
    DL is deprecated, please use Fiddle
    Converging 3 resources
    Recipe: chocolatey::default
  • template[c:/chef/cache/install.ps1] action create[2016-07-18T16:35:18+02:00]
    INFO: Processing template[c:/chef/cache/install.ps1] action create (chocolatey:
    :default line 29)
    (up to date)

  • powershell_script[Install Chocolatey] action nothing[2016-07-18T16:35:20+02:
    00] INFO: Processing powershell_script[Install Chocolatey] action nothing (choco
    latey::default line 38)
    (skipped due to action :nothing)
    Recipe: firefox::default

  • chocolatey_package[firefox] action install[2016-07-18T16:35:20+02:00] INFO:
    Processing chocolatey_package[firefox] action install (firefox::default line 10)

    e[0m

====
Error executing action install on resource ‘chocolatey_package[firefox]’
============================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of C:\ProgramData\chocolatey/bin/choco.exe install -y fire

fox ----
STDOUT: Installing the following packages:
firefox
By installing you accept licenses for the packages.
firefox not installed. An error occurred during installation:
Le serveur distant a retourn? une erreur?: (400) Demande incorrecte.
The install of firefox was NOT successful.
firefox not installed. An error occurred during installation:
Le serveur distant a retourn? une erreur?: (400) Demande incorrecte.

Chocolatey installed 0/1 package(s). 1 package(s) failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures:
 - firefox
STDERR:
---- End output of C:\ProgramData\chocolatey/bin/choco.exe install -y firefo

x ----
Ran C:\ProgramData\chocolatey/bin/choco.exe install -y firefox returned 1

Resource Declaration:
---------------------
# In c:/chef/cache/cookbooks/firefox/recipes/default.rb

 10: chocolatey_package 'firefox' do
 11:  action  :install
 12: end

Compiled Resource:
------------------
# Declared in c:/chef/cache/cookbooks/firefox/recipes/default.rb:10:in `from

_file’

chocolatey_package("firefox") do
  package_name ["firefox"]
  action [:install]
  retries 0
  retry_delay 2
  default_guard_interpreter :default
  declared_type :chocolatey_package
  cookbook_name "firefox"
  recipe_name "default"
end

Platform:
---------
i386-mingw32

[2016-07-18T16:35:45+02:00] INFO: Running queued delayed notifications before re
-raising exception
e[0m
Running handlers:
[2016-07-18T16:35:45+02:00] ERROR: Running exception handlers
Running handlers complete
[2016-07-18T16:35:45+02:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 53 seconds
[2016-07-18T16:35:45+02:00] INFO: Sending resource update report (run-id: 387584
48-655b-420c-8c17-676f1edd4c02)
[2016-07-18T16:35:45+02:00] FATAL: Chef::Exceptions::JSON::EncodeError: Invalid
UTF-8 string '#<Mixlib::ShellOut::ShellCommandFailed: chocolatey_package[firefox
] (firefox::default line 10) had an error: Mixlib::ShellOut::ShellCommandFailed:
Expected process to exit with [0], but received ‘1’
---- Begin output of C:\ProgramData\chocolatey/bin/choco.exe install -y firefox

STDOUT: Installing the following packages:
firefox
By installing you accept licenses for the packages.
firefox not installed. An error occurred during installation:
Le serveur distant a retourn? une erreur?: (400) Demande incorrecte.
The install of firefox was NOT successful.
firefox not installed. An error occurred during installation:
Le serveur distant a retourn? une erreur?: (400) Demande incorrecte.

Chocolatey installed 0/1 package(s). 1 package(s) failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures:

  • firefox
    STDERR:
    ---- End output of C:\ProgramData\chocolatey/bin/choco.exe install -y firefox –

    Ran C:\ProgramData\chocolatey/bin/choco.exe install -y firefox returned 1>’: can
    not encode to UTF-8

I would try installing outside of chef via choco install and see if you still receive the same error. If so, its best to comment on the firefox package disqus thread on the chocolatey site. Based on what you are seeing, I’m guessing that the package install code is malforming the install URL. The chocolatey log may be helpful to look at as well which is usually in c:\programdata\chocolatey\logs.