-
Notifications
You must be signed in to change notification settings - Fork 117
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
Ensure Java 8 is installed #146
Conversation
147b310
to
63ef844
Compare
|
||
for command in possible_cmds: | ||
try: | ||
output = ssh_check_output( |
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.
Hmm, I think this will always return an empty string because java -version
spits its output on stderr
, whereas ssh_check_output()
only returns stdout
.
Ultimately, I want to change ssh_check_output()
so that it cleanly returns both stdout
and stderr
, but in the meantime you can fix this by updating your possible_cmds
to redirect stderr
to stdout
.
$ORIGINAL_COMMAND 2>&1
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.
Hmm, you're right. There should be no output!
But I've tested this code many times to confirm the output. Let me test this again.
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.
It will still work for the current default AMIs because no output means Java 8 gets installed, but it will do unnecessary work if Java 8 is already installed.
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.
Actually, my main test case was Amazon Linux where Java 1.7 is installed by default. I've confirmed the function returning (1, 7).
But just in case, I'll add 2>&1
to the code.
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.
You're right. No idea why that's happening... Thanks for patching that up anyway.
Updated to redirect stderr to stdout. Should work even if the behaviour of |
Hey @serialx, sorry about the delay in finishing up the review on this. I'll hopefully get to this sometime next week. |
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.
This looks good to me and I tested it out. Just a couple of minor comments about wording/comments and we can merge this in.
Sorry about the delays in reviewing this @serialx!
host = client.get_transport().getpeername()[0] | ||
java_major_version = get_java_major_version(client) | ||
|
||
# The default CentOS AMIs on EC2 don't come with Java installed. |
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.
I think we can remove this comment and the one immediately below it.
sudo yum install -y java-1.8.0-openjdk | ||
|
||
# Remove any older versions of Java to force the default Java to 1.8. | ||
# We don't use alternatives because it does not seem to update links in /usr/lib/jvm correctly, |
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.
Can we update this to say "We don't use /etc/alternatives..." or something like that so it's clear that we're talking about a specific piece software? Otherwise I will probably forget what this is about in a few months. 😆
Done! :) |
Since Spark 2.0 Java 1.7 is deprecated. And many of the optimisations require Java 1.8. This patch ensures Java 1.8 in CentOS-like distros including Amazon Linux. It also removes any previous versions of Java to resolve any possible version conflicts. This closes nchammas#143
Excellent. Thank you for your patience! |
Since Spark 2.0 Java 1.7 is deprecated. And many of the optimisations require Java 1.8. This patch ensures Java 1.8 in CentOS-like distros including Amazon Linux. It also removes any previous versions of Java to resolve any possible version conflicts.
This closes #143
I've tested this with our production deployment.