Examples of runScriptOnNodesMatching()


Examples of org.jclouds.compute.ComputeService.runScriptOnNodesMatching()

    ComputeServiceContext computeServiceContext = getCompute().apply(spec);
    ComputeService computeService = computeServiceContext.getComputeService();
    Cluster cluster = getClusterStateStore(spec).load();

    RunScriptOptions options = RunScriptOptions.Builder.runAsRoot(false).wrapInInitScript(false);
    return computeService.runScriptOnNodesMatching(Predicates.<NodeMetadata>and(condition, runningIn(cluster)), statement, options);
  }

  private Predicate<NodeMetadata> runningIn(Cluster cluster) {
    final Set<String> instanceIds = new HashSet<String>(Collections2.transform(cluster.getInstances(), new Function<Instance, String>() {
      @Override
View Full Code Here

Examples of org.jclouds.compute.ComputeService.runScriptOnNodesMatching()

        if (useConfiguredPrivateKey(config)) {
            loginBuilder.privateKey(Files.toString(new File(config.getPrivateKeyFile()), Charset.defaultCharset()));
        }

        computeService.runScriptOnNodesMatching(runningInGroup(config.getTagPrefix() + id),
                Statements.exec(buildStartupScript(id, config)),
                RunScriptOptions.Builder.blockOnComplete(false).overrideLoginCredentials(loginBuilder.build()));
    }

    private boolean useConfiguredPrivateKey(JcloudsNodeLauncherConfig config) {
View Full Code Here

Examples of org.jclouds.compute.ComputeService.runScriptOnNodesMatching()

        template.getOptions().runAsRoot(m_runAsRoot);

        Set<? extends NodeMetadata> tag = computeService.createNodesInGroup(m_tagPrefix + id, 1, template);
        System.out.println("In case you need it, this is the key to ssh to " + id + ":\n"
                + tag.iterator().next().getCredentials().credential);
        computeService.runScriptOnNodesMatching(runningInGroup(m_tagPrefix + id),
                Statements.exec(buildStartupScript(id)),
                RunScriptOptions.Builder.blockOnComplete(false));
    }
   
    int[] mergePorts(int[] first, int[] last) {
View Full Code Here

Examples of org.jclouds.compute.ComputeService.runScriptOnNodesMatching()

         }

         Map<? extends NodeMetadata, ExecResponse> responseMap = null;

          if (getScript() != null) {
              responseMap = service.runScriptOnNodesMatching(getNodeFilter(),
                      getScript(), overrideLoginCredentials(credentials).runAsRoot(runAsRoot()));
          } else if (getStatement() != null) {
             responseMap = service.runScriptOnNodesMatching(getNodeFilter(),
                      getStatement(), overrideLoginCredentials(credentials).runAsRoot(runAsRoot()));
          }
View Full Code Here

Examples of org.jclouds.compute.ComputeService.runScriptOnNodesMatching()

          if (getScript() != null) {
              responseMap = service.runScriptOnNodesMatching(getNodeFilter(),
                      getScript(), overrideLoginCredentials(credentials).runAsRoot(runAsRoot()));
          } else if (getStatement() != null) {
             responseMap = service.runScriptOnNodesMatching(getNodeFilter(),
                      getStatement(), overrideLoginCredentials(credentials).runAsRoot(runAsRoot()));
          }

          for (Map.Entry<? extends NodeMetadata, ExecResponse> entry : responseMap.entrySet()) {
            ExecResponse response = entry.getValue();
View Full Code Here

Examples of org.jclouds.compute.ComputeService.runScriptOnNodesMatching()

            System.out.printf(">> running [%s] on group %s as %s%n", command, groupName, login.identity);

            // when you run commands, you can pass options to decide whether to
            // run it as root, supply or own credentials vs from cache, and wrap
            // in an init script vs directly invoke
            Map<? extends NodeMetadata, ExecResponse> responses = compute.runScriptOnNodesMatching(//
                  inGroup(groupName), // predicate used to select nodes
                  exec(command), // what you actually intend to run
                  overrideLoginCredentials(login) // use my local user &
                                                 // ssh key
                        .runAsRoot(false) // don't attempt to run as root (sudo)
View Full Code Here

Examples of org.jclouds.compute.ComputeService.runScriptOnNodesMatching()

         case RUN:
            System.out.printf(">> running [%s] on group %s as %s%n", file, groupName, login.identity);

            // when running a sequence of commands, you probably want to have jclouds use the default behavior,
            // which is to fork a background process.
            responses = compute.runScriptOnNodesMatching(//
                  inGroup(groupName),
                  Files.toString(file, Charsets.UTF_8), // passing in a string with the contents of the file
                  overrideLoginCredentials(login)
                        .runAsRoot(false)
                        .nameTask("_" + file.getName().replaceAll("\\..*", ""))); // ensuring task name isn't
View Full Code Here

Examples of org.jclouds.compute.ComputeService.runScriptOnNodesMatching()

          clusterSpec.getPrivateKey());
      try {
        LOG.info("Running configuration script");
        if (LOG.isDebugEnabled())
          LOG.debug("Running script:\n{}", statementBuilder.render(OsFamily.UNIX));
        computeService.runScriptOnNodesMatching(
            toNodeMetadataPredicate(clusterSpec, cluster, entry.getKey().getRoles()),
            statementBuilder,
            RunScriptOptions.Builder.overrideCredentialsWith(credentials));
        LOG.info("Configuration script run completed");
      } catch (RunScriptOnNodesException e) {
View Full Code Here

Examples of org.jclouds.compute.ComputeService.runScriptOnNodesMatching()

            System.out.printf(">> running [%s] on group %s as %s%n", command, groupName, login.identity);

            // when you run commands, you can pass options to decide whether to
            // run it as root, supply or own credentials vs from cache, and wrap
            // in an init script vs directly invoke
            Map<? extends NodeMetadata, ExecResponse> responses = compute.runScriptOnNodesMatching(//
                  inGroup(groupName), // predicate used to select nodes
                  exec(command), // what you actually intend to run
                  overrideLoginCredentials(login) // use my local user &
                                                 // ssh key
                        .runAsRoot(false) // don't attempt to run as root (sudo)
View Full Code Here

Examples of org.jclouds.compute.ComputeService.runScriptOnNodesMatching()

         case RUN:
            System.out.printf(">> running [%s] on group %s as %s%n", file, groupName, login.identity);

            // when running a sequence of commands, you probably want to have jclouds use the default behavior,
            // which is to fork a background process.
            responses = compute.runScriptOnNodesMatching(//
                  inGroup(groupName),
                  Files.toString(file, Charsets.UTF_8), // passing in a string with the contents of the file
                  overrideLoginCredentials(login)
                        .runAsRoot(false)
                        .nameTask("_" + file.getName().replaceAll("\\..*", ""))); // ensuring task name isn't
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.