Overriding dependencies

I am facing the following problem:

I have forked the opscode java cookbook, since I needed to add some features (pull request already submitted)
I created a wrapper cookbook around the java cookbook, which is called oracle-java, which manages the actual java installation.

Now I am trying to create a wrapper cookbook for tomcat, which just sets some meaningful defaults for my infrastructure when installing tomcat.

When installing tomcat via my tomcat-wrapper cookbook, I noticed that the tomcat cookbook fails, as the java keytool is not present where it is expected. Up on closer inspection, I noticed that the tomcat cookbook pulls in openjdk. I tried running the oracle-java cookbook before running the tomcat cookbook, but that didn’t change anything. It seems that the tomcat cookbook just overrides the previous oracle java installation.

I am using - or at least trying to use - Berkshelf to manage my dependencies.

How do I tell my tomcat wrapper cookbook to not use the java cookbook and use the already existing java installation? Or, even better, not use the java cookbook and use the oracle-java cookbook, which depends on my fork of the java cookbook?

Thanks,
Steve

Steve we do the same that you need. I am at home and I left my notebook at
office, tomorrow I can send you how we solved it. I can not send the
cookbook but I can send you how we run the recipes.
Eduardo
Sent my mobile phone.
Em 31/10/2013 20:47, "Steve Hummingbird" steve.hummingbird@yandex.com
escreveu:

I am facing the following problem:

I have forked the opscode java cookbook, since I needed to add some
features (pull request already submitted)
I created a wrapper cookbook around the java cookbook, which is called
oracle-java, which manages the actual java installation.

Now I am trying to create a wrapper cookbook for tomcat, which just sets
some meaningful defaults for my infrastructure when installing tomcat.

When installing tomcat via my tomcat-wrapper cookbook, I noticed that the
tomcat cookbook fails, as the java keytool is not present where it is
expected. Up on closer inspection, I noticed that the tomcat cookbook pulls
in openjdk. I tried running the oracle-java cookbook before running the
tomcat cookbook, but that didn't change anything. It seems that the tomcat
cookbook just overrides the previous oracle java installation.

I am using - or at least trying to use - Berkshelf to manage my
dependencies.

How do I tell my tomcat wrapper cookbook to not use the java cookbook and
use the already existing java installation? Or, even better, not use the
java cookbook and use the oracle-java cookbook, which depends on my fork of
the java cookbook?

Thanks,
Steve

On Thu, Oct 31, 2013 at 6:47 PM, Steve Hummingbird
steve.hummingbird@yandex.com wrote:

When installing tomcat via my tomcat-wrapper cookbook, I noticed that the tomcat cookbook fails, as the java keytool is not
present where it is expected. Up on closer inspection, I noticed that the tomcat cookbook pulls in openjdk. I tried running the
oracle-java cookbook before running the tomcat cookbook, but that didn't change anything. It seems that the tomcat cookbook
just overrides the previous oracle java installation.

I have seen this before on RHEL/CentOS (if you are not on one of these
platforms then ignore the following advice).

It is not really a Chef problem, but a RHEL problem in that the Tomcat
RPM pulls in OpenJDK, because that is what provides "java". You could
try installing Oracle Java via RPM if it also provides "java".

Alternately, you can leave OpenJDK on the system just to satisfy the
RPM depends and then update-alternatives right after Tomcat gets
installed. In fact you might even be able to notify :execute on
"bash[update-java-alternatives]" if you still have that in your
resource collection from the Java cookbook.

  • Julian

I am on Ubuntu. I just checked running my cookbooks, without the tomcat cookbook and issuing a manual apt-get install tomcat7 on the node. Seems like this pulls in openjdk as well :confused:
Oracle JDK is no longer available via packet managers. So that unfortunately is not an option.
Probably the best thing to do here is to use a different cookbook or fork the cookbook to directly download tomcat from the website and install it that way. SImilar to what the java cookbook is doing for oracle jdk.
It just seems kind of messy to me to install openjdk and then install oracle jdk as well, even though this seems to be the recommended way: Installing tomcat from repo with Java from Oracle - Ask Ubuntu

-Steve

On Nov 1, 2013, at 3:58 AM, Julian C. Dunn wrote:

On Thu, Oct 31, 2013 at 6:47 PM, Steve Hummingbird
steve.hummingbird@yandex.com wrote:

