Skip to content

ansible: fix existing Java detection edge case#4295

Open
richardlau wants to merge 1 commit intonodejs:mainfrom
richardlau:java-detect
Open

ansible: fix existing Java detection edge case#4295
richardlau wants to merge 1 commit intonodejs:mainfrom
richardlau:java-detect

Conversation

@richardlau
Copy link
Copy Markdown
Member

Add additional check for whether an existing java ran successfully as the original check could erroneously match if the Java version being checked for was in an error message (e.g. part of the directory name included in the message).


An example (from playbook runs for #4294):

TASK [java-base : Check if java is already installed] ***********************************************************************************************************************************************************
[WARNING]: raw module does not support the environment keyword
fatal: [test-ibm-aix72-ppc64_be-1]: FAILED! => {"changed": false, "msg": "non-zero return code", "rc": 6, "stderr": "Shared connection to 169.54.113.142 closed.\r\n", "stderr_lines": ["Shared connection to 169.54.113.142 closed."], "stdout": "Error: dl failure on line 591\r\nError: failed /opt/jdk-17.0.18+8-jre/lib/server/libjvm.so, because Could not load module /opt/jdk-17.0.18+8-jre/lib/server/libjvm.so.\r\nSystem error: Exec format error\r\n", "stdout_lines": ["Error: dl failure on line 591", "Error: failed /opt/jdk-17.0.18+8-jre/lib/server/libjvm.so, because Could not load module /opt/jdk-17.0.18+8-jre/lib/server/libjvm.so.", "System error: Exec format error"]}
...ignoring

The original check was passing because jdk-17.0.18+8 was in stdout from the failing command.

Add additional check for whether an existing `java` ran successfully
as the original check could erroneously match if the Java version
being checked for was in an error message (e.g. part of the directory
name included in the message).
Copy link
Copy Markdown
Member

@sxa sxa left a comment

Choose a reason for hiding this comment

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

I'm guessing this has been tested, in which case I approve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants