Hi @Larryc
I am trying to verify the installation of java on chef-node. If it is not installed, then install it.
I am doing the same through two separate recipes.
The First recipe is verifying the java on chef node:
execute "Validate Java" do
command "java -version"
end
If the response of the first recipe is failed then another recipe will install it.
# Download Java_8 from a remote directory on the chef-client node
remote_file "#{Chef::Config['file_cache_path']}/jdk-8u181-windows-x64.exe" do
source "#{node['shared_resources']['java_8']['download_url']}"
remote_domain "#{node['shared_resources']['domain']}"
remote_user "#{node['shared_resources']['user_name']}"
remote_password "#{node['shared_resources']['password']}"
end
execute "Java_8" do
cwd "#{Chef::Config['file_cache_path']}"
command "jdk-8u181-windows-x64.exe"
end
but I want to do the same (verify and installation of java) in one recipe. I don't know how to handle the error response within the recipe if java is not installed.
Thanks
Deepak