When installing tomcat via my tomcat-wrapper cookbook, I noticed that the tomcat cookbook fails, as the java keytool is not
present where it is expected. Up on closer inspection, I noticed that the tomcat cookbook pulls in openjdk. I tried running the
oracle-java cookbook before running the tomcat cookbook, but that didn't change anything. It seems that the tomcat cookbook
just overrides the previous oracle java installation.

I have seen this before on RHEL/CentOS (if you are not on one of these
platforms then ignore the following advice).

It is not really a Chef problem, but a RHEL problem in that the Tomcat
RPM pulls in OpenJDK, because that is what provides "java". You could
try installing Oracle Java via RPM if it also provides "java".

Alternately, you can leave OpenJDK on the system just to satisfy the
RPM depends and then update-alternatives right after Tomcat gets
installed. In fact you might even be able to notify :execute on
"bash[update-java-alternatives]" if you still have that in your
resource collection from the Java cookbook.

  • Julian

Yeah, that would be great.
Thanks,
-Steve

On Nov 1, 2013, at 1:58 AM, Eduardo Dias wrote:

Steve we do the same that you need. I am at home and I left my notebook at office, tomorrow I can send you how we solved it. I can not send the cookbook but I can send you how we run the recipes.
Eduardo
Sent my mobile phone.

Em 31/10/2013 20:47, "Steve Hummingbird" steve.hummingbird@yandex.com escreveu:
I am facing the following problem:

I have forked the opscode java cookbook, since I needed to add some features (pull request already submitted)
I created a wrapper cookbook around the java cookbook, which is called oracle-java, which manages the actual java installation.

Now I am trying to create a wrapper cookbook for tomcat, which just sets some meaningful defaults for my infrastructure when installing tomcat.

When installing tomcat via my tomcat-wrapper cookbook, I noticed that the tomcat cookbook fails, as the java keytool is not present where it is expected. Up on closer inspection, I noticed that the tomcat cookbook pulls in openjdk. I tried running the oracle-java cookbook before running the tomcat cookbook, but that didn't change anything. It seems that the tomcat cookbook just overrides the previous oracle java installation.

I am using - or at least trying to use - Berkshelf to manage my dependencies.

How do I tell my tomcat wrapper cookbook to not use the java cookbook and use the already existing java installation? Or, even better, not use the java cookbook and use the oracle-java cookbook, which depends on my fork of the java cookbook?

Thanks,
Steve

Ha, there actually is a ticket, which describes the same issue:
https://tickets.opscode.com/browse/COOK-2695

On Nov 1, 2013, at 12:05 PM, Steve Hummingbird wrote:

I am on Ubuntu. I just checked running my cookbooks, without the tomcat cookbook and issuing a manual apt-get install tomcat7 on the node. Seems like this pulls in openjdk as well :confused:
Oracle JDK is no longer available via packet managers. So that unfortunately is not an option.
Probably the best thing to do here is to use a different cookbook or fork the cookbook to directly download tomcat from the website and install it that way. SImilar to what the java cookbook is doing for oracle jdk.
It just seems kind of messy to me to install openjdk and then install oracle jdk as well, even though this seems to be the recommended way: Installing tomcat from repo with Java from Oracle - Ask Ubuntu

-Steve

On Nov 1, 2013, at 3:58 AM, Julian C. Dunn wrote:

On Thu, Oct 31, 2013 at 6:47 PM, Steve Hummingbird
steve.hummingbird@yandex.com wrote:

When installing tomcat via my tomcat-wrapper cookbook, I noticed that the tomcat cookbook fails, as the java keytool is not
present where it is expected. Up on closer inspection, I noticed that the tomcat cookbook pulls in openjdk. I tried running the
oracle-java cookbook before running the tomcat cookbook, but that didn't change anything. It seems that the tomcat cookbook
just overrides the previous oracle java installation.

I have seen this before on RHEL/CentOS (if you are not on one of these
platforms then ignore the following advice).

It is not really a Chef problem, but a RHEL problem in that the Tomcat
RPM pulls in OpenJDK, because that is what provides "java". You could
try installing Oracle Java via RPM if it also provides "java".

Alternately, you can leave OpenJDK on the system just to satisfy the
RPM depends and then update-alternatives right after Tomcat gets
installed. In fact you might even be able to notify :execute on
"bash[update-java-alternatives]" if you still have that in your
resource collection from the Java cookbook.

  • Julian