Package org.platformlayer.ops

Examples of org.platformlayer.ops.OpsTarget.readTextFile()


      return;
    }

    String fstabLine = "\ncgroup\t/cgroup\tcgroup\tdefaults\t0\t0";
    File fstabFile = new File("/etc/fstab");
    String fstab = target.readTextFile(fstabFile);
    fstab += fstabLine;
    FileUpload.upload(target, fstabFile, fstab);

    target.mkdir(cgroupsFile);
View Full Code Here


    @Override
    protected byte[] getContentsBytes() throws OpsException {
      if (!built) {
        OpsTarget target = OpsContext.get().getInstance(OpsTarget.class);

        String etcIssue = target.readTextFile(new File("/etc/issue"));
        if (etcIssue.startsWith("Debian")) {
          addDefaultsDebian(target);
        } else if (etcIssue.startsWith("Ubuntu")) {
          addDefaultsUbuntu(target);
        } else {
View Full Code Here

    command.setTimeout(TimeSpan.THIRTY_MINUTES);

    try {
      target.executeCommand(command);
    } catch (ProcessExecutionException e) {
      String debootstrapLog = target.readTextFile(new File(rootfsDir, "debootstrap/debootstrap.log"));
      log.warn("Debootstrap log: " + debootstrapLog);

      throw new OpsException("Error running debootstrap", e);
    }
View Full Code Here

        target.mkdir(adminSshDir);

        String passphrase = "";
        target.executeCommand("ssh-keygen -t rsa -f {0} -P {1}", privateKeyFile, passphrase);

        String privateKeyData = target.readTextFile(privateKeyFile);
        String publicKeyData = target.readTextFile(publicKeyFile);

        target.executeCommand("cat {0} | sudo -H -u gitosis gitosis-init", publicKeyFile);

        target.setFileContents(authorizedKeys, publicKeyData);
View Full Code Here

        String passphrase = "";
        target.executeCommand("ssh-keygen -t rsa -f {0} -P {1}", privateKeyFile, passphrase);

        String privateKeyData = target.readTextFile(privateKeyFile);
        String publicKeyData = target.readTextFile(publicKeyFile);

        target.executeCommand("cat {0} | sudo -H -u gitosis gitosis-init", publicKeyFile);

        target.setFileContents(authorizedKeys, publicKeyData);
        target.executeCommand("chown -R {0} {1}", adminUser, adminSshDir);
View Full Code Here

    // Fix hostname
    File hostsFile = new File("/etc/hosts");

    String hostLine = "127.0.0.1\t" + hostname;

    String hosts = target.readTextFile(hostsFile);

    boolean found = false;
    for (String line : Splitter.on("\n").trimResults().split(hosts)) {
      if (line.equals(hostLine)) {
        found = true;
View Full Code Here

    File path = new File(DnsServerTemplate.getZonesDir(), zoneFile.getKey());
    String data = zoneFile.getData();

    OpsTarget target = targetServer.getTarget();

    String existing = target.readTextFile(path);
    boolean isSame = Objects.equal(data, existing);

    if (!isSame) {
      // TODO: The serial value means that this is always dirty
      log.info("Uploading zone file: " + path);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.