use of org.platformlayer.ops.Command in project platformlayer by platformlayer.
the class UpdatePackages method handler.
@Handler
public void handler(OpsTarget target) throws OpsException {
apt.update(target, true);
List<String> outOfDatePackage = apt.findOutOfDatePackages(target);
if (!outOfDatePackage.isEmpty()) {
// Pre-download any out-of-date files; will make any maintenance window smaller
Command command = Command.build("apt-get --yes --download-only dist-upgrade");
target.executeCommand(command);
}
Deviations.assertEquals(Collections.emptyList(), outOfDatePackage, "Packaged out of date");
}
use of org.platformlayer.ops.Command in project platformlayer by platformlayer.
the class ZookeeperUtils method sendCommand.
public static ZookeeperResponse sendCommand(OpsTarget target, InetSocketAddress socketAddress, String zkCommand) throws OpsException {
Command command = Command.build("echo {0} | nc {1} {2}", zkCommand, socketAddress.getAddress().getHostAddress(), socketAddress.getPort());
ProcessExecution execution = target.executeCommand(command);
return new ZookeeperResponse(execution.getStdOut());
}
Aggregations