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
Conversation
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.
manifests/plugin/java.pp
Outdated
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": |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Thanks for the fix! |
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 removedfrom 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 tocreate 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.