chocolatey-community / chocolatey-cookbook Goto Github PK
View Code? Open in Web Editor NEWChef cookbook to install chocolatey and packages on Windows
License: Apache License 2.0
Chef cookbook to install chocolatey and packages on Windows
License: Apache License 2.0
Hello,
Need help with getting rub2.dev installed using chocolatey. Running into below error -
ruby2.devkit v4.7.2.2013022402 [Approved] - Possibly broken
Get-BinRoot is going to be deprecated in v1 and removed in v2. It is being replaced with Get-ToolsLocation, however many
packages no longer require a special separate directory since package folders no longer have versions on them. Some do
though and should continue to use Get-ToolsLocation.
Chocolatey is installing DevKit to C:\tools\DevKit2
Please wait...
ruby.devkit
Downloading ruby2.devkit 64 bit
from 'http://cdn.rubyinstaller.org/archives/devkits/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe'
Progress: 100% - Saving 42.09 MB of 42.22 MB (44131560/44275037)
Download of ruby.devkitInstall.exe (42.22 MB) completed.
Hashes match.
C:\Users\vagrant\AppData\Local\Temp\1\chocolatey\chocolatey\ruby.devkit\ruby.devkitInstall.exe
Removing legacy install devkit items from C:\tools\ruby23\bin if they exist
Moving config.yml to a holding location prior to extraction
Moving etc dir to a holding location prior to extraction
etc
Cleaning out the contents of C:\tools\DevKit2
Extracting the contents of C:\Users\vagrant\AppData\Local\Temp\1\chocolatey\chocolatey\ruby.devkit\ruby.devkitInstall.ex
e to C:\tools\DevKit2
Moving config.yml back after extraction
Moving etc dir back after extraction
You may want to configure your config.yml after this installation and rerun 'cinst ruby.devkit' if the defaults do not m
eet your needs
Initializing and installing DevKit into Ruby.
Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.
Invalid configuration or no Rubies listed. Please fix 'config.yml'
and rerun 'ruby dk.rb install'
WARNING: Write-ChocolateySuccess is deprecated and will be removed in v2. If you are the maintainer, please remove it fr
om your package file.
The install of ruby2.devkit was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\ruby2.devkit\tools\chocolateyInstall.ps1'.
See log for details.
Chocolatey installed 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures
- ruby2.devkit (exited -2) - Error while running 'C:\ProgramData\chocolatey\lib\ruby2.devkit\tools\chocolateyInstall.ps
1'.
See log for details.
chocolatey.txt
I am using the below code -
include_recipe 'chocolatey'
ruby_block "reset ENV['PATH']" do
block do
def powershell_stdout!(command)
powershell_out!(command).stdout.force_encoding('UTF-8').delete("\xEF\xBB\xBF").encode('ASCII-8BIT').delete("\r\n").chomp
end
path_machine = powershell_stdout!("[System.Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::Machine)")
path_user = powershell_stdout!("[System.Environment]::GetEnvironmentVariable('Path', [System.EnvironmentVariableTarget]::User)")
paths = [path_machine, path_user].reject { |e| e.empty? }.join(';')
powershell_out!("$env:PATH = '#{paths}'")
ENV['PATH'] = paths
end
end
node['chocolatey']['repositories'].each do |name,source|
powershell_script "Add chocolatey #{name} source" do
action :run
code "choco sources add -n#{name} -s#{source}"
not_if "[bool](choco sources |? { $_ -match '#{name} - #{source}' })"
end
end
chocolatey 'ruby' do
action :install
version 2.3.0
end
chocolatey 'ruby2.devkit' do
action :install
end
Attempting to install IIS-ASPNET45 via Chef recipe on a freshly-bootstrapped stock Windows 2012 AMI.
I get the following text in the log:
Error: 11
You cannot service a running 64-bit operating system with a 32-bit version of DISM.
Please use the version of DISM that corresponds to your computer's architecture.
The entire run is at http://pastebin.com/hXn14VPg and shows the command leading to that error at line 43.
c:/cygwin/var/log/setup.log become huge when using chef massively.
I am running into an issue where the cookbook will not install any packages. This is only happening on Windows2012 R2 I get the following output:
==> default: [2015-04-07T16:52:17-07:00] INFO: Processing chocolatey[vs2013agents] action install (build_server::windows line 16)
==> default: [2015-04-07T16:52:18-07:00] DEBUG: Checking to see if this chocolatey package is installed/upgradable: 'vs2013agents'
==> default: [2015-04-07T16:52:22-07:00] INFO: vs2013agents already installed - nothing to do.
==> default:
==> default: [2015-04-07T16:52:22-07:00] INFO: Processing chocolatey[microsoft-build-tools] action install (build_server::windows line 16)
==> default: [2015-04-07T16:52:23-07:00] DEBUG: Checking to see if this chocolatey package is installed/upgradable: 'microsoft-build-tools'
==> default: [2015-04-07T16:52:26-07:00] INFO: microsoft-build-tools already installed - nothing to do.
The problem seems to stem from the fact that on Windows 7, choco version
errors if it can't find the project, resulting in error code 1, but on Windows 2012, the command does not fail (returns code 0):
# Win 7 (Chocolatey v0.9.8.28 and v0.9.9.4)
PS C:\Windows\system32> choco version vs2013agents -localonly
No package found
No package found
Command 'version' failed (sometimes this indicates a partial failure). Additional info/packages: vs2013agents, -localonly
Disable this message by changing ksMessage to false in chocolatey.config.
PS C:\Windows\system32> $LastExitCode
1
# Win 2012 R2
PS C:\Users\vagrant> choco version vs2013agents -localonly
Chocolatey v0.9.9.4
DEPRECATION NOTICE - `choco version -lo` is deprecated. version command
will be removed in version 1.0.0. Please use `choco list -lo` instead.
0 packages installed.
PS C:\Users\vagrant> $LastExitCode
0
With this behavior, the package_installed? method will return true whether or not the package is already installed.
I've tried to fork and add this myself but I honestly don't know what I'm doing (it's not particularly obvious tbh), what looks like should work doesn't. Is this already a feature? if so how or could you please add this.
I need this so I can install ruby onto a deployment machine without breaking the ruby that gets installed with chef (I plan to have a user just for running my app and only it's path will contain the ruby stuff I need to get the app running)
I have been trying to run my custom cookbook against a windows VM.
The recipe requires chocolatey to be installed, however I am getting the following error ....
I can't tell by the code if using a secured repo feed (secured for read access) is possible?
Do you have to register the source with the username and password - if so can this be done by the chocolatey cookbook?
Is it possible to provide a username and password on individual resource items (preferable).
Thanks.
I have specified the following in my recipe with the expectation that if the chef client is run within an older version installed it will be upgraded to the version specified (this works), BUT if no version of the package is installed the action :upgrade will detect this and install the package. At present (chocolatey 0.9.8.32 & chef client 12.0.3)) the chef run completes without installing the package outputting: "Package chocolatey[nscp] already to latest version" but no package is installed.
chocolatey 'nscp' do
version '0.4.1.103'
action :upgrade
I was hoping to use the node['chocolatey']['upgrade'] attribute to keep the underlying chocolatey version up to date, but it doesn't seem to work. I think this is due to how the LWRP behaves if the version field is left blank as it is in the chocolatey "chocolatey" resource at the end of the default recipe.
Looking at the code in providers/default.rb, which runs in response to that resource, "package_installed?" will be true as obviously chocolatey is already installed (by the install.ps1 boot-strapper). We don't specify a particular version, so "package_exists?" also returns true. Unfortunately "upgradeable?" takes the latter as gospel so assumes there's nothing to do.
Would you accept a PR to only use @current_resource.exists if the version is not blank?
This is annoying, because the provider stops working :(
Closing the bug as the issue isn't what I originally thought
There is still some odd behaviour (the chef recipe said it couldn't upgrade because the package was installed, but chocolatey said it wasn't) but don't have time to investigate at the moment.
I've setup a windows server to run a chef recipe using the package handler. Everytime I run it from a metadata script I get the following error on any package (I've tried cygwin and googlechome)
Download of googlechromestandaloneenterprise64.msi (50.53 MB) completed.
Installing GoogleChrome...
GoogleChrome has been installed.
The install of googlechrome was successful.
Software installed as 'msi', install location is likely default.
googlechrome not installed. An error occurred during installation:
Value cannot be null.
Parameter name: path1
The install of googlechrome was NOT successful.
googlechrome not installed. An error occurred during installation:
Value cannot be null.
Parameter name: path1
Chocolatey installed 0/1 packages. 1 packages failed.
If I log into the server I can run the recipe without issue.
Getting an error when installing chocolatey to a test server using testkitchen - see console dump below. Shaved the .kitchen.yml run list to just the chocolatey install for demonstration, i.e.
run_list:
- recipe[chocolatey::default]
The testkitchen server is a 64bit Windows 2012R2 AWS instance. Looks like it's trying to execute a bad command ("C:\Windows\system32\C:\windows\sysnative\cmd.exe" /c ...). hate to submit the issue but I can't seem to find a workaround.
thx -/- jeff
run
on resource 'batch[install chocolatey]'Expected process to exit with [0], but received '1'
---- Begin output of "C:\Windows\system32\C:\windows\sysnative\cmd.exe" /c "C:/Users/ADMINI1/AppData/Local/Temp/chef-script20151008-5236-tkbbs4.bat" ----1/AppData/Local/Temp/chef-script20151008-5236-tkbbs4.bat" ----
STDOUT:
STDERR: The filename, directory name, or volume label syntax is incorrect.
---- End output of "C:\Windows\system32\C:\windows\sysnative\cmd.exe" /c "C:/Users/ADMINI
Ran "C:\Windows\system32\C:\windows\sysnative\cmd.exe" /c "C:/Users/ADMINI~1/AppData/Local/Temp/chef-script20151008-5236-tkbbs4.bat" returned 1
48: batch 'install chocolatey' do
49: architecture arch
50: interpreter cmd
51: code <<-EOH
52: powershell -noprofile -inputformat none -noninteractive -executionpolicy bypass -EncodedCommand #{chocolatey_install_script}
53: EOH
54: not_if { ChocolateyHelpers.chocolatey_installed? }
55: end
56:
Compiling Cookbooks...
uninitialized constant Chef::Provider::Chocolatey::Helpers
/home/eyurchenko/.chef/cache/cookbooks/chocolatey/providers/default.rb:19:in `class_from_file'
/home/eyurchenko/.chef/cache/cookbooks/chocolatey/providers/default.rb:
12: #
13: # Unless required by applicable law or agreed to in writing, software
14: # distributed under the License is distributed on an "AS IS" BASIS,
15: # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: # See the License for the specific language governing permissions and
17: # limitations under the License.
18: #
19>> include Chocolatey::Helpers
20:
21: use_inline_resources
22:
23: # Support whyrun
24: def whyrun_supported?
25: true
26: end
27:
28: def load_current_resource # rubocop:disable Metrics/AbcSize
Running handlers:
[2015-11-10T13:57:00+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-11-10T13:57:00+00:00] ERROR: Exception handlers complete
[2015-11-10T13:57:00+00:00] FATAL: Stacktrace dumped to /home/eyurchenko/.chef/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 4.623317211 seconds
[2015-11-10T13:57:00+00:00] ERROR: uninitialized constant Chef::Provider::Chocolatey::Helpers
[2015-11-10T13:57:00+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
There is no such problem with 0.4.1
Hello,
I am trying to install ruby and ruby dev kit using chocolatey cookbook but running into the below issues -
* chocolatey[ruby] action install
=====================================================================
===========
Error executing action `install` on resource 'chocolatey[ruby]'
=====================================================================
===========
Encoding::UndefinedConversionError
----------------------------------
"\xEF" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to UTF-16LE
Resource Declaration:
---------------------
# In C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/ruby/recipes/_configure-windows.rb
22: chocolatey 'ruby' do
23: action :install
24: version node['ruby']['version']
25: end
26:
Compiled Resource:
------------------
# Declared in C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookb
ooks/ruby/recipes/_configure-windows.rb:22:in `from_file'
chocolatey("ruby") do
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :chocolatey
cookbook_name "ruby"
recipe_name "_configure-windows"
version "2.3.0"
package "ruby"
end
Platform:
---------
x64-mingw32
Running handlers:
[2016-06-21T07:54:01-07:00] ERROR: Running exception handlers
Running handlers complete
[2016-06-21T07:54:01-07:00] ERROR: Exception handlers complete
Chef Client failed. 43 resources updated in 05 minutes 34 seconds
[2016-06-21T07:54:01-07:00] FATAL: Stacktrace dumped to C:/Users/vagrant/
AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
[2016-06-21T07:54:01-07:00] FATAL: Please provide the contents of the sta
cktrace.out file if you file a bug report
[2016-06-21T07:54:01-07:00] FATAL: Encoding::UndefinedConversionError: ch
ocolatey[ruby] (ruby::_configure-windows line 22) had an error: Encoding::
UndefinedConversionError: "\xEF" to UTF-8 in conversion from ASCII-8BIT to UTF-8
to UTF-16LE
$$$$$$ C:/opscode/chef/embedded/lib/ruby/2.1.0/x64-mingw32/dl.so: warning: alrea
dy initialized constant DL::RUBY_FREE
$$$$$$ C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.1.1/lib/net/s
sh/authentication/pageant.rb:16: warning: previous definition of RUBY_FREE was h
ere
$$$$$$ DL is deprecated, please use Fiddle
>>>>>> Converge failed on instance <default-windows-2008R2>.
>>>>>> Please see .kitchen/logs/default-windows-2008R2.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: WinRM exited (1) for command: [
$env:PATH = [System.Environment]::GetEnvironmentVariable("PATH","Machine")
& $env:systemdrive\opscode\chef\bin\chef-client.bat --local-mode --config $env:T
EMP\kitchen\client.rb --log_level auto --force-formatter --no-color --json-attri
butes $env:TEMP\kitchen\dna.json --chef-zero-port 8889]
>>>>>> ----------------------
Running this on Windows 7 OS with Chefdk 0.12.0. Chef client version - 12.8.1 and kitchen version 1.8.0
Not sure if this is the right place to ask about it but would appreciate if you can help with this or redirect to correct forum.
I'd love to see a new release of this cookbook on Supermarket. I'm dependent on the changes on master to allow installing behind a proxy.
Thank you...
This output below shows that installation of chocolatey via .ps1 failed, however next converge does not detect lack of chocolatey installation and reported as up_to_date. Supsequently failing on chocolatey_package
...
Recipe: chocolatey::default
* template[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/install.ps1] action create[2016-06-16T02:14:38-07:00] INFO: Processing template[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/install.ps1] action create (chocolatey::default line 29)
[2016-06-16T02:14:38-07:00] INFO: template[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/install.ps1] created file C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/install.ps1
- create new file C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/install.ps1[2016-06-16T02:14:38-07:00] INFO: template[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/install.ps1] updated file contents C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/install.ps1
- update content in file C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/install.ps1 from none to b3ab5a
--- C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/install.ps1 2016-06-16 02:14:38.000000000 -0700
+++ C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/chef-install.ps120160616-2792-txmd2g 2016-06-16 02:14:38.000000000 -0700
@@ -1 +1,148 @@
+# =====================================================================
+# Copyright 2011 - Present RealDimensions Software, LLC, and the
+# original authors/contributors from ChocolateyGallery
+# at https://github.com/chocolatey/chocolatey.org
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# =====================================================================
+
+# Environment Variables, specified as $env:NAME in PowerShell.exe and %NAME% in cmd.exe.
+# For explicit proxy, please set $env:chocolateyProxyLocation and optionally $env:chocolateyProxyUser and $env:chocolateyProxyPassword
+# For an explicit version of Chocolatey, please set $env:chocolateyVersion = 'versionnumber'
+# To target a different url for chocolatey.nupkg, please set $env:chocolateyDownloadUrl = 'full url to nupkg file'
+# NOTE: $env:chocolateyDownloadUrl does not work with $env:chocolateyVersion.
+# To use built-in compression (no 7zip download), please set $env:chocolateyUseWindowsCompression = 'true'
+
+$url = "https://chocolatey.org/api/v2/package/chocolatey/"
+
+$chocolateyVersion = $env:chocolateyVersion
+if (![string]::IsNullOrEmpty($chocolateyVersion)){
+ Write-Output "Downloading specific version of Chocolatey: $chocolateyVersion"
+ $url = "https://chocolatey.org/api/v2/package/chocolatey.$chocolateyVersion.nupkg"
+}
+
+$chocolateyDownloadUrl = $env:chocolateyDownloadUrl
+if (![string]::IsNullOrEmpty($chocolateyDownloadUrl)){
+ Write-Output "Downloading Chocolatey from : $chocolateyDownloadUrl"
+ $url = "$chocolateyDownloadUrl"
+}
+
+if ($env:TEMP -eq $null) {
+ $env:TEMP = Join-Path $env:SystemDrive 'temp'
+}
+$chocTempDir = Join-Path $env:TEMP "chocolatey"
+$tempDir = Join-Path $chocTempDir "chocInstall"
+if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir)}
+$file = Join-Path $tempDir "chocolatey.zip"
+
+function Download-File {
+param (
+ [string]$url,
+ [string]$file
+ )
+ Write-Output "Downloading $url to $file"
+ $downloader = new-object System.Net.WebClient
+
+ $defaultCreds = [System.Net.CredentialCache]::DefaultCredentials
+ if ($defaultCreds -ne $null) {
+ $downloader.Credentials = $defaultCreds
+ }
+
+ # check if a proxy is required
+ $explicitProxy = $env:chocolateyProxyLocation
+ $explicitProxyUser = $env:chocolateyProxyUser
+ $explicitProxyPassword = $env:chocolateyProxyPassword
+ if ($explicitProxy -ne $null) {
+ # explicit proxy
+ $proxy = New-Object System.Net.WebProxy($explicitProxy, $true)
+ if ($explicitProxyPassword -ne $null) {
+ $passwd = ConvertTo-SecureString $explicitProxyPassword -AsPlainText -Force
+ $proxy.Credentials = New-Object System.Management.Automation.PSCredential ($explicitProxyUser, $passwd)
+ }
+
+ Write-Output "Using explicit proxy server '$explicitProxy'."
+ $downloader.Proxy = $proxy
+
+ } elseif (!$downloader.Proxy.IsBypassed($url))
+ {
+ # system proxy (pass through)
+ $creds = $defaultCreds
+ if ($creds -eq $null) {
+ Write-Debug "Default credentials were null. Attempting backup method"
+ $cred = get-credential
+ $creds = $cred.GetNetworkCredential();
+ }
+ $proxyaddress = $downloader.Proxy.GetProxy($url).Authority
+ Write-Output "Using system proxy server '$proxyaddress'."
+ $proxy = New-Object System.Net.WebProxy($proxyaddress)
+ $proxy.Credentials = $creds
+ $downloader.Proxy = $proxy
+ }
+
+ $downloader.DownloadFile($url, $file)
+}
+
+# Download the Chocolatey package
+Download-File $url $file
+
+# Determine unzipping method
+$unzipMethod = '7zip'
+if (![string]::IsNullOrEmpty($env:chocolateyUseWindowsCompression)){
+ Write-Output 'Using built in compression to unzip.'
+ $unzipMethod = 'builtin'
+}
+
+if ($unzipMethod -eq '7zip') {
+ # download 7zip
+ Write-Output "Download 7Zip commandline tool"
+ $7zaExe = Join-Path $tempDir '7za.exe'
+ Download-File 'https://chocolatey.org/7za.exe' "$7zaExe"
+
+ # unzip the package
+ Write-Output "Extracting $file to $tempDir..."
+ Start-Process "$7zaExe" -ArgumentList "x -o`"$tempDir`" -y `"$file`"" -Wait -NoNewWindow
+} else {
+ # unzip the package
+ Write-Output "Extracting $file to $tempDir..."
+ $shellApplication = new-object -com shell.application
+ $zipPackage = $shellApplication.NameSpace($file)
+ $destinationFolder = $shellApplication.NameSpace($tempDir)
+ $destinationFolder.CopyHere($zipPackage.Items(),0x10)
+}
+
+# Call chocolatey install
+Write-Output "Installing chocolatey on this machine"
+$toolsFolder = Join-Path $tempDir "tools"
+$chocInstallPS1 = Join-Path $toolsFolder "chocolateyInstall.ps1"
+
+& $chocInstallPS1
+
+Write-Output 'Ensuring chocolatey commands are on the path'
+$chocInstallVariableName = "ChocolateyInstall"
+$chocoPath = [Environment]::GetEnvironmentVariable($chocInstallVariableName)
+if ($chocoPath -eq $null -or $chocoPath -eq '') {
+ $chocoPath = 'C:\ProgramData\Chocolatey'
+}
+
+$chocoExePath = Join-Path $chocoPath 'bin'
+
+if ($($env:Path).ToLower().Contains($($chocoExePath).ToLower()) -eq $false) {
+ $env:Path = [Environment]::GetEnvironmentVariable('Path',[System.EnvironmentVariableTarget]::Machine);
+}
+
+Write-Output 'Ensuring chocolatey.nupkg is in the lib folder'
+$chocoPkgDir = Join-Path $chocoPath 'lib\chocolatey'
+$nupkg = Join-Path $chocoPkgDir 'chocolatey.nupkg'
+if (![System.IO.Directory]::Exists($chocoPkgDir)) { [System.IO.Directory]::CreateDirectory($chocoPkgDir); }
+Copy-Item "$file" "$nupkg" -Force -ErrorAction SilentlyContinue
[2016-06-16T02:14:38-07:00] INFO: template[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/install.ps1] sending run action to powershell_script[Install Chocolatey] (immediate)
* powershell_script[Install Chocolatey] action run[2016-06-16T02:14:38-07:00] INFO: Processing powershell_script[Install Chocolatey] action run (chocolatey::default line 38)
[execute] C:\Users\vagrant\AppData\Local\Temp\chef-script20160616-2792-1m52tg1.ps1 : The
remote name could not be resolved: 'chocolatey.org'
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep
tion
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
n,chef-script20160616-2792-1m52tg1.ps1
================================================================================
Error executing action `run` on resource 'powershell_script[Install Chocolatey]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20160616-2792-1m52tg1.ps1" ----
STDOUT:
STDERR: C:\Users\vagrant\AppData\Local\Temp\chef-script20160616-2792-1m52tg1.ps1 : The
remote name could not be resolved: 'chocolatey.org'
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep
tion
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
n,chef-script20160616-2792-1m52tg1.ps1
---- End output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20160616-2792-1m52tg1.ps1" ----
Ran "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20160616-2792-1m52tg1.ps1" returned 1
Resource Declaration:
---------------------
# In C:\Users\vagrant\AppData\Local\Temp\kitchen\cookbooks\chocolatey\recipes\default.rb
38: powershell_script 'Install Chocolatey' do
39: action :nothing
40: environment node['chocolatey']['install_vars']
41: cwd Chef::Config['file_cache_path']
42: code install_ps1
43: end
Compiled Resource:
------------------
# Declared in C:\Users\vagrant\AppData\Local\Temp\kitchen\cookbooks\chocolatey\recipes\default.rb:38:in `from_file'
powershell_script("Install Chocolatey") do
action [:nothing]
retries 0
retry_delay 2
default_guard_interpreter :powershell_script
command "Install Chocolatey"
backup 5
cwd "C:\\Users\\vagrant\\AppData\\Local\\Temp\\kitchen\\cache"
environment {"chocolateyProxyLocation"=>nil, "chocolateyProxyUser"=>nil, "chocolateyProxyPassword"=>nil, "chocolateyVersion"=>nil, "chocolateyDownloadUrl"=>"https://chocolatey.org/api/v2/package/chocolatey", "chocolateyUseWindowsCompression"=>nil}
returns 0
code "C:\\Users\\vagrant\\AppData\\Local\\Temp\\kitchen\\cache/install.ps1"
interpreter "powershell.exe"
declared_type :powershell_script
cookbook_name :chocolatey
recipe_name "default"
end
Platform:
---------
x64-mingw32
[2016-06-16T02:14:51-07:00] INFO: Running queued delayed notifications before re-raising exception
Running handlers:
[2016-06-16T02:14:51-07:00] ERROR: Running exception handlers
Running handlers complete
[2016-06-16T02:14:51-07:00] ERROR: Exception handlers complete
Chef Client failed. 16 resources updated in 03 minutes 14 seconds
[2016-06-16T02:14:51-07:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
[2016-06-16T02:14:51-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-06-16T02:14:51-07:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: powershell_script[Install Chocolatey] (chocolatey::default line 38) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20160616-2792-1m52tg1.ps1" ----
STDOUT:
STDERR: C:\Users\vagrant\AppData\Local\Temp\chef-script20160616-2792-1m52tg1.ps1 : The
remote name could not be resolved: 'chocolatey.org'
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep
tion
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
n,chef-script20160616-2792-1m52tg1.ps1
---- End output of "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20160616-2792-1m52tg1.ps1" ----
Ran "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20160616-2792-1m52tg1.ps1" returned 1
$$$$$$ C:/opscode/chef/embedded/lib/ruby/2.1.0/x64-mingw32/dl.so: warning: already initialized constant DL::RUBY_FREE
$$$$$$ C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.1.1/lib/net/ssh/authentication/pageant.rb:16: warning: previous definition of RUBY_FREE was here
$$$$$$ DL is deprecated, please use Fiddle
Converge failed on instance .
Please see .kitchen/logs/certification-wind2012-r2.log for more details
------Exception-------
Class: Kitchen::ActionFailed
Message: WinRM exited (1) for command: [$env:PATH = [System.Environment]::GetEnvironmentVariable("PATH","Machine")
& $env:systemdrive\opscode\chef\bin\chef-solo.bat --config $env:TEMP\kitchen\solo.rb --log_level info --force-formatter --no-color --json-attributes $env:TEMP\kitchen\dna.json]
-----> Starting Kitchen (v1.9.1)
-----> Converging ...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 4.3.3...
Removing non-cookbook files before transfer
Preparing solo.rb
-----> Chef Omnibus installation detected (12.10.24)
Transferring files to ...
Starting Chef Client, version 12.10.24
[2016-06-16T02:30:08-07:00] INFO: *** Chef 12.10.24 ***
[2016-06-16T02:30:08-07:00] INFO: Platform: x64-mingw32
...stuff....
Recipe: chocolatey::default
* template[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/install.ps1] action create[2016-06-16T02:30:46-07:00] INFO: Processing template[C:\Users\vagrant\AppData\Local\Temp\kitchen\cache/install.ps1] action create (chocolatey::default line 29)
(up to date)
* powershell_script[Install Chocolatey] action nothing[2016-06-16T02:30:47-07:00] INFO: Processing powershell_script[Install Chocolatey] action nothing (chocolatey::default line 38)
(skipped due to action :nothing)
Recipe: windows_11::_post_reboot
* chocolatey_package[sublimetext3] action install[2016-06-16T02:30:47-07:00] INFO: Processing chocolatey_package[sublimetext3] action install (windows_lab_11::answers_post_reboot line 171)
================================================================================
Error executing action `install` on resource 'chocolatey_package[sublimetext3]'
================================================================================
Chef::Exceptions::MissingLibrary
--------------------------------
Could not locate your Chocolatey install. To install chocolatey, we recommend
the 'chocolatey' cookbook (https://github.com/chocolatey/chocolatey-cookbook).
If Chocolatey is installed, ensure that the 'ChocolateyInstall' environment
variable is correctly set. You can verify this with the PowerShell command
'[System.Environment]::GetEnvironmentVariable('ChocolateyInstall', 'MACHINE')'.
Resource Declaration:
---------------------
# In C:\Users\vagrant\AppData\Local\Temp\kitchen\cookbooks\windows_lab_11\recipes\answers_post_reboot.rb
171: chocolatey_package 'sublimetext3'
172: # or
Compiled Resource:
------------------
# Declared in C:\Users\vagrant\AppData\Local\Temp\kitchen\cookbooks\windows_lab_11\recipes\answers_post_reboot.rb:171:in `from_file'
chocolatey_package("sublimetext3") do
package_name ["sublimetext3"]
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :chocolatey_package
cookbook_name :windows_lab_11
recipe_name "answers_post_reboot"
end
Platform:
---------
x64-mingw32
[2016-06-16T02:30:47-07:00] INFO: Running queued delayed notifications before re-raising exception
Running handlers:
[2016-06-16T02:30:47-07:00] ERROR: Running exception handlers
Running handlers complete
[2016-06-16T02:30:47-07:00] ERROR: Exception handlers complete
Chef Client failed. 3 resources updated in 39 seconds
[2016-06-16T02:30:47-07:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
[2016-06-16T02:30:47-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2016-06-16T02:30:47-07:00] FATAL: Chef::Exceptions::MissingLibrary: chocolatey_package[sublimetext3] (windows_lab_11::answers_post_reboot line 171) had an error: Chef::Exceptions::MissingLibrary: Could not locate your Chocolatey install. To install chocolatey, we recommend
the 'chocolatey' cookbook (https://github.com/chocolatey/chocolatey-cookbook).
If Chocolatey is installed, ensure that the 'ChocolateyInstall' environment
variable is correctly set. You can verify this with the PowerShell command
'[System.Environment]::GetEnvironmentVariable('ChocolateyInstall', 'MACHINE')'.
$$$$$$ C:/opscode/chef/embedded/lib/ruby/2.1.0/x64-mingw32/dl.so: warning: already initialized constant DL::RUBY_FREE
$$$$$$ C:/opscode/chef/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-3.1.1/lib/net/ssh/authentication/pageant.rb:16: warning: previous definition of RUBY_FREE was here
$$$$$$ DL is deprecated, please use Fiddle
Converge failed on instance .
Please see .kitchen/logs/certification-wind2012-r2.log for more details
------Exception-------
Class: Kitchen::ActionFailed
Message: WinRM exited (1) for command: [$env:PATH = [System.Environment]::GetEnvironmentVariable("PATH","Machine")
& $env:systemdrive\opscode\chef\bin\chef-solo.bat --config $env:TEMP\kitchen\solo.rb --log_level info --force-formatter --no-color --json-attributes $env:TEMP\kitchen\dna.json]
alexvinyar@seavinyar02 ~/Documents/Trainings_keys_ppt/certification/cert-chef_for_windows/windows_lab_1 (lab_1โ)$
If for example I'm requesting version of a package 1.0.3 and 1.0.4 is installed, an install action will be repeatedly executed (i.e. on every chef-client run), and any notifications will be done every single time.
Could version requirements be interpreted as "that version or higher"?
Starting with chef 12.3.0, recipes using the chocolatey resource are throwing an exception as they successfully conclude. Here's a bit of the log. These both appear to be related to Chef having problems regex processing pathnames that have Windows path separators and regex trying to handle those as special characters.
(The installs are completing successfully because I can visit the guest and see that the requested package was indeed installed even though the chef run ended with the exception.
==> vb-tt-sync: [2015-05-12T12:43:37-07:00] DEBUG: providers that support resource execute[install package google-chrome-x64] include: [Chef::Provider::Execute]
==> vb-tt-sync: [2015-05-12T12:43:37-07:00] DEBUG: providers that survived replacement include: [Chef::Provider::Execute]
==> vb-tt-sync: C:/opscode/chef/embedded/apps/chef/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb:66: warning: invalid Unicode Property \p
==> vb-tt-sync:
==> vb-tt-sync: [2015-05-12T12:44:33-07:00] INFO: Running queued delayed notifications before re-raising exception
==> vb-tt-sync: [2015-05-12T12:44:33-07:00] INFO: Running queued delayed notifications before re-raising exception
==> vb-tt-sync: [2015-05-12T12:44:33-07:00] DEBUG: Re-raising exception: RegexpError - invalid backref number/name: /^C:\tmp\vagrant-chef\6c0f26688ebda1accbe1d0ab76a99d3f\cookbooks\chocolatey-chrome\recipes\default.rb:([\d]+)/
chocolatey cookbook used to work but since last release it can not install chocolatey on windows 2012 r2.
this is the error:
==> win2012: code " powershell -noprofile -inputformat none -noninteractive -executionpolicy bypass -EncodedCommand IAAgACQAdwBjACAAPQAgAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABOAGUAdAAuAFcAZQBiAEMAbABpAGUAbgB0AAoAIAAgACQAdwBwAD0AWwBzAHkAcwB0AGUAbQAuAG4AZQB0AC4AVwBlAGIAUAByAG8AeAB5AF0AOgA6AEcAZQB0AEQAZQBmAGEAdQBsAHQAUAByAG8AeAB5ACgAKQAKACAAIAAkAHcAcAAuAFUAcwBlAEQAZQBmAGEAdQBsAHQAQwByAGUAZABlAG4AdABpAGEAbABzAD0AJAB0AHIAdQBlAAoAIAAgACQAdwBjAC4AUAByAG8AeAB5AD0AJAB3AHAACgAgACAASQBuAHYAbwBrAGUALQBFAHgAcAByAGUAcwBzAGkAbwBuACAAKAAkAHcAYwAuAEQAbwB3AG4AbABvAGEAZABTAHQAcgBpAG4AZwAoACcAaAB0AHQAcABzADoALwAvAGMAaABvAGMAbwBsAGEAdABlAHkALgBvAHIAZwAvAGkAbgBzAHQAYQBsAGwALQBsAGEAcwB0AHAAbwBzAGgAYwBsAGkAZQBuAHQALgBwAHMAMQAnACkAKQAKAA==\n"
==> win2012: interpreter "C:\windows\sysnative\cmd.exe"
==> win2012: declared_type :batch
==> win2012: cookbook_name :chocolatey
==> win2012: recipe_name "default"
==> win2012: architecture :x86_64
==> win2012: not_if { #code block }
==> win2012: end
==> win2012:
==> win2012: [2015-10-09T03:02:27-07:00] INFO: Running queued delayed notifications before re-raising exception
==> win2012:
==> win2012: Running handlers:
==> win2012: [2015-10-09T03:02:27-07:00] ERROR: Running exception handlers
==> win2012: Running handlers complete
==> win2012: [2015-10-09T03:02:27-07:00] ERROR: Exception handlers complete
==> win2012: Chef Client failed. 0 resources updated in 01 minutes 03 seconds
==> win2012: [2015-10-09T03:02:27-07:00] FATAL: Stacktrace dumped to C:/chef/cache/chef-stacktrace.out
==> win2012: [2015-10-09T03:02:27-07:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: batchinstall chocolatey had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
==> win2012: ---- Begin output of "C:\Windows\system32\C:\windows\sysnative\cmd.exe" /c "C:/Users/vagrant/AppData/Local/Temp/chef-script20151009-2704-eii6yz.bat" ----
==> win2012: STDOUT:
==> win2012: STDERR: The filename, directory name, or volume label syntax is incorrect.
==> win2012: ---- End output of "C:\Windows\system32\C:\windows\sysnative\cmd.exe" /c "C:/Users/vagrant/AppData/Local/Temp/chef-script20151009-2704-eii6yz.bat" ----
==> win2012: Ran "C:\Windows\system32\C:\windows\sysnative\cmd.exe" /c "C:/Users/vagrant/AppData/Local/Temp/chef-script20151009-2704-eii6yz.bat" returned 1
It seems that setting node['chocolatey']['install_vars']['chocolateyVersion']
isn't being picked up properly by the installation. I've tried setting this in my attributes file and in the actual recipe of my wrapper cookbook. I'm wondering if this has to do with the way environment variable work (or don't work) on Windows in that running the installation without starting a new session does not pick up the set env variable.
To reproduce, from a wrapper cookbook, set node.default['chocolatey']['install_vars']['chocolateyVersion'] = '0.9.10.3'
and then include the chocolatey
recipe. The expected outcome should be that version 0.9.10.3 of Chocolatey is installed but the actual is that 0.10.0 is installed.
Any ideas what's happening and how I can make sure that 0.9 is the installed version since 0.10 introduced breaking changes that many Chocolatey packages have not adjusted for.
This cookbook doesn't work with version 0.9.9 and above. The main reason is the missing "-y" flag.
Recipe: mrts_choco::default
directory[C:/ProgramData/chocolatey//config] action create (up to date)
cookbook_file[chocolatey.config] action create (up to date)
chocolatey[pyyaml] action install
install
on resource 'chocolatey[pyyaml]'undefined method `new' for Chocolatey:Module
Attempting to install Chocolatey and then MySQL via the cookbook in a single Chef run results in breakage...
==> default: Recipe: win7mysql::default
==> default: * chocolatey[mysql] action install
==> default: * execute[install package mysql] action run
==> default:
==> default:
==> default: ================================================================================
==> default: Error executing action `run` on resource 'execute[install package mysql]'
==> default: ================================================================================
==> default:
==> default: Mixlib::ShellOut::ShellCommandFailed
==> default: ------------------------------------
==> default: Expected process to exit with [0], but received '1'
==> default: ---- Begin output of "C:\ProgramData\chocolatey/bin/choco" install -y mysql ----
==> default: STDOUT: Chocolatey v0.9.9.8
==> default:
==> default: Installing the following packages:
==> default:
==> default: mysql
==> default: By installing you accept licenses for the packages.
==> default:
==> default:
==> default:
==> default: lessmsi v1.3
==> default:
==> default: Creating C:\ProgramData\chocolatey\lib\lessmsi\tools\AddWindowsExplorerShortcut.exe.ignore
==> default:
==> default: Directory: C:\ProgramData\chocolatey\lib\lessmsi\tools
==> default:
==> default: Mode LastWriteTime Length Name
==> default:
==> default: ---- ------------- ------ ----
==> default:
==> default: -a--- 07/16/2015 15:38 0 AddWindowsExplorerShortcut.exe.ign
==> default:
==> default: ore
==> default:
==> default: Downloading LessMsi 32 bit
==> default:
==> default: from 'https://github.com/activescott/lessmsi/releases/download/v1.3/lessmsi-v1.3.zip'
==> default:
==> default: Extracting C:\Users\TW\AppData\Local\Temp\chocolatey\LessMsi\LessMsiInstall.zip to C:\ProgramData\chocolatey\lib\lessmsi\tools...
==> default:
==> default: C:\ProgramData\chocolatey\lib\lessmsi\tools
==> default:
==> default: WARNING: Write-ChocolateySuccess is deprecated. If you are the maintainer,
==> default:
==> default: please remove it from your package file.
==> default:
==> default: ShimGen has successfully created a shim for lessmsi-gui.exe
==> default: ShimGen has successfully created a shim for lessmsi.exe
==> default:
==> default: The install of lessmsi was successful.
==> default:
==> default:
==> default:
==> default: 7zip.commandline v9.38
==> default:
==> default: Downloading 7zip.commandline 32 bit
==> default:
==> default: from 'http://www.7-zip.org/a/7z938.msi'
==> default:
==> default: The term 'lessmsi' is not recognized as the name of a cmdlet, function, script
==> default:
==> default: file, or operable program. Check the spelling of the name, or if a path was inc
==> default:
==> default: luded, verify that the path is correct and try again.
==> default:
==> default: At C:\ProgramData\chocolatey\lib\7zip.commandline\tools\chocolateyInstall.ps1:1
==> default:
==> default: 4 char:2
==> default:
==> default: + & <<<< lessmsi x "$fileName" "$installDir\"
==> default:
==> default: + CategoryInfo : ObjectNotFound: (lessmsi:String) [], CommandNotF
==> default:
==> default: oundException
==> default:
==> default: + FullyQualifiedErrorId : CommandNotFoundException
==> default:
==> default: Downloading 32 bit
==> default:
==> default: from 'http://www.7-zip.org/a/7z938-extra.7z'
==> default:
==> default: Extracting C:\Users\TW\AppData\Local\Temp\chocolatey\Install.zip to C:\ProgramData\chocolatey\lib\7zip.commandline\tools\7zip...
==> default:
==> default: Mode LastWriteTime Length Name
==> default:
==> default: ---- ------------- ------ ----
==> default:
==> default: d---- 07/16/2015 15:39 7zip
==> default:
==> default: C:\ProgramData\chocolatey\lib\7zip.commandline\tools\7zip
==> default:
==> default: The install of 7zip.commandline was NOT successful.
==> default:
==> default: Error while running 'C:\ProgramData\chocolatey\lib\7zip.commandline\tools\chocolateyInstall.ps1'.
==> default:
==> default: See log for details.
==> default:
==> default:
==> default:
==> default: mysql v5.6.25.20150611
==> default:
==> default: Get-BinRoot is going to be deprecated by v1. Many packages no longer require it since the folders no longer have versions on them.
==> default:
==> default: Adding 'C:\tools\mysql\current\bin' to the path and the current shell path
==> default:
==> default: PATH environment variable does not have C:\tools\mysql\current\bin in it. Adding...
==> default:
==> default: Mode LastWriteTime Length Name
==> default:
==> default: ---- ------------- ------ ----
==> default:
==> default: d---- 07/16/2015 15:39 mysql
==> default:
==> default: d---- 07/16/2015 15:39 mysql
==> default:
==> default: Downloading mysql 32 bit
==> default:
==> default: from 'http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.25-win32.zip'
==> default:
==> default: Extracting C:\Users\TW\AppData\Local\Temp\chocolatey\mysql\mysql.zip to C:\tools\mysql...
==> default:
==> default: C:\tools\mysql
==> default:
==> default: Shutting down MySQL if it is running
==> default: [SC] OpenService FAILED 1060:
==> default:
==> default: The specified service does not exist as an installed service.
==> default:
==> default: Copying contents of 'C:\tools\mysql\mysql-5.6.25-win32' to 'C:\tools\mysql\current'.
==> default:
==> default: d---- 07/16/2015 15:42 bin
==> default:
==> default: Installing the mysql service
==> default:
==> default: Service successfully installed.
==> default:
==> default: The MySQL service is starting.
==> default:
==> default: The MySQL service was started successfully.
==> default:
==> default: The install of mysql was successful.
==> default:
==> default:
==> default:
==> default: Chocolatey installed 2/3 package(s). 1 package(s) failed.
==> default:
==> default: See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
==> default: Failures:
==> default:
==> default: - 7zip.commandline
==> default: STDERR:
==> default: ---- End output of "C:\ProgramData\chocolatey/bin/choco" install -y mysql ----
==> default: Ran "C:\ProgramData\chocolatey/bin/choco" install -y mysql returned 1
==> default:
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In C:\vagrant-chef\365bb30fc3a3f8d71c302da722515691\cookbooks\chocolatey\providers\default.rb
==> default:
==> default: 119: execute "install package #{name}" do
==> default: 120: command "#{::ChocolateyHelpers.chocolatey_executable} install -y #{cmd_args} #{name}"
==> default: 121: end
==> default: 122: end
==> default:
==> default: Compiled Resource:
==> default: ------------------
==> default: # Declared in C:\vagrant-chef\365bb30fc3a3f8d71c302da722515691\cookbooks\chocolatey\providers\default.rb:119:in `install'
==> default:
==> default: execute("install package mysql") do
==> default: action [:run]
==> default: retries 0
==> default: retry_delay 2
==> default: default_guard_interpreter :execute
==> default: command "\"C:\\ProgramData\\chocolatey/bin/choco\" install -y mysql"
==> default: backup 5
==> default:
==> default: returns 0
==> default: declared_type :execute
==> default: cookbook_name :win7mysql
==> default: end
==> default:
==> default: [2015-07-16T15:43:38-07:00] INFO: Running queued delayed notifications before re-raising exception
==> default:
==> default:
==> default: ================================================================================
==> default: Error executing action `install` on resource 'chocolatey[mysql]'
==> default: ================================================================================
==> default:
==> default: Mixlib::ShellOut::ShellCommandFailed
==> default: ------------------------------------
==> default: execute[install package mysql] (C:\vagrant-chef\365bb30fc3a3f8d71c302da722515691\cookbooks\chocolatey\providers\default.rb line 119) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
This chef run was launched through a Vagrant provisioning run, but I get the same behavior when I run chef-solo manually on the box as well. The recipe I wrote is very minimal, just:
include_recipe 'chocolatey::default'
chocolatey 'mysql'
I suspect the problem is that the cookbook launches a separate powershell instance to download and install Chocolatey, so the PATH never gets updated in the original shell to include C:\ProgramData\chocolatey\bin, and subsequently any Chocolatey package that depends on being able to find its dependent packages in the path will fail to install.
Let me know if I can provide any additional information!
Thanks,
Craig
7zip.install package when executed as "choco list -ar 7zip.install" outputs versions not in chronological order and it's causing chef to think that latest version of 7zip.install package is 9.38 while latest version if actually 16.02. So on each run it chef will perform upgrade of 7zip package as below
Recipe: iis_dsc::chocolatey
* chocolatey_package[Common tools] action upgrade
- upgrade package 7zip.install from 16.02 to 9.38
PS C:\Windows\system32> choco list -ar 7zip.install
7zip.install|15.05
7zip.install|15.06
7zip.install|15.07
7zip.install|15.08
7zip.install|15.09
7zip.install|15.10
7zip.install|15.11
7zip.install|15.12
7zip.install|15.14
7zip.install|16.00
7zip.install|16.01
7zip.install|16.02
7zip.install|9.22.0
7zip.install|9.22.01.20130618
7zip.install|9.38
Right now, there is args
and options
for passing in arguments to cinst
/chocolatey
but it can be confusing due to the layers of quoting that must be done:
In addition, the options
prepends a dash (-
) to each argument, which makes doing double dash --
items hard.
It took me a while to figure out how to pass in an -ia
option with spaces in it.
A better solution might be passing in a Hash
as an attribute of the resource and the cookbook would unpack that and do quoting on its own. Or have it write an .xml
, .yml
, or .json
file that Chocolatey could be made to understand.
Possible Example:
chocolatey 'VisualStudio2013Professional' do
options(
install_aguments: [ '/Silent', '/Features:WebTools Win8SDK'],
debug: true,
verbose: true,
version: '12.0.21005.20141031'
)
end
Alternatively, we could try to understand all possible options to chocolatey, but that seems like we'd be playing catch-up with Chocolatey all the time. Example:
chocolatey 'VisualStudio2013Professional' do
install_aguments [ '/Silent', '/Features:WebTools Win8SDK'],
debug true,
verbose true,
version '12.0.21005.20141031'
end
WARN: Using an LWRP by its name (Chocolatey) directly is no longer supported in Chef 12 and will be removed. Use Chef::Resource.resource_for_node(node, name) instead.
It would be nice to have a chocolatey_source
resource to manage/manipulate the sources.
Examples:
chocolatey_source 'chocolatey' do
source 'https://chocolatey.org/api/v2/'
priority 0
end
chocolatey_source 'private' do
source 'https://nexus.example.com/service/local/nuget/chocolatey`
username 'joecool'
password 'sekret'
priority 10
end
I recently tried changing my vagrant provisioning from using shell and chocolatey to using chef. I ran into a number of problems that were very tricky to track down
chocolatey 'git.install' do
options 'params' => "'/GitOnlyOnPath'"
end
git 'Users/IEUser/Config' do
repository 'https://github.com/byrney/Config.git'
end
The git clone will fail because git is added to the user path but the chef process does not pick up the changes. A workaround is to explicitly add git to the path in the recipe using a ruby_block or to split into two chef runs (install git, use git).
The second one is worse since it stomped all over my chef install
chocolatey 'ruby' do
action :install
version '2.1.6'
end
chocolatey 'rubygems' do
action :install
version '2.4.6'
end
ruby
gets installed and adds itself to the path. rubygems
assumes that the system ruby is first on the path and does this:
Start-ChocolateyProcessAsAdmin 'setup.rb' 'ruby' -validExitCodes $validExitCodes
The ruby just installed is not on the path and the rubygems
package will "upgrade" the gems in c:\opscode\chef\embedded\...
which is the only ruby in the path at this point.
My workaround of adding the chocolatey ruby to ENV['PATH']
in the recipe worked until ruby got updated (the chocolatey ruby directory includes the version number) and then the gems package stomped on the opscode version again.
There seems to be specific logic in ruby2.devkit
package to handle this, refreshing the local $env:PATH
before calling ruby. Adding it to the rubygems
package would fix the problem but wouldn't fix the issue with the git cookbook.
I created a fork of the chocolatey cookbook which will refresh ENV['PATH']
using a similar approach so that it can be applied to any chocolatey install.
Chef: 12.4.3
Cookbook: 0.4.1
The package_exists?
method doesn't seem to work. I don't see the INFO message "blah already installed - nothing to do." and I always see the execute
being run.
This is problematic because I have reboot handlers for certain packages and with the package_exists?
being broken, it is causing a reboot every run.
Per choco#158, choco list
may default to local only in the future. choco search
should be used instead to list all packages, including those not installed.
Not sure if this is the right place to put this...
I have a chef recipe that runs the following code block:
include_recipe 'chocolatey'
chocolatey 'visualstudio2013ultimate'
chocolatey 'visualstudio2013ultimate' do
args '--force'
end
On the first run I get the output:
Recipe: windows-build-agent::chocostudio
* execute[install package visualstudio2013ultimate] action run
- execute "C:\ProgramData\chocolatey/bin/choco" install -y visualstudio2013ultimate
(up to date)
On the second run I get the output:
Recipe: windows-build-agent::chocostudio
(up to date)
(up to date)
neither of them actually install VS. If I log into the instance and run choco install, I get this:
PS C:\programdata\chocolatey> .\choco.exe install visualstudio2013ultimate
Chocolatey v0.9.9.8
Installing the following packages:
visualstudio2013ultimate
By installing you accept licenses for the packages.
VisualStudio2013Ultimate v12.0.21005.20141031 already installed.
Use --force to reinstall, specify a version to install, or try upgrade.
Chocolatey installed 0/1 package(s). 0 package(s) failed.
1 package(s) had warnings.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Warnings:
- visualstudio2013ultimate
The programs do not show up on disk, nor start menu. The log file is as follows:
2015-09-23 18:22:13,475 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" install -y visualstudio2013ultimate
2015-09-23 18:22:13,475 [DEBUG] - Received arguments: install -y visualstudio2013ultimate
2015-09-23 18:22:13,553 [DEBUG] -
NOTE: Hiding sensitive configuration data! Please double and triple
check to be sure no sensitive data is shown, especially if copying
output to a gist for review.
2015-09-23 18:22:13,569 [DEBUG] - Configuration: CommandName='install'|
CacheLocation='C:\Users\ADMINI~1\AppData\Local\Temp'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|
Sources='https://chocolatey.org/api/v2/'|Debug='False'|Verbose='False'|
Force='False'|Noop='False'|HelpRequested='False'|RegularOutput='True'|
PromptForConfirmation='False'|AcceptLicense='True'|
AllowUnofficialBuild='False'|Input='visualstudio2013ultimate'|
AllVersions='False'|SkipPackageInstallProvider='False'|
PackageNames='visualstudio2013ultimate'|Prerelease='False'|
ForceX86='False'|OverrideArguments='False'|NotSilent='False'|
IgnoreDependencies='False'|AllowMultipleVersions='False'|
ForceDependencies='False'|Information.PlatformType='Windows'|
Information.PlatformVersion='6.3.9600.0'|
Information.PlatformName='Windows Server 2012 R2'|
Information.ChocolateyVersion='0.9.9.8'|
Information.ChocolateyProductVersion='0.9.9.8'|
Information.FullName='choco, Version=0.9.9.8, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|
Information.Is64Bit='True'|Information.IsInteractive='False'|
Information.IsUserAdministrator='True'|
Information.IsProcessElevated='True'|Features.AutoUninstaller='False'|
Features.CheckSumFiles='True'|Features.FailOnAutoUninstaller='False'|
ListCommand.LocalOnly='False'|
ListCommand.IncludeRegistryPrograms='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
NewCommand.AutomaticPackage='False'|SourceCommand.Command='unknown'|
FeatureCommand.Command='unknown'|PushCommand.TimeoutInSeconds='0'|
PinCommand.Command='unknown'|
2015-09-23 18:22:13,585 [DEBUG] - _ Chocolatey:ChocolateyInstallCommand - Normal Run Mode _
2015-09-23 18:22:13,585 [INFO ] - Installing the following packages:
2015-09-23 18:22:13,585 [INFO ] - visualstudio2013ultimate
2015-09-23 18:22:13,585 [INFO ] - By installing you accept licenses for the packages.
2015-09-23 18:22:17,538 [INFO ] -
DotNet4.5.1 v4.5.1.20140606
2015-09-23 18:22:17,585 [DEBUG] - Contents of 'C:\ProgramData\chocolatey\lib\DotNet4.5.1\Tools\ChocolateyInstall.ps1':
2015-09-23 18:22:17,600 [DEBUG] - if(-not (test-path "hklm:\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SKUs\.NETFramework,Version=v4.5.1")) {
Install-ChocolateyPackage 'dotnet451' 'exe' "/Passive /NoRestart /Log $env:temp\net451.log" 'http://download.microsoft.com/download/7/4/0/74078A56-A3A1-492D-BBA9-865684B83C1B/NDP451-KB2859818-Web.exe' -validExitCodes @(0,3010)
}
else {
Write-Host "Microsoft .Net 4.5.1 Framework is already installed on your machine."
}
2015-09-23 18:22:17,616 [DEBUG] - Calling command ['"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -NoLogo -ExecutionPolicy Bypass -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey\lib\DotNet4.5.1\Tools\ChocolateyInstall.ps1' -installArguments '' -packageParameters ''"']
2015-09-23 18:22:18,491 [INFO ] - Microsoft .Net 4.5.1 Framework is already installed on your machine.
2015-09-23 18:22:18,522 [DEBUG] - Command ['"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -NoLogo -ExecutionPolicy Bypass -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey\lib\DotNet4.5.1\Tools\ChocolateyInstall.ps1' -installArguments '' -packageParameters ''"'] exited with '0'
2015-09-23 18:22:18,522 [DEBUG] - Calling command ['"shutdown" /a']
2015-09-23 18:22:18,569 [DEBUG] - Command ['"shutdown" /a'] exited with '1116'
2015-09-23 18:22:18,585 [DEBUG] - Capturing package files in 'C:\ProgramData\chocolatey\lib\DotNet4.5.1'
2015-09-23 18:22:18,585 [DEBUG] - Found 'C:\ProgramData\chocolatey\lib\DotNet4.5.1\dotnet.png'
with checksum '0D5A15B93F47DF7F91B24A14C7CE91FE'
2015-09-23 18:22:18,585 [DEBUG] - Found 'C:\ProgramData\chocolatey\lib\DotNet4.5.1\DotNet4.5.1.nupkg'
with checksum '644E236231ADA16E07DA6C9B9612F508'
2015-09-23 18:22:18,585 [DEBUG] - Found 'C:\ProgramData\chocolatey\lib\DotNet4.5.1\Tools\ChocolateyInstall.ps1'
with checksum '805DDE099F331DF8A4F0D47BE8D47E7C'
2015-09-23 18:22:18,600 [DEBUG] - Attempting to create directory "C:\ProgramData\chocolatey\extensions".
2015-09-23 18:22:18,600 [DEBUG] - Attempting to create directory "C:\ProgramData\chocolatey\.chocolatey".
2015-09-23 18:22:18,616 [DEBUG] - Attempting to create directory "C:\ProgramData\chocolatey\.chocolatey\DotNet4.5.1.4.5.1.20140606".
2015-09-23 18:22:18,631 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\.chocolatey\DotNet4.5.1.4.5.1.20140606\.sxs".
2015-09-23 18:22:18,631 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\.chocolatey\DotNet4.5.1.4.5.1.20140606\.pin".
2015-09-23 18:22:18,631 [INFO ] - The install of dotnet4.5.1 was successful.
2015-09-23 18:22:18,631 [INFO ] -
VisualStudio2013Ultimate v12.0.21005.20141031
2015-09-23 18:22:18,631 [DEBUG] - Contents of 'C:\ProgramData\chocolatey\lib\VisualStudio2013Ultimate\Tools\ChocolateyInstall.ps1':
2015-09-23 18:22:18,631 [DEBUG] - . (Join-Path $(Split-Path -parent $MyInvocation.MyCommand.Definition) 'common.ps1')
$adminFile = (Join-Path $(Split-Path -parent $MyInvocation.MyCommand.Definition) 'AdminDeployment.xml')
$customArgs = $env:chocolateyInstallArguments
$env:chocolateyInstallArguments=""
$settings = Initialize-VS-Settings $customArgs $adminFile
$installerArgs = Get-VS-Installer-Args $settings.ProductKey
Install-ChocolateyPackage 'VisualStudio2013Ultimate' 'exe' $installerArgs 'http://download.microsoft.com/download/C/F/B/CFBB5FF1-0B27-42E0-8141-E4D6DA0B8B13/vs_ultimate_download.exe'
2015-09-23 18:22:18,631 [DEBUG] - Calling command ['"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -NoLogo -ExecutionPolicy Bypass -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey\lib\VisualStudio2013Ultimate\Tools\ChocolateyInstall.ps1' -installArguments '' -packageParameters ''"']
2015-09-23 18:22:19,928 [INFO ] - Downloading VisualStudio2013Ultimate 32 bit
2015-09-23 18:22:19,944 [INFO ] - from 'http://download.microsoft.com/download/C/F/B/CFBB5FF1-0B27-42E0-8141-E4D6DA0B8B13/vs_ultimate_download.exe'
2015-09-23 18:22:22,428 [INFO ] - Installing VisualStudio2013Ultimate...
2015-09-23 18:22:29,038 [INFO ] - VisualStudio2013Ultimate has been installed.
2015-09-23 18:22:29,053 [DEBUG] - Command ['"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -NoLogo -ExecutionPolicy Bypass -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey\lib\VisualStudio2013Ultimate\Tools\ChocolateyInstall.ps1' -installArguments '' -packageParameters ''"'] exited with '0'
2015-09-23 18:22:29,053 [DEBUG] - Calling command ['"shutdown" /a']
2015-09-23 18:22:29,085 [DEBUG] - Command ['"shutdown" /a'] exited with '1116'
2015-09-23 18:22:29,100 [DEBUG] - Capturing package files in 'C:\ProgramData\chocolatey\lib\VisualStudio2013Ultimate'
2015-09-23 18:22:29,100 [DEBUG] - Found 'C:\ProgramData\chocolatey\lib\VisualStudio2013Ultimate\VisualStudio2013Ultimate.nupkg'
with checksum '307AA81594B864085363287C08054360'
2015-09-23 18:22:29,100 [DEBUG] - Found 'C:\ProgramData\chocolatey\lib\VisualStudio2013Ultimate\Tools\AdminDeployment.xml'
with checksum '01F61D4825533688114F2225072F92E4'
2015-09-23 18:22:29,100 [DEBUG] - Found 'C:\ProgramData\chocolatey\lib\VisualStudio2013Ultimate\Tools\ChocolateyInstall.ps1'
with checksum '557ED94554A30A376F8C4580ADA76041'
2015-09-23 18:22:29,100 [DEBUG] - Found 'C:\ProgramData\chocolatey\lib\VisualStudio2013Ultimate\Tools\ChocolateyUninstall.ps1'
with checksum 'F1A1396EC8B29639871B06C1360ACC3D'
2015-09-23 18:22:29,100 [DEBUG] - Found 'C:\ProgramData\chocolatey\lib\VisualStudio2013Ultimate\Tools\common.ps1'
with checksum 'CAD2FE3515E9D169FA58CD3ECC49A900'
2015-09-23 18:22:29,100 [DEBUG] - Attempting to create directory "C:\ProgramData\chocolatey\.chocolatey\VisualStudio2013Ultimate.12.0.21005.20141031".
2015-09-23 18:22:29,100 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\.chocolatey\VisualStudio2013Ultimate.12.0.21005.20141031\.sxs".
2015-09-23 18:22:29,100 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\.chocolatey\VisualStudio2013Ultimate.12.0.21005.20141031\.pin".
2015-09-23 18:22:29,100 [INFO ] - The install of visualstudio2013ultimate was successful.
If I manually run choco install --force visualstudio2013ultimate
after all of this, it will install just fine.
Any suggestions?
Windows server 2012R2 with .NET 4.5.2 installed (manually) build from an AWS AMI
It seems I cannot use chocolatey to install packages in the same Chef run as I install chocolatey. When bootstrapping a new machine and installing chocolatey via the default recipe, the 'choco' isn't recognized yet. This seems like something you should be able to do but I don't know what the best way to achieve it is.
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of choco list --localonly ----
STDOUT:
STDERR: 'choco' is not recognized as an internal or external command,
operable program or batch file.
---- End output of choco list --localonly ----
Ran choco list --localonly returned 1
We run an internal chocolatey feed via ProGet, and would like all packages to be installed from that feedback. Is this supported at this time?
I'm trying to use the version attribute and am hitting a bug that was fixed in v0.1.1. However because I rely on Berkshelf to get the cookbook for me, it gets the latest on the supermarket which is 0.1.0 and then bombs when running my recipe.
Would it be possible to alias the args parameter so that it also takes the same name as choco ("params")?
When using the chocolatey cookbook, I get this message:
WARN: Please use the powershell_script resource in Chef Client 11.6+
I assume this is because of the depends 'powershell'
in "metadata.rb".
There is a v0.4.0 of this cookbook available on Chef SuperMarket:
https://supermarket.chef.io/cookbooks/chocolatey
However, there is no v0.4.0 listed for this repo.
I would like to be able to check specific resources that a package has installed - say it's COM registration keys - and if they are missing, then re-run the relevant chocolatey package.
I tried passing -force like this:
options ({'u' => 'user', 'p' => 'password', 'force' => ''})
But if I am understanding the provider code correctly the provider is doing it's own package existence check and so does not start chocolatey if the package is present.
Could -force be supported or allow chocolatey to do the check for whether a package is installed?
Also - if anyone has work around code that simply executes chocolatey, that would be helpful for the meantime.
When I run chef-client to install msysgit using the chocolatey resource, I get this error (cmd.run_command, then Chef::Log.info cmd.stderr):
C:\Chocolatey\chocolateyinstall\chocolatey.ps1 : Missing an argument for parameter 'source'. Specify a parameter of type 'System.String' and try again.
At line:1 char:212 [System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';&'C:\Chocolatey\chocolateyinstall\chocolatey.ps1' version msysgit -localonly -source + CategoryInfo : InvalidArgument: (:) [chocolatey.ps1], Parameter BindingException
As a result, cmd.stdout is null and package_installed? always results in "true". msysgit never gets installed.
I "fixed" it by changing
output += " -source #{@current_resource.source}" if @current_resource
to
output += " -source #{@current_resource.source}" if @current_resource.source
But I'm not sure if that's what you intended.
If you depend on the chocolatey cookbook, your cookbook will break when chocolatey.org is down.
Recipe: chocolatey::default
* remote_file[c:\chef\local-mode-cache\cache/install.ps1] action create[2016-03-03T13:44:14-05:00] WARN: remote_file[c:\chef\local-mode-cache\cache/install.ps1] cannot be downloaded from https://chocolatey.org/install.ps1: 503 "Service Unavailable"
================================================================================
Error executing action `create` on resource 'remote_file[c:\chef\local-mode-cache\cache/install.ps1]'
================================================================================
Net::HTTPFatalError
-------------------
503 "Service Unavailable"
Resource Declaration:
---------------------
# In c:/chef/local-mode-cache/cache/cookbooks/chocolatey/recipes/default.rb
29: remote_file install_ps1 do
30: source node['chocolatey']['url']
31: backup false
32: notifies :run, 'powershell_script[Install Chocolatey]', :immediately
33: not_if { chocolatey_installed? && (node['chocolatey']['upgrade'] == false) }
34: end
35:
Compiled Resource:
------------------
# Declared in c:/chef/local-mode-cache/cache/cookbooks/chocolatey/recipes/default.rb:29:in `from_file'
remote_file("c:\chef\local-mode-cache\cache/install.ps1") do
provider Chef::Provider::RemoteFile
action [:create]
retries 0
retry_delay 2
default_guard_interpreter :default
source ["https://chocolatey.org/install.ps1"]
use_etag true
use_last_modified true
declared_type :remote_file
cookbook_name "chocolatey"
recipe_name "default"
is_chocolatey_installed true
atomic_update true
path "c:\\chef\\local-mode-cache\\cache/install.ps1"
not_if { #code block }
end
Don't try and download the install.ps1 script every time chef runs.
Document that users should mirror their own version of install.ps1 in an artifact repository.
Persuade chocolatey.org owners to put this file on an externally hosted mirror. (The remote_file resource will take an array of locations, and attempt to download from them in order)
source 'http://seapower/spring.png', 'http://seapower/has_sprung.png'
Using version 0.6.1, I attempted to install jre8 as well as jruby with the following:
include_recipe 'chocolatey'
chocolatey 'jre8'
chocolatey 'jruby'
But this fails with the following log output:
STDOUT: Installing the following packages:
jruby
By installing you accept licenses for the packages.
jruby v9.0.4.0
Downloading jruby 64 bit
from 'http://jruby.org.s3.amazonaws.com/downloads/9.0.4.0/jruby_windows_x64_9_0_4_0.exe'
Installing jruby...
no jre found
[ERROR] Running C:\Windows\TEMP\chocolatey\jruby\9.0.4.0\jrubyInstall.exe with
-q was not successful. Exit code was '83' Error Message:
.
At C:\ProgramData\chocolatey\helpers\functions\Start-ChocolateyProcessAsAdmin.p
s1:92 char:5
+ throw $errorMessage
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: ([ERROR] Running...or Message:
.:String) [], RuntimeException
+ FullyQualifiedErrorId : [ERROR] Running C:\Windows\TEMP\chocolatey\jruby
\9.0.4.0\jrubyInstall.exe with -q was not successful. Exit code was '83'
Error Message:
.
The install of jruby was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\jruby\tools\chocolateyInstall.ps1'.
See log for details.
Chocolatey installed 0/1 package(s). 1 package(s) failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures:
- jruby
STDERR:
---- End output of "C:\ProgramData\chocolatey/bin/choco" install -y jruby ----
Ran "C:\ProgramData\chocolatey/bin/choco" install -y jruby returned 1
Upon inspection on the remote Windows Server 2012 R2 machine, I can see that the Path
and JAVA_HOME
env variables are being set correctly with a path like C:\Program Files\Java\jre1.8.0_66\bin;
. But oddly enough, that path doesn't even exist on the filesystem. There's no "Java" directory anywhere to be found!
RDPing into the machine and running choco install jre8 --force
manually on Powershell seems to resolve things for me.
I should also note that the Chocolatey::Helpers
module runs into an undefined method error for powershell_out!
. I added a hotfix on my end by manually including the Chef::Mixin::PowershellOut
module which seems to fix it.
Recipe: chocolatey::default
================================================================================
Error executing action `run` on resource 'powershell_script[install chocolatey]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20150520-1280-1e8f9ki.ps1" ----
STDOUT: Downloading https://chocolatey.org/api/v2/package/chocolatey/ to C:\Users\vagrant\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip
Download 7Zip commandline tool
Downloading https://chocolatey.org/7za.exe to C:\Users\vagrant\AppData\Local\Temp\chocolatey\chocInstall\7za.exe
Extracting C:\Users\vagrant\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\vagrant\AppData\Local\Temp\chocolatey\chocInstall...
7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Processing archive: C:\Users\vagrant\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip
Extracting _rels\.rels
Extracting chocolatey.nuspec
Extracting tools\chocolateyInstall.ps1
Extracting tools\chocolateysetup.psm1
Extracting tools\init.ps1
Extracting tools\chocolateyInstall\choco.exe
Extracting tools\chocolateyInstall\choco.exe.ignore
Extracting package\services\metadata\core-properties\61804721eec44e8592a61904d0a62022.psmdcp
Extracting [Content_Types].xml
Everything is Ok
Files: 9
Size: 3738621
Compressed: 1259522
Installing chocolatey on this machine
Downloading 'http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe' to 'C:\Users\vagrant\AppData\Local\Temp\dotNetFx40_Full_x86_x64.exe' - the installer is 40+ MBs, so this could take awhile on a slow connection.
Installing 'C:\Users\vagrant\AppData\Local\Temp\dotNetFx40_Full_x86_x64.exe' - this may take awhile with no output.
WARNING: First try of .NET framework install failed with exit code '16389'.
Trying again.
Installing 'C:\Users\vagrant\AppData\Local\Temp\dotNetFx40_Full_x86_x64.exe' - this may take awhile with no output.
STDERR: .NET Framework install failed with exit code '16389'.
This will cause the rest of the install to fail.Error installing .NET Framework 4.0 (exit code 16389).
Please install the .NET Framework 4.0 manually and then try to install Chocolatey again.
Download at 'http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe'
---- End output of "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20150520-1280-1e8f9ki.ps1" ----
Ran "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20150520-1280-1e8f9ki.ps1" returned 1
Resource Declaration:
---------------------
# In C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/chocolatey/recipes/default.rb
27: powershell_script 'install chocolatey' do
28: code "iex ((new-object net.webclient).DownloadString('#{node['chocolatey']['Uri']}'))"
29: convert_boolean_return true
30: not_if { ChocolateyHelpers.chocolatey_installed? }
31: end
32:
Compiled Resource:
------------------
# Declared in C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/chocolatey/recipes/default.rb:27:in `from_file'
powershell_script("install chocolatey") do
action "run"
retries 0
retry_delay 2
default_guard_interpreter :powershell_script
command "install chocolatey"
backup 5
returns 0
code "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
interpreter "powershell.exe"
convert_boolean_return true
declared_type :powershell_script
cookbook_name "chocolatey"
recipe_name "default"
not_if { #code block }
end
Running handlers:
[2015-05-20T12:08:36-07:00] ERROR: Running exception handlers
Running handlers complete
[2015-05-20T12:08:36-07:00] ERROR: Exception handlers complete
[2015-05-20T12:08:36-07:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
Chef Client failed. 0 resources updated in 80.3125 seconds
[2015-05-20T12:08:36-07:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: powershell_script[install chocolatey] (chocolatey::default line 27) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20150520-1280-1e8f9ki.ps1" ----
STDOUT: Downloading https://chocolatey.org/api/v2/package/chocolatey/ to C:\Users\vagrant\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip
Download 7Zip commandline tool
Downloading https://chocolatey.org/7za.exe to C:\Users\vagrant\AppData\Local\Temp\chocolatey\chocInstall\7za.exe
Extracting C:\Users\vagrant\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\vagrant\AppData\Local\Temp\chocolatey\chocInstall...
7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
Processing archive: C:\Users\vagrant\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip
Extracting _rels\.rels
Extracting chocolatey.nuspec
Extracting tools\chocolateyInstall.ps1
Extracting tools\chocolateysetup.psm1
Extracting tools\init.ps1
Extracting tools\chocolateyInstall\choco.exe
Extracting tools\chocolateyInstall\choco.exe.ignore
Extracting package\services\metadata\core-properties\61804721eec44e8592a61904d0a62022.psmdcp
Extracting [Content_Types].xml
Everything is Ok
Files: 9
Size: 3738621
Compressed: 1259522
Installing chocolatey on this machine
Downloading 'http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe' to 'C:\Users\vagrant\AppData\Local\Temp\dotNetFx40_Full_x86_x64.exe' - the installer is 40+ MBs, so this could take awhile on a slow connection.
Installing 'C:\Users\vagrant\AppData\Local\Temp\dotNetFx40_Full_x86_x64.exe' - this may take awhile with no output.
WARNING: First try of .NET framework install failed with exit code '16389'.
Trying again.
Installing 'C:\Users\vagrant\AppData\Local\Temp\dotNetFx40_Full_x86_x64.exe' - this may take awhile with no output.
STDERR: .NET Framework install failed with exit code '16389'.
This will cause the rest of the install to fail.Error installing .NET Framework 4.0 (exit code 16389).
Please install the .NET Framework 4.0 manually and then try to install Chocolatey again.
Download at 'http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe'
---- End output of "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20150520-1280-1e8f9ki.ps1" ----
Ran "powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -InputFormat None -File "C:/Users/vagrant/AppData/Local/Temp/chef-script20150520-1280-1e8f9ki.ps1" returned 1
>>>>>> Converge failed on instance <default-windows-2008r2-standard>.
>>>>>> Please see .kitchen/logs/default-windows-2008r2-standard.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: WinRM exited (1) for command: [
$env:PATH = [System.Environment]::GetEnvironmentVariable("PATH","Machine")
& $env:systemdrive\opscode\chef\bin\chef-client.bat --local-mode --config $env:TEMP\kitchen\client.rb --log_level auto --force-formatter --no-color --json-attributes $env:TEMP\kitchen\dna.json --chef-zero-port 8889]
Unsure of where to go with this one but neither this repo or the chocolatey repo have an issue that matches this exit code, open or closed.
@ferventcoder Can you activate travis on this repository please?
.travis.yml is already present.
I tried the zabbix cookbook on Windows and it failed as cinst.bat fails due to .NET 4.5 not being available.
I worked around this by first installing the dotnetframework cookbook.
chocolatey recipe does not handle cinst.bat failing due to a bug with cinst.bat. See chocolatey-archive/chocolatey#343 which documents cinst.bat returning 0 even under a failure condition.
Could we get some Chefspec matchers added to this cookbook. I am using the chocolatey resource in a recipe and would like to use ChefSpec to do unit testing. I can do a PR to add it if that would help.
I'm trying to update ghostdriver cookbook that depends on phantomjs that depends on chocolatey for windows. I use mixlib in my cookbook and can't for the life of me figure out how to get around these types of errors below in chefspec. Is there chefspec examples out there that use chocolatey cookbook? I have mocked out the mixlib, but that doesn't seem to work.
e.g.,
# let(:shellout) do
# double(run_command: nil, error!: nil, error?: false, stdout: '1',
# stderr: double(empty?: true), exitstatus: 0,
# :live_stream= => double)
# end
#
# before do
# stub_command('netsh advfirewall firewall show rule name="ghostdriver_standalone" > nul')
# allow(Mixlib::ShellOut).to receive(:new).and_return(shellout)
# allow_any_instance_of(Mixlib::ShellOut).to receive(:new).and_return(shellout)
# end
#
# include Chef::Mixin::PowershellOut
Failure/Error:
ChefSpec::SoloRunner.new(
platform: 'windows', version: '2008R2', step_into: ['ghostdriver']
).converge(described_recipe)
ghostdriver[ghostdriver_standalone] (ghostdriver_test::standalone line 1) had an error: RSpec::Mocks::MockExpectationError: #<Double (anonymous)> received unexpected message :live_stream with (no args)
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/mixin/shell_out.rb:85:in `shell_out_command'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/mixin/shell_out.rb:39:in `shell_out'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/mixin/powershell_out.rb:67:in `block in run_command_with_os_architecture'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/mixin/windows_architecture_helper.rb:67:in `with_os_architecture'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/mixin/powershell_out.rb:66:in `run_command_with_os_architecture'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/mixin/powershell_out.rb:37:in `powershell_out'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/mixin/powershell_out.rb:47:in `powershell_out!'
# /var/folders/kl/1m4f0gbd62b7wgqb1tt6cg180000gn/T/d20160826-51637-qmes3r/cookbooks/chocolatey/libraries/helpers.rb:49:in `env_var'
# /var/folders/kl/1m4f0gbd62b7wgqb1tt6cg180000gn/T/d20160826-51637-qmes3r/cookbooks/chocolatey/libraries/helpers.rb:45:in `machine_env_var'
# /var/folders/kl/1m4f0gbd62b7wgqb1tt6cg180000gn/T/d20160826-51637-qmes3r/cookbooks/chocolatey/libraries/helpers.rb:9:in `block in chocolatey_install'
# /var/folders/kl/1m4f0gbd62b7wgqb1tt6cg180000gn/T/d20160826-51637-qmes3r/cookbooks/chocolatey/libraries/helpers.rb:9:in `fetch'
# /var/folders/kl/1m4f0gbd62b7wgqb1tt6cg180000gn/T/d20160826-51637-qmes3r/cookbooks/chocolatey/libraries/helpers.rb:9:in `chocolatey_install'
# /var/folders/kl/1m4f0gbd62b7wgqb1tt6cg180000gn/T/d20160826-51637-qmes3r/cookbooks/chocolatey/libraries/helpers.rb:26:in `chocolatey_installed?'
# /var/folders/kl/1m4f0gbd62b7wgqb1tt6cg180000gn/T/d20160826-51637-qmes3r/cookbooks/chocolatey/recipes/default.rb:40:in `block (2 levels) in from_file'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource/conditional.rb:106:in `evaluate_block'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource/conditional.rb:95:in `evaluate'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource/conditional.rb:88:in `continue?'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource.rb:1507:in `block in should_skip?'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource.rb:1506:in `each'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource.rb:1506:in `find'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource.rb:1506:in `should_skip?'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chefspec-5.0.0/lib/chefspec/extensions/chef/resource.rb:19:in `run_action'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/runner.rb:69:in `run_action'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/runner.rb:97:in `block (2 levels) in converge'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/runner.rb:97:in `each'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/runner.rb:97:in `block in converge'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/runner.rb:96:in `converge'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/provider.rb:417:in `block in recipe_eval'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/mixin/why_run.rb:52:in `add_action'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/provider.rb:176:in `converge_by'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/provider.rb:412:in `recipe_eval'
# /var/folders/kl/1m4f0gbd62b7wgqb1tt6cg180000gn/T/d20160826-51637-qmes3r/cookbooks/ghostdriver/providers/default.rb:25:in `block in class_from_file'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/provider.rb:145:in `run_action'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource.rb:603:in `run_action'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chefspec-5.0.0/lib/chefspec/extensions/chef/resource.rb:22:in `run_action'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/runner.rb:69:in `run_action'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/runner.rb:97:in `block (2 levels) in converge'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/runner.rb:97:in `each'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/runner.rb:97:in `block in converge'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource_collection/resource_list.rb:94:in `block in execute_each_resource'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/resource_collection/resource_list.rb:92:in `execute_each_resource'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/runner.rb:96:in `converge'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/client.rb:669:in `block in converge'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/client.rb:664:in `catch'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/client.rb:664:in `converge'
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chefspec-5.0.0/lib/chefspec/solo_runner.rb:127:in `converge'
# ./spec/unit/standalone_spec.rb:8:in `block (3 levels) in <top (required)>'
# ./spec/unit/standalone_spec.rb:51:in `block (3 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# #<Double (anonymous)> received unexpected message :live_stream with (no args)
# /Users/hoerde/.rvm/gems/ruby-2.3.0/gems/chef-12.13.37/lib/chef/mixin/shell_out.rb:85:in `shell_out_command'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.