Skip to content

Instantly share code, notes, and snippets.

@bitemyapp
Created July 10, 2012 23:10
Show Gist options
  • Save bitemyapp/3086836 to your computer and use it in GitHub Desktop.
Save bitemyapp/3086836 to your computer and use it in GitHub Desktop.
def _install_java():
with settings(warn_only=True):
java_installed = (run("java -version 2>&1 | grep 'HotSpot'").find("Java HotSpot") == 0)
if not java_installed:
run("sudo rm -f /var/lib/dpkg/info/oracle-java7-installer*")
with settings(warn_only=True):
run("sudo apt-get purge oracle-java7-installer*")
run("sudo rm -f /etc/apt/sources.list.d/*java*")
run("sudo apt-get update")
run("sudo apt-get install -y python-software-properties")
run("sudo add-apt-repository ppa:webupd8team/java")
run("sudo apt-get update")
run("sudo apt-get install -y oracle-java7-installer")
@koblas
Copy link

koblas commented Jul 12, 2012

@bitemyapp
Copy link
Author

We were having some issues with sudo's shell encapsulation. These are unresolved issues that even the maintainer of Fabric knows exist but isn't the mood to track down, and is thus removing the functionality entirely in Fabric 2.0.

I was able to come up with a work-around more recently that is cleaner, but I hadn't cleaned up this section of code yet.

Generally speaking I don't touch any of the devops code, even for cleanup, unless I'm currently in the process of using it to deploy something I'll actually use, that way I don't change anything that'll break two weeks later and I won't remember what I changed.

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