azavea / ansible-java

An Ansible role for installing Java.
Apache License 2.0
4 stars 15 forks source link

Execute JDK post-install script without depending on handlers #35

Closed hectcastro closed 6 years ago

hectcastro commented 6 years ago

Using Ansible handlers to execute the JDK post-installation script (that works around a bug in the package) is failure prone because any failure in the overall Ansible run negates the execution of any queued handlers. If the event that initially queued the handle completed prior to that failure, the handler will never get queued again.

These changes make it so that a missing /etc/ssl/certs/java/cacerts triggers the post-installation script execution.

In addition:

Fixes #33 Fixes #34


Testing

Execute the following command two times in a row, consecutively:

$ molecule converge

Ensure that the first pass triggers:

TASK [ansible-java : Execute post-installation script for CA certificates] *****
changed: [ansible-java]

Ensure that the second pass emits:

TASK [ansible-java : Determine if JDK CA certificates directory exists] ********
skipping: [ansible-java]

TASK [ansible-java : Execute post-installation script for CA certificates] *****
skipping: [ansible-java]

Afterwards, execute molecule destroy.

(You can test the Xenial path by adding --platform xenial64 to converge and destroy.)