Package org.platformlayer.ops

Examples of org.platformlayer.ops.Command$Argument


    return new InetAddressPair(srcAddress, targetAddress);
  }

  private Inet6Address findIpv6(OpsTarget target) throws OpsException {
    Command command = Command.build("cat /proc/net/if_inet6");
    ProcessExecution execution = target.executeCommand(command);
    String inet6 = execution.getStdOut();

    // This didn't work for some reason (??)
    // String inet6 = target.readTextFile(new File("/proc/net/if_inet6"));
View Full Code Here


  public void add(Command command) {
    commands.add(command.buildCommandString());
  }

  public void add(String literal, Object... args) {
    Command command = Command.build(literal, args);
    add(command);
  }
View Full Code Here

      CurlRequest curlRequest = new CurlRequest(url);
      curlRequest.bareRequest = true;

      CommandEnvironment commandEnvironment = httpProxies.getHttpProxyEnvironment(target, Usage.General, url);

      Command curlCommand = curlRequest.toCommand();
      curlCommand.addLiteral(">");
      curlCommand.addFile(remoteFilePath);
      curlCommand.setEnvironment(commandEnvironment);
      curlCommand.setTimeout(TimeSpan.FIVE_MINUTES);

      // TODO: Can we cache into CAS instead??
      log.info("Not found in CAS system; downloading directly: " + url);
      target.executeCommand(curlCommand);
    } else {
View Full Code Here

  @Override
  protected void doUpdateAction(OpsTarget target) throws OpsException {
    super.doUpdateAction(target);

    Command executeScript = Command.build("{0}", getFilePath());
    target.executeCommand(executeScript);
  }
View Full Code Here

  @Override
  protected void doDeleteAction(OpsTarget target) throws OpsException {
    super.doDeleteAction(target);

    Command removeRule = buildIptablesDeleteCommand();
    target.executeCommand(removeRule);
  }
View Full Code Here

    target.executeCommand(removeRule);
  }

  @Override
  protected byte[] getContentsBytes() throws OpsException {
    Command command = buildIptablesAddCommand();

    ScriptBuilder sb = new ScriptBuilder();
    sb.addMetadata("key", ruleKey);
    sb.add(command);
View Full Code Here

    return sb.getBytes();
  }

  private Command buildIptablesAddCommand() throws OpsException {
    Command command = getRule().buildIptablesAddCommand();
    addKey(command);
    return command;
  }
View Full Code Here

    addKey(command);
    return command;
  }

  private Command buildIptablesDeleteCommand() throws OpsException {
    Command command = getRule().buildIptablesDeleteCommand();
    addKey(command);
    return command;
  }
View Full Code Here

              CommandEnvironment env = new CommandEnvironment();
              env.put("MODE", "start");
              env.put("IFACE", "--all");
              env.put("ADDRFAM", "meta");

              Command runLockdown = Command.build("/etc/network/if-pre-up.d/iptables-lockdown");
              runLockdown.setEnvironment(env);
              target.executeCommand(runLockdown);
            }
          }
        }));
View Full Code Here

    }
  }

  public static List<FirewallRecord> getCurrentFirewallState(OpsTarget target, Transport transport)
      throws OpsException {
    Command command = getIptablesCommand(transport);
    command.addLiteral("--list-rules");

    List<FirewallRecord> records = Lists.newArrayList();

    ProcessExecution execution = target.executeCommand(command);
    String stdout = execution.getStdOut();
View Full Code Here

TOP

Related Classes of org.platformlayer.ops.Command$Argument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.