use of org.platformlayer.ops.Handler in project platformlayer by platformlayer.
the class GitCheckout method handler.
@Handler
public void handler(OpsTarget target) throws OpsException {
if (OpsContext.isConfigure()) {
if (target.getFilesystemInfoFile(targetDir) != null) {
log.warn("Directory already exists; skipping clone (should we update?)");
} else {
File checkoutDir = targetDir.getParentFile();
Command command = Command.build("cd {0}; git clone {1}", checkoutDir, source);
command.setTimeout(TimeSpan.FIVE_MINUTES);
target.executeCommand(command);
}
}
}
use of org.platformlayer.ops.Handler in project platformlayer by platformlayer.
the class MysqlServerBootstrap method handler.
@Handler
public void handler() throws OpsException {
MysqlServer model = OpsContext.get().getInstance(MysqlServer.class);
MysqlTarget mysql = new MysqlTarget("localhost", "root", model.rootPassword);
if (!mysql.canLogin()) {
mysql = new MysqlTarget("localhost", "root", MysqlServerController.DEFAULT_BOOTSTRAP_PASSWORD);
// Clean up the users table
mysql.execute("delete from mysql.user where user='';");
mysql.execute("update mysql.user set host='%' where user='root' and host='localhost';");
mysql.execute("delete from mysql.user where user='root' and host<>'%';");
mysql.execute("flush privileges;");
mysql.changePassword(model.rootPassword);
}
}
use of org.platformlayer.ops.Handler in project platformlayer by platformlayer.
the class GreTunnel method handler.
@Handler
public void handler(OpsTarget target) throws OpsException {
// ip tunnel add netb mode gre remote 184.173.172.26 local 209.105.243.38 ttl 255
Command addTunnel = Command.build("ip tunnel add {0} mode gre remote {1} local {2} ttl 255", tunnelName, remoteTunnelAddress, localTunnelAddress);
target.executeCommand(addTunnel);
// ip addr add fdfd:fdfd:fdfd:1::/64 dev netb
Command tunnelAddAddress = Command.build("ip addr add {0} dev {1}", localPrivateAddress, tunnelName);
target.executeCommand(tunnelAddAddress);
// ip route add fdfd:fdfd:fdfd:1::/64 dev netb
Command tunnelAddRoute = Command.build("ip route add {0} dev {1}", remotePrivateNetwork, tunnelName);
target.executeCommand(tunnelAddRoute);
Command tunnelUp = Command.build("ip link set {0} up", tunnelName);
target.executeCommand(tunnelUp);
}
use of org.platformlayer.ops.Handler in project platformlayer by platformlayer.
the class DnsServerBootstrap method handler.
@Handler
public void handler(OpsTarget target) throws OpsException {
for (DnsZone record : platformLayer.listItems(DnsZone.class)) {
ZoneFile dnsFile = dns.buildDnsFile(record);
dns.upload(target, dnsFile);
}
}
use of org.platformlayer.ops.Handler in project platformlayer by platformlayer.
the class GerritBootstrap method handler.
@Handler
public void handler(OpsTarget target) throws OpsException, IOException {
File canary = new File(template.getDataDir(), "bin/gerrit.sh");
if (target.getFilesystemInfoFile(canary) == null) {
if (OpsContext.isConfigure()) {
File dataDir = template.getDataDir();
Command command = Command.build("java");
command.addLiteral("-jar").addFile(template.getInstallWarFile());
command.addLiteral("init");
command.addLiteral("--no-auto-start");
command.addLiteral("--batch");
command.addLiteral("-d").addFile(dataDir);
target.executeCommand(command);
}
}
// DROP TABLE contributor_agreements;
// DROP TABLE account_agreements;
// DROP TABLE account_group_agreements;
// ALTER TABLE accounts DROP COLUMN display_patch_sets_in_reverse_order;
// ALTER TABLE accounts DROP COLUMN display_person_name_in_review_category;
// ALTER TABLE tracking_ids DROP COLUMN tracking_id;
// ALTER TABLE account_groups DROP COLUMN owner_group_id;
// ALTER TABLE account_groups DROP COLUMN external_name;
}
Aggregations