@Override public String perform(Host host, Uri<? extends Component> uri, Deployment d) throws Exception { SSH ssh = new SSH(host, d.getSpace(), credentialName); try { ssh.exec("sudo apt-get update"); String out = ssh.exec("yes | sudo apt-get install " + uri.getFragment().replaceAll(",", " ")); log.info("%s", out); return out; } finally { ssh.close(); } }
@Override public String unwind(Identity hostId, Uri<? extends Component> uri, Deployment d) throws Exception { log.info("unwinding %s on %s", uri, hostId); SSH ssh = new SSH(hostId, credentialName, d.getSpace()); try { String out = ssh.exec("yes | sudo apt-get purge " + uri.getFragment().replaceAll(",", " ")); log.info(out); return out; } finally { ssh.close(); } }