Package org.platformlayer.ops

Examples of org.platformlayer.ops.Command


    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);
      }
    }
View Full Code Here


    fstab += fstabLine;
    FileUpload.upload(target, fstabFile, fstab);

    target.mkdir(cgroupsFile);

    Command mountCommand = Command.build("mount cgroup");
    target.executeCommand(mountCommand);

    // mkdir /cgroup
    // echo -e "cgroup\t/cgroup\tcgroup\tdefaults\t0\t0" >> /etc/fstab
    // mount cgroup
View Full Code Here

    // this.addressPool4 = DirectCloudUtils.getPrivateAddressPool4().get();
  }

  public void terminate(String lxcId) throws OpsException {
    Command command = Command.build("lxc-stop -n {0}", lxcId);
    host.executeCommand(command);
  }
View Full Code Here

    Command command = Command.build("lxc-stop -n {0}", lxcId);
    host.executeCommand(command);
  }

  public void start(String lxcId) throws OpsException {
    Command command = Command.build("lxc-start -n {0} -d", lxcId);
    host.executeCommand(command);
  }
View Full Code Here

      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);
    }
  }
View Full Code Here

      script.addresses.add(address4);
      script.addresses.add(address6);

      // script.hostPrimaryInterface = hostModel.publicInterface;

      Command command = Command.build("lxc-start");
      command.addLiteral("--name").addQuoted(id);
      script.launchInstanceCommand = command;
    }

    {
      // ManagedSupervisordInstance service = instance.addChild(ManagedSupervisordInstance.class);
View Full Code Here

          String hostPrimaryInterface = getHostPrimaryInterface();
          if (Strings.isNullOrEmpty(hostPrimaryInterface)) {
            throw new OpsException("primaryInterface not specified");
          }

          Command command = Command.build("ip neigh add proxy {0} dev {1}", address, hostPrimaryInterface);
          sb.add(command);
        }
      }
    }
  }
View Full Code Here

  //
  // instance.config = Providers.of(sup);
  // }

  public void configure(ItemBase owner, StandardService service) {
    Command command = Command.build(filePath.getAbsolutePath());
    service.command = OpsProvider.of(command);

    service.key = key;
    service.owner = owner.getKey();
View Full Code Here

      throws OpsException {
    File ldifTempDir = target.createTempDir();
    File ldifTempFile = new File(ldifTempDir, "ldapmodify.ldif");
    FileUpload.upload(target, ldifTempFile, ldifCommands);
    try {
      Command command = Command.build(CMD_LDAP_MODIFY);

      if (add) {
        command.addLiteral("-a"); // Add
      }

      command.addLiteral("-x"); // Simple auth

      command.addLiteral("-D"); // Bind DN
      command.addQuoted(bindDN.toLdifEncoded());

      command.addLiteral("-w"); // Simple auth password
      command.addQuoted(password);

      command.addLiteral("-f"); // Command file
      command.addFile(ldifTempFile);

      target.executeCommand(command);
    } finally {
      target.rmdir(ldifTempDir);
    }
View Full Code Here

    Base, One, Sub, Children
  };

  public static List<LdifRecord> doLdapQuery(OpsTarget target, LdapDN bindDN, String ldapPassword,
      LdapDN searchBaseDN, String filter, SearchScope searchScope) throws OpsException {
    Command command = Command.build(CMD_LDAP_SEARCH);

    command.addLiteral("-LLL"); // Pure LDIF, no extra junk

    command.addLiteral("-x"); // Simple auth

    command.addLiteral("-D"); // Bind DN
    command.addQuoted(bindDN.toLdifEncoded());

    command.addLiteral("-w"); // Simple auth password
    command.addQuoted(ldapPassword);

    command.addLiteral("-b"); // Search base
    command.addQuoted(searchBaseDN.toLdifEncoded());

    command.addLiteral("-s"); // Scope
    command.addLiteral(searchScope.toString().toLowerCase());

    if (!Strings.isNullOrEmpty(filter)) {
      command.addQuoted(filter);
    }

    ProcessExecution processExecution = target.executeCommand(command);

    return LdifRecord.parse(processExecution.getStdOut());
View Full Code Here

TOP

Related Classes of org.platformlayer.ops.Command

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.