Skip to content
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

plugin/java: handle OpenJDK as well #880

Merged
merged 8 commits into from Feb 8, 2020

Conversation

GiedriusS
Copy link
Contributor

collectd-java requires:

  • libjvm.so()(64bit)
  • libjvm.so(SUNWprivate_1.1)(64bit)

On CentOS/RHEL 6.x/7.x these are provided by OpenJDK. OpenJDK stores the
JVM files in a bit of a different location: amd64 has been removed
from the path. Thus, ATM the link does not get created properly on such
systems.

Fix this problem by adding two exec resources which both will try to
create the needed libjvm symbolic link. They are both smart and check if
that file exists before trying to execute. An assumption is added to the
code that both of the files cannot exist at the same time.

Giedrius Statkevičius added 2 commits May 29, 2019 17:29
collectd-java requires:
* `libjvm.so()(64bit)`
* `libjvm.so(SUNWprivate_1.1)(64bit)`

On CentOS/RHEL 6.x/7.x these are provided by OpenJDK. OpenJDK stores the
JVM files in a bit of a different location: `amd64` has been removed
from the path. Thus, ATM the link does not get created properly on such
systems.

Fix this problem by adding two `exec` resources which both will try to
create the needed libjvm symbolic link. They are both smart and check if
that file exists before trying to execute. An assumption is added to the
code that both of the files cannot exist at the same time.
ensure => 'link',
target => "${java_home}/jre/lib/amd64/server/libjvm.so",
# OpenJDK based Java distribution
exec { "/usr/bin/ln -s /usr/lib64/libjvm.so ${java_home}/jre/lib/server/libjvm.so":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you replace the file resource with an exec one? The file resource can handle symlinks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it can and I thought about it but how would you implement a conditional File resource which would create /usr/lib64/libjvm.so depending on certain conditions i.e. whether ${java_home}/jre/lib/server/libjvm.so exists or ${java_home/jre/lib/amd64/server/libjvm.so? Maybe I am missing something here but the File resource doesn't have an onlyif parameter and the only way AFAICT to do something like this is via an exec resource.

@bastelfreak bastelfreak added needs-work not ready to merge just yet tests-fail labels May 29, 2019
@bastelfreak bastelfreak added bug Something isn't working and removed needs-work not ready to merge just yet tests-fail labels Feb 8, 2020
@bastelfreak
Copy link
Member

Thanks for the fix!

@bastelfreak bastelfreak merged commit 4612c19 into voxpupuli:master Feb 8, 2020
@GiedriusS GiedriusS deleted the java_fix branch December 18, 2020 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants