Search in sources :

Example 1 with TemplatedFile

use of org.platformlayer.ops.filesystem.TemplatedFile in project platformlayer by platformlayer.

the class CollectdMetricSet method addChildren.

@Override
protected void addChildren() throws OpsException {
    File confDir = new File("/etc/collectd/conf");
    TemplatedFile confFile = TemplatedFile.build(Injection.getInstance(CollectdModelBuilder.class), new File(confDir, getMetricKey() + ".conf"));
    addChild(confFile);
}
Also used : TemplatedFile(org.platformlayer.ops.filesystem.TemplatedFile) TemplatedFile(org.platformlayer.ops.filesystem.TemplatedFile) File(java.io.File)

Example 2 with TemplatedFile

use of org.platformlayer.ops.filesystem.TemplatedFile in project platformlayer by platformlayer.

the class NetworkBridge method addChildren.

@Override
protected void addChildren() throws OpsException {
    // We would need proxy_arp if they were on the same IPV4 network
    // Do we need proxy_ndp ???
    // echo 1 > /proc/sys/net/ipv6/conf/eth0/proxy_ndp
    addChild(SysctlSetting.build("net.ipv4.ip_forward", "1"));
    addChild(SysctlSetting.build("net.ipv6.conf.all.forwarding", "1"));
    addChild(SysctlSetting.build("net.ipv6.conf.all.proxy_ndp", "1"));
    {
        File scriptPath = new File("/etc/network/if-up.d/nat-for-bridge");
        TemplatedFile nat = addChild(TemplatedFile.build(template, scriptPath));
        nat.setFileMode("0755");
        // Simulate an ifup run
        Command command = Command.build(scriptPath);
        CommandEnvironment env = new CommandEnvironment();
        env.put("IFACE", template.getPublicInterface());
        env.put("MODE", "start");
        env.put("ADDRFAM", "inet");
        command.setEnvironment(env);
        nat.setUpdateAction(command);
    }
}
Also used : TemplatedFile(org.platformlayer.ops.filesystem.TemplatedFile) Command(org.platformlayer.ops.Command) CommandEnvironment(org.platformlayer.ops.CommandEnvironment) TemplatedFile(org.platformlayer.ops.filesystem.TemplatedFile) File(java.io.File)

Aggregations

File (java.io.File)2 TemplatedFile (org.platformlayer.ops.filesystem.TemplatedFile)2 Command (org.platformlayer.ops.Command)1 CommandEnvironment (org.platformlayer.ops.CommandEnvironment)1