-
-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot upgrade java version #649
Comments
@brailsmt I'm having a hard time getting this to work on my end. Can you provide some exact code that can replicate this problem? |
I would venture to guess this is the same problem as #599 |
#599 seems focused on the permissions of the directory. This issue is unrelated to permissions issues. It stems from the fact that the cookbook checks for the existence of In the above scenario, I could recreate the issue following these steps:
Where the java recipe just contains: adoptopenjdk_install '8' do
variant adoptopenjdk
url 'https://github.com/AdoptOpenJDK/openjdk8-upstream-binaries/releases/download/jdk8u272-b10/OpenJDK8U-jdk_x64_linux_8u272b10.tar.gz'
checksum '654a0b082be0c6830821f22a9e1de5f9e2feb9705db79e3bb0d8c203d1b12c6a'
end EDIT: I apologize if there are errors in how to recreate the issue, I will work up a complete example this afternoon or this evening when I have time to more properly test it, instead of trying to recreate it from memory as I did here. |
I think I am hitting this too. Recently upgraded our wrapper from using UPDATE:
Directory contents:
|
@bkonick We worked around this issue by modifying jdk_install_base_dir = "/usr/lib/jvm/java-#{java_version}-#{java_flavor}-#{java_variant}"
jdk_install_dir = File.join(jdk_install_base_dir, jdk_version, jdk_version)
node.default['java']['java_home'] = jdk_install_dir This awkwardly doubles up the version in the directory like this |
I am going to do some local testing today to see how the overwrite property behaves. I think in this case the JDK is always unpacked to a subdirectory, so I am hoping that it doesn't actually clear out the directory, but just permits it to have contents extracted to it. |
Interestingly, the overwrite property causes the extract to happen during every run which breaks |
This is a limitation of the |
@brailsmt do you have a more specific example of how you are implementing this workaround? I was trying to re-create it in our wrapper but was having some issues. What is |
For me I added the following to the archive_file for tarball with adoptopenjdk. This would make it extract contents. overwrite true
not_if { ::Dir.exist?(new_resource.java_home) } This stops it from extract again if the java_home exists. It was skipping if the partial path was there. I added the not_if for archive_file as well to keep it from downloading since I don't backup the file. |
@bkonick The |
Instead of overwriting and possibly halting running programs we probably need to place AdoptOpenJDK in sub-folders and have alternatives take care of it for us. That way if files are removed during a new patch they're not left behind. |
🗣️ Foreword
While working with the latest version of the java cookbook and chef 16, we are unable to upgrade to a later java version. We often need to uplift to a newer java version due to security and bug fixes. We are not yet running in a containerized environment so we need the ability to upgrade java versions even if previous versions were installed. We are also unable to safely remove all old installations of java prior to upgrading.
👻 Brief Description
If java has already been installed on the node in question, then subsequent runs of the sous-chef/java recipe will silently fail to upgrade the java version. We have created a thin wrapper around the java resource to install java. The recipe is essentially this (actual values changed, obviously):
If we run
chef-client -o "recipe[company_java]"
, the chef-client run succeeds. If we then override the config and install a new version of java, it fails to upgrade the java version, but the cookbook still succeeds.🥞 Cookbook version
We are experiencing this with 8.4.0.
👩🍳 Chef-Infra Version
16.6.14
🎩 Platform details
Oracle Linux 7.9
Steps To Reproduce
Steps to reproduce the behavior:
/usr/lib/jvm/java-8-adoptopenjdk-hotspot will contain the jdk8u272-b10 directory, and there will not be a jdk8u275-b01 directory.
🚓 Expected behavior
The expected behavior is that version of java that was installed in step 2 would be the java version installed and linked through /etc/alternatives.
➕ Additional context
Here is a snippet from a chef-client run that was intended to install jdk8u232-b09:
Instead of the application being run with jdk8u232-b09, it was running with the version of java that was previously installed which happened to be jdk8u265-b01. While the version that was previously installed was newer is beside the point and is due to a separate issue in our own cookbooks.
The text was updated successfully, but these errors were encountered: