vendredi 10 avril 2015

Chef-Client tries to install Java on Windows but it is already installed

I'm new to Chef and want to install Java on a windows machine with it.


There is a ready-to-use Java cookbook I'm using.


So I wrote a wrapper cookbook, as mentioned in another question here.


I added the java-cookbook-dependencies and used the following attributes at


attribute/java.rb



normal['java']['jdk_version'] = '7'
normal['java']['install_flavor'] = 'windows'
normal['java']['windows']['url'] = 'http://myurl/java/jdk-7u75-windows-x64.exe'


So after uploading the cookbook and adding it into the runlist Java gets installed and is available. But whenever I run the chef-client, it tries to install the JDK from the file again.


So my question:


Am I missing some configuration to check for an already installed version? For my understanding, this should be done in the given cookbook, but Im not sure if it is.


Here the (relevant) output after starting the chef client with knife:



WindowsPC [2015-04-10T14:38:06+02:00] INFO: Processing remote_file[c:/chef/cache/jdk-7u75-windows-x64.exe]action create (java::windows line 45)
WindowsPC [2015-04-10T14:38:08+02:00] INFO: Processing windows_package[OracleJDK7u75] action install (java::windows line 71)
WindowsPC [2015-04-10T14:38:09+02:00] INFO: Installing windows_package[OracleJDK7u75] version latest
WindowsPC [2015-04-10T14:38:09+02:00] INFO: Starting installation...this could take awhile.
WindowsPC
WindowsPC ================================================================================
WindowsPC Error executing action `install` on resource 'windows_package[OracleJDK7u75]'
WindowsPC ================================================================================
WindowsPC
WindowsPC Mixlib::ShellOut::ShellCommandFailed
WindowsPC ------------------------------------
WindowsPC Expected process to exit with [0, 42, 127], but received '1603'
WindowsPC ---- Begin output of start "" /wait "c:\chef\cache\jdk-7u75-windows-x64.exe" /s & exit %%ERRORLEVEL%% ----
WindowsPC STDOUT:
WindowsPC STDERR:
WindowsPC ---- End output of start "" /wait "c:\chef\cache\jdk-7u75-windows-x64.exe" /s & exit %%ERRORLEVEL%% ----
WindowsPC Ran start "" /wait "c:\chef\cache\jdk-7u75-windows-x64.exe" /s & exit %%ERRORLEVEL%% returned 1603
WindowsPC
WindowsPC Cookbook Trace:
WindowsPC ---------------
WindowsPC c:/chef/cache/cookbooks/windows/libraries/windows_package.rb:109:in `install_package'
WindowsPC c:/chef/cache/cookbooks/windows/libraries/windows_package.rb:31:in `block in <class:WindowsCookbookPackage>'
WindowsPC
WindowsPC Resource Declaration:
WindowsPC ---------------------
WindowsPC # In c:/chef/cache/cookbooks/java/recipes/windows.rb
WindowsPC
WindowsPC 71: windows_package node['java']['windows']['package_name'] do
WindowsPC 72: source cache_file_path
WindowsPC 73: checksum node['java']['windows']['checksum']
WindowsPC 74: action :install
WindowsPC 75: installer_type :custom
WindowsPC 76: options "/s #{additional_options}"
WindowsPC 77: end
WindowsPC
WindowsPC Compiled Resource:
WindowsPC ------------------
WindowsPC # Declared in c:/chef/cache/cookbooks/java/recipes/windows.rb:71:in `from_file'
WindowsPC
WindowsPC windows_cookbook_package("OracleJDK7u75") do
WindowsPC provider Chef::Provider::WindowsCookbookPackage
WindowsPC action [:install]
WindowsPC retries 0
WindowsPC retry_delay 2
WindowsPC default_guard_interpreter :default
WindowsPC declared_type :windows_package
WindowsPC cookbook_name "java"
WindowsPC recipe_name "windows"
WindowsPC source "c:/chef/cache/jdk-7u75-windows-x64.exe"
WindowsPC installer_type :custom
WindowsPC options "/s "
WindowsPC package_name "OracleJDK7u75"
WindowsPC timeout 600
WindowsPC success_codes [0, 42, 127]
WindowsPC end
WindowsPC
WindowsPC [2015-04-10T14:38:14+02:00] INFO: Running queued delayed notifications before re-raising exception
WindowsPC [2015-04-10T14:38:14+02:00] ERROR: Running exception handlers
WindowsPC [2015-04-10T14:38:14+02:00] ERROR: Exception handlers complete
WindowsPC [2015-04-10T14:38:14+02:00] FATAL: Stacktrace dumped to c:/chef/cache/chef-stacktrace.out
WindowsPC [2015-04-10T14:38:14+02:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: windows_package[OracleJDK7u75] (java::windows line 71) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0, 42, 127], but received '1603'
WindowsPC ---- Begin output of start "" /wait "c:\chef\cache\jdk-7u75-windows-x64.exe" /s & exit %%ERRORLEVEL%% ----
WindowsPC STDOUT:
WindowsPC STDERR:
WindowsPC ---- End output of start "" /wait "c:\chef\cache\jdk-7u75-windows-x64.exe" /s & exit %%ERRORLEVEL%% ----
WindowsPC Ran start "" /wait "c:\chef\cache\jdk-7u75-windows-x64.exe" /s & exit %%ERRORLEVEL%% returned 1603
ERROR: Failed to execute command on WindowsPC return code 1


Thank you in advance


Bohne


Aucun commentaire:

Enregistrer un commentaire