"cd ${BASE_DIR}", "echo BASE_DIR_RESULT':'`pwd`:BASE_DIR_RESULT") .environmentVariable("BASE_DIR", base) .requiringExitCodeZero() .summary("initializing on-box base dir "+base).newTask();
"ssh-keygen -t rsa -N '' -f $PRIVATE_KEY -C " + dumpId + " > /dev/null", "cat $PRIVATE_KEY.pub") .environmentVariable("RUN_DIR", sourceRunDir) .machine(sourceMachine) .summary("generate private key for slave access") dest.getAttribute(MySqlNode.RUN_DIR), dumpId)) .environmentVariable("RUN_DIR", sourceRunDir) .machine(sourceMachine) .summary("copy database dump to slave") "cd $RUN_DIR", "rm " + privateKeyFile) .environmentVariable("RUN_DIR", sourceRunDir) .machine(sourceMachine) .summary("remove private key"));
private void deleteSnapshot(MySqlCluster cluster) { ReplicationSnapshot replicationSnapshot = cluster.getAttribute(MySqlCluster.REPLICATION_LAST_SLAVE_SNAPSHOT); Entity snapshotEntity = mgmt.getEntityManager().getEntity(replicationSnapshot.getEntityId()); SshMachineLocation machine = EffectorTasks.getSshMachine(snapshotEntity); Entities.submit(snapshotEntity, SshEffectorTasks.ssh( "cd $RUN_DIR", "rm " + replicationSnapshot.getSnapshotPath()) .summary("clear snapshot") .machine(machine) .environmentVariable("RUN_DIR", snapshotEntity.getAttribute(MySqlNode.RUN_DIR)) .requiringExitCodeZero()) .asTask() .getUnchecked(); }
@Override public String execCalicoCommand(MesosSlave slave, String command) { String etcdUrl = sensors().get(ETCD_CLUSTER_URL); Maybe<SshMachineLocation> machine = Machines.findUniqueMachineLocation(slave.getLocations(), SshMachineLocation.class); TaskWrapper<String> process = SshEffectorTasks.ssh(BashCommands.sudo(command)) .environmentVariable("ETCD_AUTHORITY", etcdUrl) .machine(machine.get()) .configure(SshTool.PROP_ALLOCATE_PTY, true) .requiringZeroAndReturningStdout() .newTask(); String output = DynamicTasks.queue(process).asTask().getUnchecked(); return output; }