Skip to content

Instantly share code, notes, and snippets.

@ahgittin
Created October 25, 2011 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahgittin/1314030 to your computer and use it in GitHub Desktop.
Save ahgittin/1314030 to your computer and use it in GitHub Desktop.
whirr-49 options for cluster controller
 public Map<? extends NodeMetadata, ExecResponse> runScriptOnNodesMatching(ClusterSpec spec,
       Predicate<NodeMetadata> condition, Statement statement) throws IOException, RunScriptOnNodesException {
   return runScriptOnNodesMatching(spec, condition, statement, null);
 }
 public Map<? extends NodeMetadata, ExecResponse> runScriptOnNodesMatching(ClusterSpec spec,
     Predicate<NodeMetadata> condition, Statement statement, RunScriptOptions options)
     throws IOException, RunScriptOnNodesException {
   Credentials credentials = new Credentials(spec.getClusterUser(), spec.getPrivateKey());
   if (options==null)
     options = overrideCredentialsWith(credentials).wrapInInitScript(false).runAsRoot(false);
   else if (options.getOverridingCredentials()==null)
     options = options.overrideCredentialsWith(credentials);
   condition = Predicates.and(runningInGroup(spec.getClusterName()), condition);
   
   ComputeServiceContext context = getCompute().apply(spec);
   return context.getComputeService().runScriptOnNodesMatching(condition, statement, options);
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment