Examples of RunScriptOptions


Examples of org.jclouds.compute.options.RunScriptOptions

           Function<Template, LoginCredentials> credentialsFromImageOrTemplateOptions) {
      super(credentialsFromImageOrTemplateOptions);
   }

   public LoginCredentials apply(Template template, LoginCredentials fromNode) {
      RunScriptOptions options = checkNotNull(template.getOptions(), "template options are required");
      LoginCredentials.Builder builder = LoginCredentials.builder(fromNode);
      if (options.getLoginUser() != null)
         builder.user(template.getOptions().getLoginUser());
      if (options.getLoginPassword() != null)
         builder.password(options.getLoginPassword());
      if (options.getLoginPrivateKey() != null)
         builder.privateKey(options.getLoginPrivateKey());
      if (options.shouldAuthenticateSudo() != null && options.shouldAuthenticateSudo())
         builder.authenticateSudo(true);
      return builder.build();
   }
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

    final String phaseName = getAction();
    final Collection<Future<ExecResponse>> futures = Sets.newHashSet();

    final ClusterSpec clusterSpec = eventMap.values().iterator().next().getClusterSpec();

    final RunScriptOptions options = overrideLoginCredentials(LoginCredentials.builder().user(clusterSpec.getClusterUser())
                                                              .privateKey(clusterSpec.getPrivateKey()).build());
    for (Map.Entry<InstanceTemplate, ClusterActionEvent> entry : eventMap.entrySet()) {
      if (shouldIgnoreInstanceTemplate(entry.getKey())) {
        continue; // skip if not in the target
      }
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

           Function<Template, LoginCredentials> credentialsFromImageOrTemplateOptions) {
      super(credentialsFromImageOrTemplateOptions);
   }

   public LoginCredentials apply(Template template, LoginCredentials fromNode) {
      RunScriptOptions options = checkNotNull(template.getOptions(), "template options are required");
      LoginCredentials.Builder builder = LoginCredentials.builder(fromNode);
      if (options.getLoginUser() != null)
         builder.user(template.getOptions().getLoginUser());
      if (options.getLoginPassword() != null)
         builder.password(options.getLoginPassword());
      if (options.getLoginPrivateKey() != null)
         builder.privateKey(options.getLoginPrivateKey());
      if (options.shouldAuthenticateSudo() != null && options.shouldAuthenticateSudo())
         builder.authenticateSudo(true);
      return builder.build();
   }
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

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

Examples of org.jclouds.compute.options.RunScriptOptions

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

Examples of org.jclouds.compute.options.RunScriptOptions

    final String phaseName = getAction();
    final Collection<Future<ExecResponse>> futures = Sets.newHashSet();

    final ClusterSpec clusterSpec = eventMap.values().iterator().next().getClusterSpec();

    final RunScriptOptions options = overrideLoginCredentials(LoginCredentials.builder().user(clusterSpec.getClusterUser())
                                                              .privateKey(clusterSpec.getPrivateKey()).build());
    for (Map.Entry<InstanceTemplate, ClusterActionEvent> entry : eventMap.entrySet()) {
      if (shouldIgnoreInstanceTemplate(entry.getKey())) {
        continue; // skip if not in the target
      }
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

      final ComputeService computeService = computeServiceContext.getComputeService();

      LoginCredentials credentials = LoginCredentials.builder().user(clusterSpec.getClusterUser())
            .privateKey(clusterSpec.getPrivateKey()).build();
     
      final RunScriptOptions options = overrideLoginCredentials(credentials);

      if (numberAllocated == 0) {
        for (ComputeMetadata compute : computeService.listNodes()) {
          if (!(compute instanceof NodeMetadata)) {
            throw new IllegalArgumentException("Not an instance of NodeMetadata: " + compute);
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

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

Examples of org.jclouds.compute.options.RunScriptOptions

@Singleton
public class DefaultCredentialsFromImageOrOverridingCredentials implements Function<Template, LoginCredentials> {

   @Override
   public LoginCredentials apply(Template template) {
      RunScriptOptions options = template.getOptions();
      LoginCredentials defaultCreds = template.getImage().getDefaultCredentials();
      return overrideDefaultCredentialsWithOptionsIfPresent(defaultCreds, options);
   }
View Full Code Here

Examples of org.jclouds.compute.options.RunScriptOptions

      sshClient.disconnect();
      replay(sshClient);

      RunScriptOnNodeAsInitScriptUsingSsh testMe = new RunScriptOnNodeAsInitScriptUsingSsh(Functions
               .forMap(ImmutableMap.of(node, sshClient)), eventBus, InitScriptConfigurationForTasks.create()
               .appendIncrementingNumberToAnonymousTaskNames(), node, command, new RunScriptOptions().runAsRoot(false));

      assertEquals(testMe.getInitFile(), "/tmp/init-jclouds-script-0");
      assertEquals(testMe.getNode(), node);
      assertEquals(testMe.getStatement(), init);
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.