Examples of OpsTarget


Examples of org.platformlayer.ops.OpsTarget

    // } else {
    targetAddress = NetworkPoint.forPublicHostname(model.host);
    // }

    Machine machine = new OpaqueMachine(targetAddress);
    OpsTarget machineTarget = machine.getTarget(sshKeys.findOtherServiceKey(new ServiceType("machines-direct")));

    CasStoreInfo casStoreOptions = new CasStoreInfo(true);
    FilesystemCasStore store = new FilesystemCasStore(casStoreOptions, new OpsCasTarget(machineTarget));
    return store;
  }
View Full Code Here

Examples of org.platformlayer.ops.OpsTarget

  }

  @Override
  public void doRecurseOperation() throws OpsException {
    Machine machine = new OpaqueMachine(address);
    OpsTarget target = machine.getTarget(sshKey);

    BindingScope scope = BindingScope.push(machine, target);
    try {
      OpsContext opsContext = OpsContext.get();
      OperationRecursor.doRecurseChildren(opsContext, this);
View Full Code Here

Examples of org.platformlayer.ops.OpsTarget

    this.username = username;
    this.password = password;
  }

  public void changePassword(Secret newPassword) throws OpsException {
    OpsTarget target = getOpsTarget();

    Command command = Command.build("mysqladmin");
    command.addQuoted("--user=", username);
    command.addQuoted("--host=", hostname);
    command.addQuoted("--password=", password);
    command.addLiteral("password");
    command.addQuoted(newPassword);

    target.executeCommand(command);

    password = newPassword;
  }
View Full Code Here

Examples of org.platformlayer.ops.OpsTarget

  private OpsTarget getOpsTarget() {
    return OpsContext.get().getInstance(OpsTarget.class);
  }

  public ProcessExecution execute(String sql, String maskedSql) throws OpsException {
    OpsTarget target = getOpsTarget();

    Command command = Command.build("mysql");
    command.addQuoted("--user=", username);
    command.addQuoted("--host=", hostname);
    command.addQuoted("--password=", password);

    command.addArgument(Argument.buildQuoted("--execute=", sql).setMasked("--execute=" + Command.MASKED));

    return target.executeCommand(command);
  }
View Full Code Here

Examples of org.platformlayer.ops.OpsTarget

  PlatformLayerHelpers platformLayer;

  public OpsTarget toTarget(DirectHost host) throws OpsException {
    NetworkPoint address = NetworkPoint.forPublicHostname(host.host);
    Machine hostMachine = new OpaqueMachine(address);
    OpsTarget hostTarget = hostMachine.getTarget(service.getSshKey());
    return hostTarget;
  }
View Full Code Here

Examples of org.platformlayer.ops.OpsTarget

  private static <T> OpsProvider<ResourcePool<T>> getUnsharedPrivatePoolProvider(final Class<T> clazz,
      final String key, final OpsProvider<? extends PoolBuilder<T>> poolBuilderProvider) {
    return new OpsProvider<ResourcePool<T>>() {
      @Override
      public ResourcePool<T> get() throws OpsException {
        OpsTarget target = OpsContext.get().getInstance(OpsTarget.class);

        File poolPath = getPoolPath(key);

        File resourceDir = new File(poolPath, "all");
        File assignedDir = new File(poolPath, "assigned");
View Full Code Here

Examples of org.platformlayer.ops.OpsTarget

      final List<Integer> publicPortGroup) {
    OpsProvider<ResourcePool<InetSocketAddress>> pool = new OpsProvider<ResourcePool<InetSocketAddress>>() {
      @Override
      public ResourcePool<InetSocketAddress> get() throws OpsException {
        DirectHost host = OpsContext.get().getInstance(DirectHost.class);
        OpsTarget target = OpsContext.get().getInstance(OpsTarget.class);

        PlatformLayerKey sharedNetworkKey = getSharedNetworkKey();

        // We don't skip here, at the moment.
        // We may just need a comma separated list in future...
View Full Code Here

Examples of org.platformlayer.ops.OpsTarget

  private OpsTarget getOpsTarget() {
    return OpsContext.get().getInstance(OpsTarget.class);
  }

  public ProcessExecution execute(String sql, String maskedSql) throws OpsException {
    OpsTarget target = getOpsTarget();

    // We probably want psql -A -t -c "command"

    Command command = Command.build("psql");
    command.addQuoted("--username=", username);
    command.addQuoted("--host=", hostname);

    command.addArgument(Argument.buildQuoted("--command=", sql).setMasked("--command=" + Command.MASKED));

    CommandEnvironment env = new CommandEnvironment();
    env.put("PGPASSWORD", password.plaintext());

    command.setEnvironment(env);
    return target.executeCommand(command);
  }
View Full Code Here

Examples of org.platformlayer.ops.OpsTarget

import org.platformlayer.ops.tree.OpsTreeBase;

public class ApacheBootstrap extends OpsTreeBase {
  @Handler
  public void handler() throws OpsException {
    OpsTarget target = OpsContext.get().getInstance(OpsTarget.class);

    target.rm(new File("/etc/apache2/sites-enabled/000-default"));
  }
View Full Code Here

Examples of org.platformlayer.ops.OpsTarget

                failed = true;
                continue;
            }

            SshKey sshKey = service.getSshKey();
            OpsTarget rootTarget = machine.getTarget(sshKey);

            OpsTarget adminTarget = getAdminTarget(rootTarget, machine);
            doOperation(adminTarget, operation);
        }

        if (failed) {
            throw new OpsException("Could not update all DNS servers in cluster").setRetry(TimeSpan.ONE_MINUTE);
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.