Closed pjohnson-ptc closed 4 years ago
We ran into the same issue, it's because of this
options "/s INSTALLDIR=\"\""
INSTALLDIR is being set to nil value by the cookbook.
The default recipe is calling set_attributes_from_version recipe and the set_attributes_from_version recipe is setting the java_home to nil
https://github.com/agileorbit-cookbooks/java/blob/master/recipes/set_attributes_from_version.rb#L51
If your cookbook is a wrapper cookboook, you can override the java_home attribute in your cookbook
force_default['java']['java_home'] = 'C:/java'
@sckuchi - I sincerely appreciate your reply. Yes, we were running it through a wrapper, i'll try and update our wrapper to set the java_home. Much appreciated.
I will update and close the case or respond after attempting.
Even after setting the following (in the cookbook attributes):
force_default['java']['java_home'] = 'C:/Program Files/Java/jdk1.8.0_131'
================================================================================
Error executing action `install` on resource 'windows_package[Java SE Development Kit 8 Update 131 (64-bit)]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0, 42, 127], but received '-80'
---- Begin output of start "" /wait "c:\users\administrator\chef-repo-phil\.chef\local-mode-cache\cache\jdk-1.8.0_131-windows-x64.exe"
/s /v"/qn INSTALLDIR=\"C:\Program Files\Java\jdk1.8.0_131\"" & exit %%%%ERRORLEVEL%%%% ---- STDOUT: STDERR: ---- End output of start "" /wait "c:\users\administrator\chef-repo-phil.chef\local-mode-cache\cache\jdk-1.8.0_131-windows-x64.exe" / s /v"/qn INSTALLDIR=\"C:\Program Files\Java\jdk1.8.0_131\"" & exit %%%%ERRORLEVEL%%%% ---- Ran start "" /wait "c:\users\administrator\chef-repo-phil.chef\local-mode-cache\cache\jdk-1.8.0_131-windows-x64.exe" /s /v"/qn INSTALLDIR=\"C:\Program Files\Java\jdk1.8.0_131\"" & exit %%%%ERRORLEVEL%%%% returned -80
Resource Declaration:
---------------------
# In c:/users/administrator/chef-repo-phil/.chef/local-mode-cache/cache/cookbooks/java/recipes/windows.rb
101: windows_package node['java']['windows']['package_name'] do
102: source cache_file_path
103: checksum node['java']['windows']['checksum']
104: action :install
105: installer_type :custom
106: options "/s #{additional_options}"
107: notifies :write, 'log[jdk-version-changed]', :immediately
108: end
109:
Compiled Resource:
------------------
# Declared in c:/users/administrator/chef-repo-phil/.chef/local-mode-cache/cache/cookbooks/java/recipes/windows.rb:101:in `from_file'
windows_package("Java SE Development Kit 8 Update 131 (64-bit)") do
provider Chef::Provider::Package::Windows
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :windows_package
cookbook_name "java"
recipe_name "windows"
source "c:\\users\\administrator\\chef-repo-phil\\.chef\\local-mode-cache\\cache/jdk-1.8.0_131-windows-x64.exe"
installer_type :custom
options "/s /v\"/qn INSTALLDIR=\\\"C:\\Program Files\\Java\\jdk1.8.0_131\\\"\""
package_name "Java SE Development Kit 8 Update 131 (64-bit)"
success_codes [0, 42, 127]
end
System Info:
------------
chef_version=12.21.12
platform=windows
platform_version=6.3.9600
ruby=ruby 2.3.5p376 (2017-09-14 revision 59905) [x64-mingw32]
program_name=C:/opscode/chef/bin/chef-client
executable=C:/opscode/chef/bin/chef-client
[2017-10-06T09:28:13-07:00] INFO: Running queued delayed notifications before re-raising exception
I also tried it with force_default['java']['java_home'] = 'C:/Java/jdk1.8.0_131' (no spaces) and still end up with returned -80 error code.
@pjohnson-ptc The cookbook has jdk_version attribute set to 6 and the windows recipe is executing the else block on line 72 (https://github.com/agileorbit-cookbooks/java/blob/master/recipes/windows.rb#L72) The recipe is assuming that you are trying to install java 1.7.xx and is adding some additional flags for silent installer.
if node['java'].attribute?('java_home')
java_home_win = win_friendly_path(node['java']['java_home'])
additional_options = if node['java']['jdk_version'] == '8'
You can override the jdk_version attribute in your wrapper cookbook and it should fix your issue.
force_default['java']['java_home'] = '<path>'
default['java']['jdk_version'] = '8'
Closing due to inactivity.
If this is still an issue please reopen or open another issue. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help!
Thanks, Sous-Chefs
We receive:
Error executing action
install
on resource 'windows_package[jdk-1.8.0_131] ' Recipe: Java::Windows:Environment: { "tags": [], "java": { "jdk_version": "8", "install_flavor": "windows", "oracle": { "accept_oracle_download_terms": "true" }, "windows": { "url": "http://artifactory.xxxxxxxx.com/artifactory/pkgs-release-virtual/com/oracle/jdk/1.8.0_131/jdk-1.8.0_131-windows-x64.exe", "package_name": "jdk-1.8.0_131" } } }
Error:
==== Error executing action
install
on resource 'windows_package[jdk-1.8.0_131] '====
.exe" /s INSTALLDIR="" & exit %%%%ERRORLEVEL%%%% ---- STDOUT: STDERR: ---- End output of start "" /wait "c:\chef\cache\jdk-1.8.0_131-windows-x64.e xe" /s INSTALLDIR="" & exit %%%%ERRORLEVEL%%%% ---- Ran start "" /wait "c:\chef\cache\jdk-1.8.0_131-windows-x64.exe" /s INSTAL LDIR="" & exit %%%%ERRORLEVEL%%%% returned -80
ile'
[2017-09-22T13:45:00-07:00] INFO: Running queued delayed notifications before re -raising exception
Running handlers: [2017-09-22T13:45:00-07:00] ERROR: Running exception handlers Running handlers complete [2017-09-22T13:45:00-07:00] ERROR: Exception handlers complete Chef Client failed. 2 resources updated in 15 seconds [2017-09-22T13:45:00-07:00] INFO: Sending resource update report (run-id: 0af109 5e-09b9-46a8-9883-d3cd9351ab23) [2017-09-22T13:45:00-07:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stack trace.out [2017-09-22T13:45:00-07:00] FATAL: Please provide the contents of the stacktrace .out file if you file a bug report [2017-09-22T13:45:00-07:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: windows _package[jdk-1.8.0_131] (java::windows line 101) had an error: Mixlib::ShellOut: :ShellCommandFailed: Expected process to exit with [0], but received '-80' ---- Begin output of start "" /wait "c:\chef\cache\jdk-1.8.0_131-windows-x64.exe " /s INSTALLDIR="" & exit %%%%ERRORLEVEL%%%% ---- STDOUT: STDERR: ---- End output of start "" /wait "c:\chef\cache\jdk-1.8.0_131-windows-x64.exe" /s INSTALLDIR="" & exit %%%%ERRORLEVEL%%%% ----